| <!doctype html> |
| <meta name="timeout" content="long"> |
| <title>Cross-Origin header and nested navigable resource without such header</title> |
| <script src=/resources/testharness.js></script> |
| <script src=/resources/testharnessreport.js></script> |
| <div id=log></div> |
| <script> |
| async_test(t => { |
| const frame = document.createElement("iframe"); |
| t.step_timeout(() => { |
| // Make sure the iframe didn't load. |
| assert_equals(frame.contentDocument, null); |
| t.done(); |
| }, 500); |
| frame.src = "/common/blank.html"; |
| document.body.append(frame); |
| assert_equals(frame.contentDocument.body.localName, "body"); |
| }, "Top-level with use-credentials policy: navigating a frame to a null policy should fail."); |
| |
| async_test(t => { |
| const frame = document.createElement("iframe"); |
| let firstNavOk = false; |
| frame.onload = t.step_func(() => { |
| assert_not_equals(frame.contentDocument, null); |
| firstNavOk = true; |
| }); |
| t.step_timeout(() => { |
| assert_equals(firstNavOk, true, "The initial load should work"); |
| assert_equals(frame.contentDocument, null, "Navigation to null policy should fail"); |
| t.done(); |
| }, 500); |
| frame.src = "resources/navigate_usecredentials.sub.html?to=/common/blank.html"; |
| document.body.append(frame); |
| assert_equals(frame.contentDocument.body.localName, "body"); |
| }, "Top-level with use-credentials policy: navigating a frame from a use-credentials policy to a null policy should fail"); |
| |
| async_test(t => { |
| const frame = document.createElement("iframe"); |
| let firstNavOk = false; |
| frame.onload = t.step_func(() => { |
| assert_not_equals(frame.contentDocument, null); |
| firstNavOk = true; |
| }); |
| t.step_timeout(() => { |
| assert_equals(firstNavOk, true, "The initial load should work"); |
| assert_equals(frame.contentDocument, null, "Navigation to null policy should fail"); |
| t.done(); |
| }, 500); |
| frame.src = "resources/navigate_anonymous.sub.html?to=/common/blank.html"; |
| document.body.append(frame); |
| assert_equals(frame.contentDocument.body.localName, "body"); |
| }, "Top-level with use-credentials policy: navigating a frame from an anonymous policy to a null policy should fail."); |
| |
| </script> |