Bug 333808 - safe mode should disable userContent.css and userChrome.css. r=bsmedberg, sr=bz
authorNochum Sossonko <highmind63@gmail.com>
Mon, 22 Jun 2009 13:34:41 +0200
changeset 29432 4485b488ce96852380fde469c6d8bcec803a8279
parent 29431 592d1c8c864831511cbe8627eb593c91b2e9bec0
child 29433 d659c7e3e5d495b1aa50d0a649fb9ab804b96e92
push id7620
push userdgottwald@mozilla.com
push dateMon, 22 Jun 2009 11:39:09 +0000
treeherdermozilla-central@d659c7e3e5d4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbsmedberg, bz
bugs333808
milestone1.9.2a1pre
Bug 333808 - safe mode should disable userContent.css and userChrome.css. r=bsmedberg, sr=bz
layout/style/nsLayoutStylesheetCache.cpp
--- a/layout/style/nsLayoutStylesheetCache.cpp
+++ b/layout/style/nsLayoutStylesheetCache.cpp
@@ -39,16 +39,17 @@
 
 #include "nsAppDirectoryServiceDefs.h"
 #include "nsICSSLoader.h"
 #include "nsIFile.h"
 #include "nsLayoutCID.h"
 #include "nsNetUtil.h"
 #include "nsIObserverService.h"
 #include "nsServiceManagerUtils.h"
+#include "nsIXULRuntime.h"
 
 NS_IMPL_ISUPPORTS1(nsLayoutStylesheetCache, nsIObserver)
 
 nsresult
 nsLayoutStylesheetCache::Observe(nsISupports* aSubject,
                             const char* aTopic,
                             const PRUnichar* aData)
 {
@@ -206,16 +207,23 @@ nsLayoutStylesheetCache::EnsureGlobal()
   if (!gStyleCache) return;
 
   NS_ADDREF(gStyleCache);
 }
 
 void
 nsLayoutStylesheetCache::InitFromProfile()
 {
+  nsCOMPtr<nsIXULRuntime> appInfo = do_GetService("@mozilla.org/xre/app-info;1");
+  if (appInfo) {
+    PRBool inSafeMode = PR_FALSE;
+    appInfo->GetInSafeMode(&inSafeMode);
+    if (inSafeMode)
+      return;
+  }
   nsCOMPtr<nsIFile> contentFile;
   nsCOMPtr<nsIFile> chromeFile;
 
   NS_GetSpecialDirectory(NS_APP_USER_CHROME_DIR,
                          getter_AddRefs(contentFile));
   if (!contentFile) {
     // if we don't have a profile yet, that's OK!
     return;