summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/resources/child-navigates-parent-cross-origin-inner.html
blob: 72b92c8061a995a27442fe071cb78d8af4a42261 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<!doctype html>
<script>
const params = new URL(window.location).searchParams;
const property = params.get("property");

try {
  if (property === null) {
    parent.location = "foo";
  } else if (property === "reload") {
    parent.location.reload();
  } else if (property === "replace") {
    parent.location.replace("foo");
  } else {
    parent.location[property] = "foo";
  }
  parent.parent.postMessage("success", "*");
} catch (e) {
  parent.parent.postMessage(`error: ${e.name}`, "*");
}
</script>