From 6b9a1c976d05cb7686d50afc71c89fac6844048d Mon Sep 17 00:00:00 2001 From: Paul Zuehlcke Date: Mon, 30 Nov 2020 12:26:03 +0000 Subject: [PATCH] Bug 1654546 - Test that we show the protection UI for top level sandboxed pages. r=timhuang Differential Revision: https://phabricator.services.mozilla.com/D98055 --- browser/base/content/test/protectionsUI/browser.ini | 3 +++ .../browser_protectionsUI_shield_visibility.js | 8 +++++++- .../base/content/test/protectionsUI/sandboxed.html | 12 ++++++++++++ .../test/protectionsUI/sandboxed.html^headers^ | 1 + 4 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 browser/base/content/test/protectionsUI/sandboxed.html create mode 100644 browser/base/content/test/protectionsUI/sandboxed.html^headers^ diff --git a/browser/base/content/test/protectionsUI/browser.ini b/browser/base/content/test/protectionsUI/browser.ini index 3cb75be414be..fb863d440a44 100644 --- a/browser/base/content/test/protectionsUI/browser.ini +++ b/browser/base/content/test/protectionsUI/browser.ini @@ -32,6 +32,9 @@ support-files = skip-if = debug || asan # Bug 1546797 [browser_protectionsUI_socialtracking.js] [browser_protectionsUI_shield_visibility.js] +support-files = + sandboxed.html + sandboxed.html^headers^ [browser_protectionsUI_state.js] [browser_protectionsUI_state_reset.js] [browser_protectionsUI_telemetry.js] diff --git a/browser/base/content/test/protectionsUI/browser_protectionsUI_shield_visibility.js b/browser/base/content/test/protectionsUI/browser_protectionsUI_shield_visibility.js index 92ab5cfdbc16..be3cc46118c6 100644 --- a/browser/base/content/test/protectionsUI/browser_protectionsUI_shield_visibility.js +++ b/browser/base/content/test/protectionsUI/browser_protectionsUI_shield_visibility.js @@ -66,6 +66,12 @@ const TEST_CASES = [ testURL: "view-source:https://example.com/", hidden: true, }, + { + type: "top level sandbox", + testURL: + "https://example.com/browser/browser/base/content/test/protectionsUI/sandboxed.html", + hidden: false, + }, ]; add_task(async function setup() { @@ -97,7 +103,7 @@ add_task(async function setup() { if (testData.type === "certificateError") { pageLoaded = BrowserTestUtils.waitForErrorPage(browser); } else { - pageLoaded = BrowserTestUtils.browserLoaded(browser); + pageLoaded = BrowserTestUtils.browserLoaded(browser, true); } }, false diff --git a/browser/base/content/test/protectionsUI/sandboxed.html b/browser/base/content/test/protectionsUI/sandboxed.html new file mode 100644 index 000000000000..661fb0b8e236 --- /dev/null +++ b/browser/base/content/test/protectionsUI/sandboxed.html @@ -0,0 +1,12 @@ + + + + + + + + + + diff --git a/browser/base/content/test/protectionsUI/sandboxed.html^headers^ b/browser/base/content/test/protectionsUI/sandboxed.html^headers^ new file mode 100644 index 000000000000..4705ce9dedee --- /dev/null +++ b/browser/base/content/test/protectionsUI/sandboxed.html^headers^ @@ -0,0 +1 @@ +Content-Security-Policy: sandbox allow-scripts;