test_bug1165501.html (1537B)
1 <!DOCTYPE HTML> 2 <html> 3 <!-- 4 Spot test to see if newer meta-referrer policy is used 5 https://bugzilla.mozilla.org/show_bug.cgi?id=1165501 6 --> 7 8 <head> 9 <meta charset="utf-8"> 10 <title>Test policies for Bug 1165501</title> 11 <script src="/tests/SimpleTest/SimpleTest.js"></script> 12 <script type="application/javascript" src="referrerHelper.js"></script> 13 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> 14 15 <script type="application/javascript"> 16 17 SimpleTest.waitForExplicitFinish(); 18 var advance = function() { tests.next(); }; 19 20 /** 21 * testing if policy is overwritten if there are two meta statements (1165501) 22 * XXX: would be nice to test this with CSP and meta as well 23 */ 24 var tests = (function*() { 25 var iframe = document.getElementById("testframe"); 26 const sjs = "/tests/dom/base/test/bug704320.sjs?action=generate-policy-test"; 27 28 // setting first unsafe-url and then origin - origin shall prevail 29 yield resetCounter(); 30 yield iframe.src = sjs + "&policy=" + escape('origin')+ "&wrongPolicy=" + escape('unsafe-url'); 31 yield checkIndividualResults("unsafe-url then origin", ["origin"]); 32 33 // setting first no-referrer and then default - default shall prevail 34 yield resetCounter(); 35 yield iframe.src = sjs + "&policy=" + escape('default')+ "&wrongPolicy=" + escape('no-referrer'); 36 yield checkIndividualResults("no-referrer then default", ["full"]); 37 38 39 // complete. 40 SimpleTest.finish(); 41 })(); 42 43 </script> 44 </head> 45 46 <body onload="tests.next();"> 47 <iframe id="testframe"></iframe> 48 49 </body> 50 </html>