File: stateless-client-bounce.sub.https.html

package info (click to toggle)
firefox 143.0.3-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 4,617,328 kB
  • sloc: cpp: 7,478,492; javascript: 6,417,157; ansic: 3,720,058; python: 1,396,372; xml: 627,523; asm: 438,677; java: 186,156; sh: 63,477; makefile: 19,171; objc: 13,059; perl: 12,983; yacc: 4,583; cs: 3,846; pascal: 3,405; lex: 1,720; ruby: 1,003; exp: 762; php: 436; lisp: 258; awk: 247; sql: 66; sed: 53; csh: 10
file content (51 lines) | stat: -rw-r--r-- 1,873 bytes parent folder | download | duplicates (12)
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<!DOCTYPE HTML>
<meta charset=utf-8>
<title>Bounce Tracking Mitigations: Stateless Client Bounce</title>
<body>body for test_driver.bless</body>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script src=/resources/testdriver.js></script>
<script src=/resources/testdriver-vendor.js></script>
<script>
  promise_setup(async () => {
    try {
      await test_driver.set_storage_access('*', '*', 'blocked');
    } catch (e) {
      // Ignore, can be unimplemented if the platform blocks cross-site
      // cookies by default. If this failed without default blocking the test
      // will fail.
    }
  });

  promise_test(async t => {
    let linkInNewPage = null;

    // Open a new tab and retrieve the link to start the test.
    await test_driver.bless('open page to start test', async () => {
      const otherTab = window.open(
        'resources/redirect-chain-start-stateless.sub.https.html');

      await new Promise(resolve => otherTab.addEventListener('load', resolve));
      linkInNewPage = otherTab.document.getElementById('navigate-link');
    });

    const redirectEndedPromise = new Promise(resolve => {
      window.addEventListener('message', resolve, {once: true});
    });

    // Click the link in the new tab.
    //
    // Ideally, we would click this from within the page, but because the page
    // immediately navigates away, test_driver fails as it expects the page to
    // not navigate away. Doing this from the main test page avoids the issue.
    test_driver.click(linkInNewPage);

    await redirectEndedPromise;

    let result = [];
    while (result.length == 0) {
      result = await test_driver.run_bounce_tracking_mitigations();
    }
    assert_array_equals(result, ['{{hosts[alt][]}}']);
  }, 'Bounce tracking mitigations catching a stateless bounce tracker');
</script>