Bug 1132743 followup: hook up nsPrincipal.cpp's "gCodeBasePrincipalSupport" in new InitializeStatics method, instead of lazily. implicit rs=dbaron CLOSED TREE
authorDaniel Holbert <dholbert@cs.stanford.edu>
Fri, 13 Mar 2015 13:16:01 -0700
changeset 233642 14b7ae148c8ffb7340c3afdccdf5883a2e5c11a3
parent 233641 3c7cdd74587751b5bf78c982cebb5826794c5163
child 233643 bdc8ba757c5917c7162b6d5a1dd25d4960526b64
push id28421
push userphilringnalda@gmail.com
push dateMon, 16 Mar 2015 02:16:05 +0000
treeherdermozilla-central@e19b8b7c8343 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdbaron
bugs1132743
milestone39.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 1132743 followup: hook up nsPrincipal.cpp's "gCodeBasePrincipalSupport" in new InitializeStatics method, instead of lazily. implicit rs=dbaron CLOSED TREE
caps/nsPrincipal.cpp
--- a/caps/nsPrincipal.cpp
+++ b/caps/nsPrincipal.cpp
@@ -29,19 +29,17 @@
 #include "mozilla/HashFunctions.h"
 
 #include "nsIAppsService.h"
 #include "mozIApplication.h"
 
 using namespace mozilla;
 
 static bool gIsWhitelistingTestDomains = false;
-// XXXdholbert Add to InitializeStatics():
 static bool gCodeBasePrincipalSupport = false;
-static bool gIsObservingCodeBasePrincipalSupport = false;
 
 static bool URIIsImmutable(nsIURI* aURI)
 {
   nsCOMPtr<nsIMutable> mutableObj(do_QueryInterface(aURI));
   bool isMutable;
   return
     mutableObj &&
     NS_SUCCEEDED(mutableObj->GetMutable(&isMutable)) &&
@@ -71,25 +69,16 @@ nsBasePrincipal::Release()
     delete this;
   }
 
   return count;
 }
 
 nsBasePrincipal::nsBasePrincipal()
 {
-  if (!gIsObservingCodeBasePrincipalSupport) {
-    nsresult rv =
-      Preferences::AddBoolVarCache(&gCodeBasePrincipalSupport,
-                                   "signed.applets.codebase_principal_support",
-                                   false);
-    gIsObservingCodeBasePrincipalSupport = NS_SUCCEEDED(rv);
-    NS_WARN_IF_FALSE(gIsObservingCodeBasePrincipalSupport,
-                     "Installing gCodeBasePrincipalSupport failed!");
-  }
 }
 
 nsBasePrincipal::~nsBasePrincipal(void)
 {
 }
 
 NS_IMETHODIMP
 nsBasePrincipal::GetCsp(nsIContentSecurityPolicy** aCsp)
@@ -132,16 +121,20 @@ NS_IMPL_RELEASE_INHERITED(nsPrincipal, n
 
 // Called at startup:
 /* static */ void
 nsPrincipal::InitializeStatics()
 {
   Preferences::AddBoolVarCache(
     &gIsWhitelistingTestDomains,
     "layout.css.unprefixing-service.include-test-domains");
+
+  Preferences::AddBoolVarCache(&gCodeBasePrincipalSupport,
+                               "signed.applets.codebase_principal_support",
+                               false);
 }
 
 nsPrincipal::nsPrincipal()
   : mAppId(nsIScriptSecurityManager::UNKNOWN_APP_ID)
   , mInMozBrowser(false)
   , mCodebaseImmutable(false)
   , mDomainImmutable(false)
   , mInitialized(false)