Bug 1958801: Add CSP to geckoview.xhtml r=geckoview-reviewers,nalexander

Differential Revision: https://phabricator.services.mozilla.com/D245441
This commit is contained in:
Simon Friedberger
2025-04-16 08:17:09 +00:00
parent aa292906d8
commit 078d0745ed
3 changed files with 5 additions and 9 deletions

View File

@@ -1969,7 +1969,6 @@ void nsContentSecurityUtils::AssertChromePageHasCSP(Document* aDocument) {
} }
static nsLiteralCString sAllowedChromePagesWithNoCSP[] = { static nsLiteralCString sAllowedChromePagesWithNoCSP[] = {
"chrome://geckoview/content/geckoview.xhtml"_ns,
// Test files // Test files
"chrome://mochikit/"_ns, "chrome://mochikit/"_ns,
"chrome://mochitests/"_ns, "chrome://mochitests/"_ns,

View File

@@ -541,10 +541,7 @@ function createBrowser() {
// This is only needed for mochitests, so that they honor the // This is only needed for mochitests, so that they honor the
// prefers-color-scheme.content-override pref. GeckoView doesn't set this // prefers-color-scheme.content-override pref. GeckoView doesn't set this
// pref to anything other than the default value otherwise. // pref to anything other than the default value otherwise.
browser.setAttribute( browser.style.colorScheme = "env(-moz-content-preferred-color-scheme)";
"style",
"color-scheme: env(-moz-content-preferred-color-scheme)"
);
return browser; return browser;
} }
@@ -954,3 +951,5 @@ function startup() {
InitializationTracker.onInitialized(performance.now()); InitializationTracker.onInitialized(performance.now());
} }
window.addEventListener("DOMContentLoaded", startup, { once: true });

View File

@@ -3,6 +3,8 @@
- License, v. 2.0. If a copy of the MPL was not distributed with this - License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. --> - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<?csp default-src chrome: resource:; ?>
<window <window
id="main-window" id="main-window"
windowtype="navigator:geckoview" windowtype="navigator:geckoview"
@@ -12,8 +14,4 @@
type="application/javascript" type="application/javascript"
src="chrome://geckoview/content/geckoview.js" src="chrome://geckoview/content/geckoview.js"
/> />
<script>
/* import-globals-from geckoview.js */
window.addEventListener("DOMContentLoaded", startup, { once: true });
</script>
</window> </window>