summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/fenced-frame/resources/config-cross-origin-apis-inner.https.html
blob: 211fe216c7b37158198145dfd4ee6a3d32bb175b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<!DOCTYPE html>
<script src="utils.js"></script>
<script src="/common/get-host-info.sub.js"></script>
<title>Fenced frame attribution reporting self navigation test</title>

<body>
<script>
// This helper function will navigate a fenced frame to a remote origin page.
// It will then check to make sure that window.fence APIs are not allowed after
// the navigation.
const [key] = parseKeylist();

if (location.origin == get_host_info().ORIGIN) {
  const configs = window.fence.getNestedConfigs();
  const next_url = getRemoteOriginURL(generateURL(
      "config-cross-origin-apis-inner.https.html", [key]));
  location.href = next_url;
} else {
  const event = {
    eventType: "reserved.top_navigation_commit",
    eventData: "data!",
    destination: ["buyer"],
  }

  // These should gracefully fail without badmessaging the renderer.
  window.fence.setReportEventDataForAutomaticBeacons(event);
  window.fence.reportEvent(event);

  const configs = window.fence.getNestedConfigs();

  // Report how many configs were obtained. Cross-origin pages should not
  // obtain any nested configs.
  writeValueToServer(key, configs.length);
}

</script>
</body>