Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: chrome/content/tests/policy.js

Issue 29333123: Issue 3459 - Make content policy test for fetch() explicitly dispatch abp:frameready (Closed)
Patch Set: Set explicitEvent Created Dec. 31, 2015, 2:34 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 (function() 1 (function()
2 { 2 {
3 let server = null; 3 let server = null;
4 let frame = null; 4 let frame = null;
5 let requestNotifier = null; 5 let requestNotifier = null;
6 let httpProtocol = null; 6 let httpProtocol = null;
7 7
8 module("Content policy", { 8 module("Content policy", {
9 setup: function() 9 setup: function()
10 { 10 {
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 "HTML object (Java)", 287 "HTML object (Java)",
288 '<object type="application/x-java-applet" data="test.class"></object>', 288 '<object type="application/x-java-applet" data="test.class"></object>',
289 "http://127.0.0.1:1234/test.class", "object", false, false 289 "http://127.0.0.1:1234/test.class", "object", false, false
290 ]); 290 ]);
291 } 291 }
292 292
293 if ("fetch" in window) 293 if ("fetch" in window)
294 { 294 {
295 tests.push([ 295 tests.push([
296 "fetch() API", 296 "fetch() API",
297 '<script>fetch("test.xml").catch(function() {});</script>', 297 '<script>' +
298 "http://127.0.0.1:1234/test.xml", "xmlhttprequest", false, false 298 'fetch("test.xml").then(' +
299 'function()' +
300 '{' +
301 dispatchReadyEvent +
302 '},' +
303 'function()' +
304 '{' +
305 dispatchReadyEvent +
306 '}' +
307 ');' +
308 '</script>',
309 "http://127.0.0.1:1234/test.xml", "xmlhttprequest", false, true
299 ]); 310 ]);
300 } 311 }
301 312
302 let policyHits = []; 313 let policyHits = [];
303 function onPolicyHit(item, scanComplete) 314 function onPolicyHit(item, scanComplete)
304 { 315 {
305 if (!item) 316 if (!item)
306 return; 317 return;
307 if (item.location == "http://127.0.0.1:1234/test" || 318 if (item.location == "http://127.0.0.1:1234/test" ||
308 item.location == "http://127.0.0.1:1234/redirect.gif" || 319 item.location == "http://127.0.0.1:1234/redirect.gif" ||
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
447 3: "running with filter %S and site exception", 458 3: "running with filter %S and site exception",
448 4: "running with filter %S and exception not applicable to sites", 459 4: "running with filter %S and exception not applicable to sites",
449 5: "running with filter %S and sitekey exception", 460 5: "running with filter %S and sitekey exception",
450 6: "running with filter %S and $genericblock exception", 461 6: "running with filter %S and $genericblock exception",
451 7: "running with filter %S$domain=127.0.0.1 and $genericblock exception", 462 7: "running with filter %S$domain=127.0.0.1 and $genericblock exception",
452 8: "running with filter %S and $genericblock,sitekey exception" 463 8: "running with filter %S and $genericblock,sitekey exception"
453 }; 464 };
454 465
455 for (let test = 0; test < tests.length; test++) 466 for (let test = 0; test < tests.length; test++)
456 { 467 {
457 let [name, body, expectedURL, expectedType, expectedDomain, expectedThirdPar ty] = tests[test]; 468 let [name, , expectedURL] = tests[test];
Sebastian Noack 2015/12/31 14:36:39 I were already wondering whether the last paramete
458 for (let stage = 1; stage in stageDescriptions; stage++) 469 for (let stage = 1; stage in stageDescriptions; stage++)
459 { 470 {
460 let stageDescription = stageDescriptions[stage]; 471 let stageDescription = stageDescriptions[stage];
461 if (stageDescription.indexOf("%S") >= 0) 472 if (stageDescription.indexOf("%S") >= 0)
462 stageDescription = stageDescription.replace("%S", expectedURL); 473 stageDescription = stageDescription.replace("%S", expectedURL);
463 474
464 asyncTest(name + " (" + stageDescription + ")", runTest.bind(null, tests[t est], stage)); 475 asyncTest(name + " (" + stageDescription + ")", runTest.bind(null, tests[t est], stage));
465 } 476 }
466 } 477 }
467 })(); 478 })();
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld