referrer-unsafe-url.sub.html (3511B)
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <title>Referrer with the unsafe-url policy</title> 5 <meta name="referrer" content="unsafe-url"> 6 <script src="/resources/testharness.js"></script> 7 <script src="/resources/testharnessreport.js"></script> 8 </head> 9 <body> 10 <script type="module"> 11 12 // "name" parameter is necessary for bypassing the module map. 13 14 import { referrer as referrerSame } from "./resources/referrer-checker.py?name=same"; 15 16 import { referrer as referrerRemote } from "http://{{domains[www1]}}:{{ports[http][0]}}/html/semantics/scripting-1/the-script-element/module/resources/referrer-checker.py?name=remote"; 17 18 import { referrer as referrerSameSame } from "./resources/import-referrer-checker.sub.js?name=same_same"; 19 20 import { referrer as referrerSameRemote } from "./resources/import-remote-origin-referrer-checker.sub.js?name=same_remote"; 21 22 import { referrer as referrerRemoteRemote } from "http://{{domains[www1]}}:{{ports[http][0]}}/html/semantics/scripting-1/the-script-element/module/resources/import-referrer-checker.sub.js?name=remote_remote"; 23 24 import { referrer as referrerRemoteSame } from "http://{{domains[www1]}}:{{ports[http][0]}}/html/semantics/scripting-1/the-script-element/module/resources/import-same-origin-referrer-checker-from-remote-origin.sub.js?name=remote_same"; 25 26 test(t => { 27 assert_equals( 28 referrerSame, location.href, 29 "Referrer should be sent for the same-origin top-level script."); 30 }, "Importing a same-origin top-level script with the unsafe-url policy."); 31 32 test(t => { 33 assert_equals( 34 referrerRemote, location.href, 35 "Referrer should be sent for the remote-origin top-level script."); 36 }, "Importing a remote-origin top-level script with the unsafe-url policy."); 37 38 test(t => { 39 const scriptURL = 40 new URL("resources/import-referrer-checker.sub.js", location.href) 41 assert_equals( 42 referrerSameSame, scriptURL + "?name=same_same", 43 "Referrer should be sent for the same-origin descendant script."); 44 }, "Importing a same-origin descendant script from a same-origin top-level " + 45 "script with the unsafe-url policy."); 46 47 test(t => { 48 const scriptURL = 49 new URL("resources/import-remote-origin-referrer-checker.sub.js", 50 location.href) 51 assert_equals( 52 referrerSameRemote, scriptURL + "?name=same_remote", 53 "Referrer should be sent for the remote-origin descendant script."); 54 }, "Importing a remote-origin descendant script from a same-origin top-level " + 55 "script with the unsafe-url policy."); 56 57 test(t => { 58 const scriptURL = 59 "http://{{domains[www1]}}:{{ports[http][0]}}/html/semantics/" + 60 "scripting-1/the-script-element/module/resources/" + 61 "import-referrer-checker.sub.js"; 62 assert_equals( 63 referrerRemoteRemote, scriptURL + "?name=remote_remote", 64 "Referrer should be sent for the remote-origin descendant script."); 65 }, "Importing a remote-origin descendant script from a remote-origin " + 66 "top-level script with the unsafe-url policy."); 67 68 test(t => { 69 const scriptURL = 70 "http://{{domains[www1]}}:{{ports[http][0]}}/html/semantics/" + 71 "scripting-1/the-script-element/module/resources/" + 72 "import-same-origin-referrer-checker-from-remote-origin.sub.js"; 73 assert_equals( 74 referrerRemoteSame, scriptURL + "?name=remote_same", 75 "Referrer should be sent for the same-origin descendant script."); 76 }, "Importing a same-origin descendant script from a remote-origin " + 77 "top-level script with the unsafe-url policy."); 78 79 </script> 80 </body> 81 </html>