Bug 1637869 - P4. Access pref via staticpref. r=mattwoodrow,necko-reviewers
authorJean-Yves Avenard <jyavenard@mozilla.com>
Thu, 28 May 2020 04:07:15 +0000
changeset 596498 9da04f54abf93bd87f3017f91ef5d2bdb16757c3
parent 596497 723a7cddf523a40b2d1b93e836a1e044b4ffb896
child 596499 f3f319432899985db2d6ff2b34c37b8a460f072f
push id13186
push userffxbld-merge
push dateMon, 01 Jun 2020 09:52:46 +0000
treeherdermozilla-beta@3e7c70a1e4a1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmattwoodrow, necko-reviewers
bugs1637869
milestone78.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1637869 - P4. Access pref via staticpref. r=mattwoodrow,necko-reviewers It would otherwise triggers browser/base/content/test/performance/browser_preferences_usage.js That pref would have been checked with every single load, a staticpref is O-1 . Differential Revision: https://phabricator.services.mozilla.com/D76317
docshell/base/nsDocShell.cpp
modules/libpref/init/StaticPrefList.yaml
--- a/docshell/base/nsDocShell.cpp
+++ b/docshell/base/nsDocShell.cpp
@@ -8955,17 +8955,17 @@ bool nsDocShell::CanLoadInParentProcess(
   // Allow ext+foo URIs (extension-registered custom protocols). See
   // https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/protocol_handlers
   if (StringBeginsWith(scheme, NS_LITERAL_CSTRING("ext+")) &&
       !StaticPrefs::extensions_webextensions_remote()) {
     return true;
   }
   // Final exception for some legacy automated tests:
   if (xpc::IsInAutomation() &&
-      Preferences::GetBool("security.allow_unsafe_parent_loads", false)) {
+      StaticPrefs::security_allow_unsafe_parent_loads()) {
     return true;
   }
   return false;
 }
 
 nsIPrincipal* nsDocShell::GetInheritedPrincipal(
     bool aConsiderCurrentDocument, bool aConsiderStoragePrincipal) {
   RefPtr<Document> document;
--- a/modules/libpref/init/StaticPrefList.yaml
+++ b/modules/libpref/init/StaticPrefList.yaml
@@ -8403,16 +8403,23 @@
 
 # Allowed by default so it doesn't affect Thunderbird/SeaMonkey, but
 # not allowed for Firefox Desktop in firefox.js
 - name: security.allow_eval_in_parent_process
   type: RelaxedAtomicBool
   value: true
   mirror: always
 
+# Disallowed by default, ensure not disallowed content is loaded in the parent
+# process.
+- name: security.allow_unsafe_parent_loads
+  type: bool
+  value: false
+  mirror: always
+
 # Pref to block mixed scripts (fonts, plugin content, scripts, stylesheets,
 # iframes, websockets, XHR).
 - name: security.mixed_content.block_active_content
   type: bool
   value: @IS_ANDROID@
   mirror: always
 
 # Pref to block sub requests that happen within an object.