Bug 995943 - Clean up some silly stuff surrounding prefs in CAPS. r=bz
authorBobby Holley <bobbyholley@gmail.com>
Mon, 12 May 2014 15:31:01 -0700
changeset 192253 c1b7c8d03129
parent 192252 913fb15c7218
child 192254 5b3bfd0a529a
push id3546
push userbobbyholley@gmail.com
push date2014-05-12 22:31 +0000
Treeherderresults
reviewersbz
bugs995943
milestone30.0
Bug 995943 - Clean up some silly stuff surrounding prefs in CAPS. r=bz
caps/src/nsScriptSecurityManager.cpp
--- a/caps/src/nsScriptSecurityManager.cpp
+++ b/caps/src/nsScriptSecurityManager.cpp
@@ -1271,28 +1271,18 @@ static const char* kObservedPrefs[] = {
   nullptr
 };
 
 
 NS_IMETHODIMP
 nsScriptSecurityManager::Observe(nsISupports* aObject, const char* aTopic,
                                  const char16_t* aMessage)
 {
-    nsresult rv = NS_OK;
-    NS_ConvertUTF16toUTF8 messageStr(aMessage);
-    const char *message = messageStr.get();
-
-    static const char jsPrefix[] = "javascript.";
-    static const char securityPrefix[] = "security.";
-    if ((PL_strncmp(message, jsPrefix, sizeof(jsPrefix)-1) == 0) ||
-        (PL_strncmp(message, securityPrefix, sizeof(securityPrefix)-1) == 0) )
-    {
-        ScriptSecurityPrefChanged();
-    }
-    return rv;
+    ScriptSecurityPrefChanged();
+    return NS_OK;
 }
 
 /////////////////////////////////////////////
 // Constructor, Destructor, Initialization //
 /////////////////////////////////////////////
 nsScriptSecurityManager::nsScriptSecurityManager(void)
     : mPrefInitialized(false)
     , mIsJavaScriptEnabled(false)
@@ -1401,31 +1391,19 @@ nsScriptSecurityManager::SystemPrincipal
     if (gScriptSecMan)
         NS_ADDREF(sysprin = gScriptSecMan->mSystemPrincipal);
     return static_cast<nsSystemPrincipal*>(sysprin);
 }
 
 inline void
 nsScriptSecurityManager::ScriptSecurityPrefChanged()
 {
-    // JavaScript defaults to enabled in failure cases.
-    mIsJavaScriptEnabled = true;
-
-    sStrictFileOriginPolicy = true;
-
-    nsresult rv;
-    if (!mPrefInitialized) {
-        rv = InitPrefs();
-        if (NS_FAILED(rv))
-            return;
-    }
-
+    MOZ_ASSERT(mPrefInitialized);
     mIsJavaScriptEnabled =
         Preferences::GetBool(sJSEnabledPrefName, mIsJavaScriptEnabled);
-
     sStrictFileOriginPolicy =
         Preferences::GetBool(sFileOriginPolicyPrefName, false);
 }
 
 nsresult
 nsScriptSecurityManager::InitPrefs()
 {
     nsIPrefBranch* branch = Preferences::GetRootBranch();