test_anchor_area_referrer_invalid.html (2901B)
1 <!DOCTYPE HTML> 2 <html> 3 <head> 4 <meta charset="utf-8"> 5 <title>Test anchor and area policy attribute for Bug 1174913</title> 6 <script src="/tests/SimpleTest/SimpleTest.js"></script> 7 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> 8 9 <!-- 10 Testing that anchor and area referrer attributes are honoured correctly 11 * anchor tag with invalid referrer attributes 12 https://bugzilla.mozilla.org/show_bug.cgi?id=1174913 13 --> 14 15 <script type="application/javascript"> 16 17 const SJS = "://example.com/tests/dom/base/test/referrer_testserver.sjs?"; 18 const PARAMS = ["ATTRIBUTE_POLICY", "NEW_ATTRIBUTE_POLICY", "META_POLICY", "REL", , "SCHEME_FROM", "SCHEME_TO"]; 19 20 const testCases = [ 21 {ACTION: ["generate-anchor-policy-test", "generate-area-policy-test"], 22 TESTS: [ 23 // setting invalid refer values -> we expect either full referrer (default) 24 // or whatever is specified in the meta referrer policy 25 26 // Note that for those test cases which require cross-origin test, we use different 27 // scheme to result in cross-origin request. 28 {ATTRIBUTE_POLICY: 'origin-when-cross-origin', 29 NAME: 'origin-when-cross-origin-with-no-meta', 30 META_POLICY: '', 31 SCHEME_FROM: 'https', 32 SCHEME_TO: 'http', 33 DESC: "origin-when-cross-origin (anchor) with no meta", 34 RESULT: 'origin'}, 35 {ATTRIBUTE_POLICY: 'default', 36 NAME: 'default-with-no-meta', 37 META_POLICY: '', 38 DESC: "default (anchor) with no meta", 39 RESULT: 'full'}, 40 {ATTRIBUTE_POLICY: 'something', 41 NAME: 'something-with-no-meta', 42 META_POLICY: '', 43 DESC: "something (anchor) with no meta", 44 RESULT: 'full'}, 45 {ATTRIBUTE_POLICY: 'origin-when-cross-origin', 46 NAME: 'origin-when-cross-origin-with-no-referrer-in-meta', 47 META_POLICY: 'no-referrer', 48 SCHEME_FROM: 'https', 49 SCHEME_TO: 'http', 50 DESC: "origin-when-cross-origin (anchor) with no-referrer in meta", 51 RESULT: 'origin'}, 52 {ATTRIBUTE_POLICY: 'origin-when-cross-origin', 53 NAME: 'origin-when-cross-origin-with-unsafe-url-in-meta', 54 META_POLICY: 'unsafe-url', 55 SCHEME_FROM: 'https', 56 SCHEME_TO: 'http', 57 DESC: "origin-when-cross-origin (anchor) with unsafe-url in meta", 58 RESULT: 'origin'}, 59 {ATTRIBUTE_POLICY: 'origin-when-cross-origin', 60 NAME: 'origin-when-cross-origin-with-origin-in-meta', 61 META_POLICY: 'origin', 62 SCHEME_FROM: 'https', 63 SCHEME_TO: 'http', 64 DESC: "origin-when-cross-origin (anchor) with origin in meta", 65 RESULT: 'origin'}]} 66 ]; 67 </script> 68 <script type="application/javascript" src="/tests/dom/base/test/referrer_helper.js"></script> 69 </head> 70 <body onload="tests.next();"> 71 <iframe id="testframe"></iframe> 72 </body> 73 </html>