Bug 1548253 - Port pref cache variables of nsContentUtils to StaticPrefs - dom_presentation_testing_simulate_receiver, r=Ehsan
authorAndrea Marchesini <amarchesini@mozilla.com>
Wed, 01 May 2019 21:48:55 +0000
changeset 531005 1be432c72aeb947461ee329adf762aa7b881ca45
parent 531004 4c06fb6c9e317ecd6770719a0177ef6fe5099ce8
child 531006 d0c37d548ba8a450b84d38b3b237a66c03f7f66b
push id11265
push userffxbld-merge
push dateMon, 13 May 2019 10:53:39 +0000
treeherdermozilla-beta@77e0fe8dbdd3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersEhsan
bugs1548253
milestone68.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 1548253 - Port pref cache variables of nsContentUtils to StaticPrefs - dom_presentation_testing_simulate_receiver, r=Ehsan Differential Revision: https://phabricator.services.mozilla.com/D29526
dom/base/nsContentUtils.cpp
dom/presentation/Presentation.cpp
modules/libpref/init/StaticPrefList.h
--- a/dom/base/nsContentUtils.cpp
+++ b/dom/base/nsContentUtils.cpp
@@ -9151,17 +9151,17 @@ void nsContentUtils::SetScrollbarsVisibi
 }
 
 /* static */
 void nsContentUtils::GetPresentationURL(nsIDocShell* aDocShell,
                                         nsAString& aPresentationUrl) {
   MOZ_ASSERT(aDocShell);
 
   // Simulate receiver context for web platform test
-  if (Preferences::GetBool("dom.presentation.testing.simulate-receiver")) {
+  if (StaticPrefs::dom_presentation_testing_simulate_receiver()) {
     RefPtr<Document> doc;
 
     nsCOMPtr<nsPIDOMWindowOuter> docShellWin =
         do_QueryInterface(aDocShell->GetScriptGlobalObject());
     if (docShellWin) {
       doc = docShellWin->GetExtantDoc();
     }
 
--- a/dom/presentation/Presentation.cpp
+++ b/dom/presentation/Presentation.cpp
@@ -119,17 +119,17 @@ bool Presentation::HasReceiverSupport() 
 
   // Grant access to browser receiving pages and their same-origin iframes. (App
   // pages should be controlled by "presentation" permission in app manifests.)
   nsCOMPtr<nsIDocShell> docShell = mWindow->GetDocShell();
   if (!docShell) {
     return false;
   }
 
-  if (!Preferences::GetBool("dom.presentation.testing.simulate-receiver") &&
+  if (!StaticPrefs::dom_presentation_testing_simulate_receiver() &&
       !docShell->GetIsInMozBrowser() &&
       !docShell->GetIsTopLevelContentDocShell()) {
     return false;
   }
 
   nsAutoString presentationURL;
   nsContentUtils::GetPresentationURL(docShell, presentationURL);
 
--- a/modules/libpref/init/StaticPrefList.h
+++ b/modules/libpref/init/StaticPrefList.h
@@ -703,16 +703,22 @@ VARCACHE_PREF(
 
 // Whether we should show the placeholder when the element is focused but empty.
 VARCACHE_PREF(
   "dom.placeholder.show_on_focus",
    dom_placeholder_show_on_focus,
   bool, true
 )
 
+VARCACHE_PREF(
+  "dom.presentation.testing.simulate-receiver",
+   dom_presentation_testing_simulate_receiver,
+  bool, false
+)
+
 //---------------------------------------------------------------------------
 // Extension prefs
 //---------------------------------------------------------------------------
 
 #ifdef ANDROID
 // Private browsing opt-in is only supported on Firefox desktop.
 # define PREF_VALUE true
 #else