summaryrefslogtreecommitdiffstats
path: root/uriloader/exthandler/tests/mochitest/browser_protocol_custom_sandbox_csp.js
blob: 03d2fe8cf5c0d98a9703cffc0c20c5f54ec02acc (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
38
/* Any copyright is dedicated to the Public Domain.
   http://creativecommons.org/publicdomain/zero/1.0/ */

/**
 * Tests navigation to external protocol from csp-sandboxed iframes.
 */

"use strict";

add_setup(async function () {
  await SpecialPowers.pushPrefEnv({
    set: [["dom.block_external_protocol_navigation_from_sandbox", true]],
  });

  await setupMailHandler();
});

add_task(async function test_sandbox_csp() {
  for (let triggerMethod of [
    "trustedClick",
    "untrustedClick",
    "trustedLocationAPI",
    "untrustedLocationAPI",
  ]) {
    await runExtProtocolSandboxTest({
      blocked: false,
      sandbox: "allow-scripts",
      useCSPSandbox: true,
      triggerMethod,
    });
  }

  await runExtProtocolSandboxTest({
    blocked: false,
    sandbox: "allow-scripts allow-top-navigation-to-custom-protocols",
    useCSPSandbox: true,
  });
});