Bug 1132743 followup: hook up nsPrincipal.cpp's "gCodeBasePrincipalSupport" in new InitializeStatics method, instead of lazily. implicit rs=dbaron
☠☠ backed out by 2d2f995703ac ☠ ☠
authorDaniel Holbert <dholbert@cs.stanford.edu>
Fri, 13 Mar 2015 13:16:01 -0700
changeset 233633 4e00f10f5a2d37316a1083ff8854ab6d70de1664
parent 233632 720842726906d72ddcdeb7d06ceaea2fc28a3036
child 233634 5d9d3e38eb1676f758a373eab42415e39831eae3
push id56897
push userdholbert@mozilla.com
push dateFri, 13 Mar 2015 20:16:43 +0000
treeherdermozilla-inbound@4e00f10f5a2d [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
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)