| <!DOCTYPE html> |
| <title>Navigate ancestor helper</title> |
| |
| <script src="/resources/testdriver.js"></script> |
| <script src="/resources/testdriver-actions.js"></script> |
| <script src="/resources/testdriver-vendor.js"></script> |
| <script src="utils.js"></script> |
| <body> |
| <script> |
| (async () => { |
| // This document is loaded into either a top-level fenced frame, a nested |
| // fenced frame, or an iframe in a top-level fenced frame. In any case, this |
| // document is always the inner-most document in any test. It navigates an |
| // ancestor frame by clicking the anchor above via script. When this document |
| // is loaded in a fenced frame, the frame that should actually navigate is |
| // this one, since fenced frames are top-level browsing contexts. |
| // When this document is loaded into a top-level fenced frame or a nested |
| // fenced frame, we test that the right frame is navigated in |
| // `navigate-ancestor-test-runner.https.html`. When this document is loaded |
| // into an iframe in a top-level fenced frame, we test that the navigation is |
| // blocked due to the sandbox behavior of fenced frame trees. |
| const [navigate_ancestor_key, ancestor_type] = parseKeylist(); |
| const url = generateURL(`navigate-ancestor-destination.https.html`, |
| [navigate_ancestor_key]); |
| await simulateGesture(); |
| try { |
| window[ancestor_type].location = url; |
| } catch (e) { |
| window[ancestor_type].postMessage('location change failed.'); |
| } |
| })(); |
| </script> |
| </body> |