Bug 659533 Replace nsContentUtils::GetBoolPref() with Preferences::GetBool() r=roc
authorMasayuki Nakano <masayuki@d-toybox.com>
Wed, 25 May 2011 15:31:59 +0900
changeset 70130 4c6fdf1c030df1f77540ff0d48e45dcb084b52ae
parent 70129 111ca3e50989bd8efa79ed954fad4e90d2d2b872
child 70131 1b9d9bb14005cc4d1b1572f24bc33f0a55dd5746
push idunknown
push userunknown
push dateunknown
reviewersroc
bugs659533
milestone7.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 659533 Replace nsContentUtils::GetBoolPref() with Preferences::GetBool() r=roc
content/base/public/nsContentUtils.h
content/base/src/nsContentUtils.cpp
content/base/src/nsDocument.cpp
content/base/src/nsEventSource.cpp
content/base/src/nsFrameLoader.cpp
content/base/src/nsPlainTextSerializer.cpp
content/base/src/nsWebSocket.cpp
content/events/src/nsDOMTouchEvent.cpp
content/events/src/nsEventStateManager.cpp
content/html/content/src/nsGenericHTMLElement.cpp
content/html/content/src/nsHTMLDNSPrefetch.cpp
content/html/content/src/nsHTMLImageElement.cpp
content/html/content/src/nsHTMLMediaElement.cpp
content/html/document/src/nsImageDocument.cpp
content/svg/content/src/nsSVGImageElement.cpp
content/xml/document/src/nsXMLPrettyPrinter.cpp
content/xul/content/src/nsXULPopupListener.cpp
content/xul/document/src/nsXULPrototypeCache.cpp
dom/base/nsDOMClassInfo.cpp
dom/base/nsFocusManager.cpp
dom/base/nsGlobalWindow.cpp
dom/base/nsGlobalWindow.h
dom/base/nsGlobalWindowCommands.cpp
dom/base/nsHistory.cpp
dom/base/nsJSEnvironment.cpp
dom/indexedDB/CheckPermissionsHelper.cpp
dom/src/geolocation/nsGeolocation.cpp
dom/src/notification/nsDesktopNotification.cpp
dom/src/storage/nsDOMStorage.cpp
layout/base/nsCaret.cpp
layout/base/nsPresContext.cpp
layout/base/nsPresShell.cpp
layout/forms/nsComboboxControlFrame.cpp
layout/generic/nsFrame.cpp
layout/generic/nsFrameSetFrame.cpp
layout/generic/nsHTMLReflowState.cpp
layout/generic/nsImageFrame.cpp
layout/generic/nsSelection.cpp
layout/printing/nsPrintEngine.cpp
layout/style/nsCSSRuleProcessor.cpp
layout/style/nsCSSScanner.cpp
layout/svg/base/src/nsSVGUtils.cpp
layout/xul/base/src/nsBoxFrame.cpp
layout/xul/base/src/nsMenuBarListener.cpp
layout/xul/base/src/nsMenuPopupFrame.cpp
layout/xul/base/src/nsSliderFrame.cpp
layout/xul/base/src/nsXULTooltipListener.cpp
--- a/content/base/public/nsContentUtils.h
+++ b/content/base/public/nsContentUtils.h
@@ -546,18 +546,16 @@ public:
                                        const nsAString& aQualifiedName,
                                        nsNodeInfoManager* aNodeInfoManager,
                                        nsINodeInfo** aNodeInfo);
 
   static void SplitExpatName(const PRUnichar *aExpatName, nsIAtom **aPrefix,
                              nsIAtom **aTagName, PRInt32 *aNameSpaceID);
 
   static nsAdoptingCString GetCharPref(const char *aPref);
-  static PRPackedBool GetBoolPref(const char *aPref,
-                                  PRBool aDefault = PR_FALSE);
   static PRInt32 GetIntPref(const char *aPref, PRInt32 aDefault = 0);
   static nsAdoptingString GetLocalizedStringPref(const char *aPref);
   static nsAdoptingString GetStringPref(const char *aPref);
   static void RegisterPrefCallback(const char *aPref,
                                    PrefChangedFunc aCallback,
                                    void * aClosure);
   static void UnregisterPrefCallback(const char *aPref,
                                      PrefChangedFunc aCallback,
--- a/content/base/src/nsContentUtils.cpp
+++ b/content/base/src/nsContentUtils.cpp
@@ -206,18 +206,21 @@ static NS_DEFINE_CID(kXTFServiceCID, NS_
 #include "nsChannelPolicy.h"
 #include "nsIContentSecurityPolicy.h"
 #include "nsContentDLF.h"
 #ifdef MOZ_MEDIA
 #include "nsHTMLMediaElement.h"
 #endif
 #include "nsDOMTouchEvent.h"
 
+#include "mozilla/Preferences.h"
+
 using namespace mozilla::dom;
 using namespace mozilla::layers;
+using namespace mozilla;
 
 const char kLoadAsData[] = "loadAsData";
 
 static const char kJSStackContractID[] = "@mozilla.org/js/xpc/ContextStack;1";
 static NS_DEFINE_CID(kParserServiceCID, NS_PARSERSERVICE_CID);
 static NS_DEFINE_CID(kCParserCID, NS_PARSER_CID);
 
 nsIDOMScriptObjectFactory *nsContentUtils::sDOMScriptObjectFactory = nsnull;
@@ -2604,30 +2607,16 @@ nsContentUtils::GetCharPref(const char *
   if (sPrefBranch) {
     sPrefBranch->GetCharPref(aPref, getter_Copies(result));
   }
 
   return result;
 }
 
 // static
-PRPackedBool
-nsContentUtils::GetBoolPref(const char *aPref, PRBool aDefault)
-{
-  PRBool result;
-
-  if (!sPrefBranch ||
-      NS_FAILED(sPrefBranch->GetBoolPref(aPref, &result))) {
-    result = aDefault;
-  }
-
-  return (PRPackedBool)result;
-}
-
-// static
 PRInt32
 nsContentUtils::GetIntPref(const char *aPref, PRInt32 aDefault)
 {
   PRInt32 result;
 
   if (!sPrefBranch ||
       NS_FAILED(sPrefBranch->GetIntPref(aPref, &result))) {
     result = aDefault;
@@ -2729,27 +2718,27 @@ nsContentUtils::UnregisterPrefCallback(c
   }
 }
 
 static int
 BoolVarChanged(const char *aPref, void *aClosure)
 {
   PrefCacheData* cache = static_cast<PrefCacheData*>(aClosure);
   *((PRBool*)cache->cacheLocation) =
-    nsContentUtils::GetBoolPref(aPref, cache->defaultValueBool);
-  
+    Preferences::GetBool(aPref, cache->defaultValueBool);
+
   return 0;
 }
 
 void
 nsContentUtils::AddBoolPrefVarCache(const char *aPref,
                                     PRBool* aCache,
                                     PRBool aDefault)
 {
-  *aCache = GetBoolPref(aPref, aDefault);
+  *aCache = Preferences::GetBool(aPref, aDefault);
   PrefCacheData* data = new PrefCacheData;
   data->cacheLocation = aCache;
   data->defaultValueBool = aDefault;
   sPrefCacheData->AppendElement(data);
   RegisterPrefCallback(aPref, BoolVarChanged, data);
 }
 
 static int
--- a/content/base/src/nsDocument.cpp
+++ b/content/base/src/nsDocument.cpp
@@ -198,16 +198,19 @@ static NS_DEFINE_CID(kDOMEventGroupCID, 
 #include "nsHTMLStyleSheet.h"
 #include "nsHTMLCSSStyleSheet.h"
 
 #include "mozilla/dom/Link.h"
 #include "nsIHTMLDocument.h"
 #include "nsXULAppAPI.h"
 #include "nsDOMTouchEvent.h"
 
+#include "mozilla/Preferences.h"
+
+using namespace mozilla;
 using namespace mozilla::dom;
 
 typedef nsTArray<Link*> LinkArray;
 
 
 #ifdef PR_LOGGING
 static PRLogModuleInfo* gDocumentLeakPRLog;
 static PRLogModuleInfo* gCspPRLog;
@@ -8256,17 +8259,17 @@ PLDHashOperator UnlockEnumerator(imgIReq
   return PL_DHASH_NEXT;
 }
 
 
 nsresult
 nsDocument::SetImageLockingState(PRBool aLocked)
 {
   if (XRE_GetProcessType() == GeckoProcessType_Content &&
-      !nsContentUtils::GetBoolPref("content.image.allow_locking", PR_TRUE)) {
+      !Preferences::GetBool("content.image.allow_locking", PR_TRUE)) {
     return NS_OK;
   }
 
   // If there's no change, there's nothing to do.
   if (mLockingImages == aLocked)
     return NS_OK;
 
   // Otherwise, iterate over our images and perform the appropriate action.
--- a/content/base/src/nsEventSource.cpp
+++ b/content/base/src/nsEventSource.cpp
@@ -52,16 +52,19 @@
 #include "nsIScriptObjectPrincipal.h"
 #include "jsdbgapi.h"
 #include "nsJSUtils.h"
 #include "nsIAsyncVerifyRedirectCallback.h"
 #include "nsIScriptError.h"
 #include "nsICharsetConverterManager.h"
 #include "nsIChannelPolicy.h"
 #include "nsIContentSecurityPolicy.h"
+#include "mozilla/Preferences.h"
+
+using namespace mozilla;
 
 #define REPLACEMENT_CHAR     (PRUnichar)0xFFFD
 #define BOM_CHAR             (PRUnichar)0xFEFF
 #define SPACE_CHAR           (PRUnichar)0x0020
 #define CR_CHAR              (PRUnichar)0x000D
 #define LF_CHAR              (PRUnichar)0x000A
 #define COLON_CHAR           (PRUnichar)0x003A
 
@@ -770,17 +773,17 @@ nsEventSource::GetInterface(const nsIID 
 
   return QueryInterface(aIID, aResult);
 }
 
 // static
 PRBool
 nsEventSource::PrefEnabled()
 {
-  return nsContentUtils::GetBoolPref("dom.server-events.enabled", PR_FALSE);
+  return Preferences::GetBool("dom.server-events.enabled", PR_FALSE);
 }
 
 nsresult
 nsEventSource::GetBaseURI(nsIURI **aBaseURI)
 {
   NS_ENSURE_ARG_POINTER(aBaseURI);
 
   *aBaseURI = nsnull;
--- a/content/base/src/nsFrameLoader.cpp
+++ b/content/base/src/nsFrameLoader.cpp
@@ -109,16 +109,18 @@
 #include "mozilla/unused.h"
 
 #include "Layers.h"
 
 #include "ContentParent.h"
 #include "TabParent.h"
 #include "mozilla/layout/RenderFrameParent.h"
 
+#include "mozilla/Preferences.h"
+
 using namespace mozilla;
 using namespace mozilla::dom;
 using namespace mozilla::layers;
 typedef FrameMetrics::ViewID ViewID;
 
 #include "jsapi.h"
 
 class nsAsyncDocShellDestroyer : public nsRunnable
@@ -1341,18 +1343,18 @@ nsFrameLoader::ShouldUseRemoteProcess()
   // Check for *disabled* multi-process first: environment, prefs, attribute
   // Then check for *enabled* multi-process pref: attribute, prefs
   // Default is not-remote.
 
   if (PR_GetEnv("MOZ_DISABLE_OOP_TABS")) {
     return false;
   }
 
-  PRBool remoteDisabled = nsContentUtils::GetBoolPref("dom.ipc.tabs.disabled",
-                                                      PR_FALSE);
+  PRBool remoteDisabled =
+    Preferences::GetBool("dom.ipc.tabs.disabled", PR_FALSE);
   if (remoteDisabled) {
     return false;
   }
 
   static nsIAtom* const *const remoteValues[] = {
     &nsGkAtoms::_false,
     &nsGkAtoms::_true,
     nsnull
@@ -1361,18 +1363,17 @@ nsFrameLoader::ShouldUseRemoteProcess()
   switch (mOwnerContent->FindAttrValueIn(kNameSpaceID_None, nsGkAtoms::Remote,
                                          remoteValues, eCaseMatters)) {
   case 0:
     return false;
   case 1:
     return true;
   }
 
-  PRBool remoteEnabled = nsContentUtils::GetBoolPref("dom.ipc.tabs.enabled",
-                                                     PR_FALSE);
+  PRBool remoteEnabled = Preferences::GetBool("dom.ipc.tabs.enabled", PR_FALSE);
   return (bool) remoteEnabled;
 }
 
 nsresult
 nsFrameLoader::MaybeCreateDocShell()
 {
   if (mDocShell) {
     return NS_OK;
--- a/content/base/src/nsPlainTextSerializer.cpp
+++ b/content/base/src/nsPlainTextSerializer.cpp
@@ -53,17 +53,19 @@
 #include "nsINameSpaceManager.h"
 #include "nsTextFragment.h"
 #include "nsContentUtils.h"
 #include "nsReadableUtils.h"
 #include "nsUnicharUtils.h"
 #include "nsCRT.h"
 #include "nsIParserService.h"
 #include "mozilla/dom/Element.h"
+#include "mozilla/Preferences.h"
 
+using namespace mozilla;
 using namespace mozilla::dom;
 
 #define PREF_STRUCTS "converter.html2txt.structs"
 #define PREF_HEADER_STRATEGY "converter.html2txt.header_strategy"
 
 static const  PRInt32 kTabSize=4;
 static const  PRInt32 kOLNumberWidth = 3;
 static const  PRInt32 kIndentSizeHeaders = 2;  /* Indention of h1, if
@@ -201,38 +203,37 @@ nsPlainTextSerializer::Init(PRUint32 aFl
     mLineBreak.AssignLiteral(NS_LINEBREAK);
   }
 
   mLineBreakDue = PR_FALSE;
   mFloatingLines = -1;
 
   if (mFlags & nsIDocumentEncoder::OutputFormatted) {
     // Get some prefs that controls how we do formatted output
-    mStructs = nsContentUtils::GetBoolPref(PREF_STRUCTS, mStructs);
+    mStructs = Preferences::GetBool(PREF_STRUCTS, mStructs);
 
     mHeaderStrategy =
       nsContentUtils::GetIntPref(PREF_HEADER_STRATEGY, mHeaderStrategy);
 
     // The quotesPreformatted pref is a temporary measure. See bug 69638.
     mQuotesPreformatted =
-      nsContentUtils::GetBoolPref("editor.quotesPreformatted",
-                                  mQuotesPreformatted);
+      Preferences::GetBool("editor.quotesPreformatted", mQuotesPreformatted);
 
     // DontWrapAnyQuotes is set according to whether plaintext mail
     // is wrapping to window width -- see bug 134439.
     // We'll only want this if we're wrapping and formatted.
     if (mFlags & nsIDocumentEncoder::OutputWrap || mWrapColumn > 0) {
       mDontWrapAnyQuotes =
-        nsContentUtils::GetBoolPref("mail.compose.wrap_to_window_width",
-                                    mDontWrapAnyQuotes);
+        Preferences::GetBool("mail.compose.wrap_to_window_width",
+                             mDontWrapAnyQuotes);
     }
   }
 
   // XXX We should let the caller pass this in.
-  if (nsContentUtils::GetBoolPref("browser.frames.enabled")) {
+  if (Preferences::GetBool("browser.frames.enabled")) {
     mFlags &= ~nsIDocumentEncoder::OutputNoFramesContent;
   }
   else {
     mFlags |= nsIDocumentEncoder::OutputNoFramesContent;
   }
 
   return NS_OK;
 }
--- a/content/base/src/nsWebSocket.cpp
+++ b/content/base/src/nsWebSocket.cpp
@@ -70,16 +70,17 @@
 #include "jsdbgapi.h"
 #include "nsIJSContextStack.h"
 #include "nsJSUtils.h"
 #include "nsIScriptError.h"
 #include "nsNetUtil.h"
 #include "nsIWebSocketProtocol.h"
 #include "nsILoadGroup.h"
 #include "nsIRequest.h"
+#include "mozilla/Preferences.h"
 
 using namespace mozilla;
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsWebSocketEstablishedConnection
 ////////////////////////////////////////////////////////////////////////////////
 
 #define UTF_8_REPLACEMENT_CHAR    static_cast<PRUnichar>(0xFFFD)
@@ -897,17 +898,17 @@ nsWebSocket::CreateAndDispatchCloseEvent
   NS_ENSURE_SUCCESS(rv, rv);
 
   return DispatchDOMEvent(nsnull, event, nsnull, nsnull);
 }
 
 PRBool
 nsWebSocket::PrefEnabled()
 {
-  return nsContentUtils::GetBoolPref("network.websocket.enabled", PR_TRUE);
+  return Preferences::GetBool("network.websocket.enabled", PR_TRUE);
 }
 
 void
 nsWebSocket::SetReadyState(PRUint16 aNewReadyState)
 {
   NS_ABORT_IF_FALSE(NS_IsMainThread(), "Not running on main thread");
   nsresult rv;
 
--- a/content/events/src/nsDOMTouchEvent.cpp
+++ b/content/events/src/nsDOMTouchEvent.cpp
@@ -36,16 +36,19 @@
  * ***** END LICENSE BLOCK ***** */
 
 #include "nsDOMTouchEvent.h"
 #include "nsGUIEvent.h"
 #include "nsDOMClassInfoID.h"
 #include "nsIClassInfo.h"
 #include "nsIXPCScriptable.h"
 #include "nsContentUtils.h"
+#include "mozilla/Preferences.h"
+
+using namespace mozilla;
 
 DOMCI_DATA(Touch, nsDOMTouch)
 
 NS_IMPL_CYCLE_COLLECTION_1(nsDOMTouch, mTarget)
 
 NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsDOMTouch)
   NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMTouch)
   NS_INTERFACE_MAP_ENTRY(nsIDOMTouch)
@@ -318,17 +321,17 @@ nsDOMTouchEvent::GetShiftKey(PRBool* aSh
 
 PRBool
 nsDOMTouchEvent::PrefEnabled()
 {
   static PRBool sDidCheckPref = PR_FALSE;
   static PRBool sPrefValue = PR_FALSE;
   if (!sDidCheckPref) {
     sDidCheckPref = PR_TRUE;
-    sPrefValue = nsContentUtils::GetBoolPref("dom.w3c_touch_events.enabled", PR_FALSE);
+    sPrefValue = Preferences::GetBool("dom.w3c_touch_events.enabled", PR_FALSE);
     if (sPrefValue) {
       nsContentUtils::InitializeTouchEventTable();
     }
   }
   return sPrefValue;
 }
 
 nsresult
--- a/content/events/src/nsEventStateManager.cpp
+++ b/content/events/src/nsEventStateManager.cpp
@@ -149,20 +149,23 @@
 #ifdef MOZ_XUL
 #include "nsTreeBodyFrame.h"
 #endif
 #include "nsIController.h"
 #include "nsICommandParams.h"
 #include "mozilla/Services.h"
 #include "mozAutoDocUpdate.h"
 
+#include "mozilla/Preferences.h"
+
 #ifdef XP_MACOSX
 #import <ApplicationServices/ApplicationServices.h>
 #endif
 
+using namespace mozilla;
 using namespace mozilla::dom;
 
 //#define DEBUG_DOCSHELL_FOCUS
 
 #define NS_USER_INTERACTION_INTERVAL 5000 // ms
 
 static NS_DEFINE_CID(kFrameTraversalCID, NS_FRAMETRAVERSAL_CID);
 
@@ -579,17 +582,17 @@ nsMouseWheelTransaction::Shutdown()
   NS_IF_RELEASE(sTimer);
 }
 
 void
 nsMouseWheelTransaction::OnFailToScrollTarget()
 {
   NS_PRECONDITION(sTargetFrame, "We don't have mouse scrolling transaction");
 
-  if (nsContentUtils::GetBoolPref("test.mousescroll", PR_FALSE)) {
+  if (Preferences::GetBool("test.mousescroll", PR_FALSE)) {
     // This event is used for automated tests, see bug 442774.
     nsContentUtils::DispatchTrustedEvent(
                       sTargetFrame->GetContent()->GetOwnerDoc(),
                       sTargetFrame->GetContent(),
                       NS_LITERAL_STRING("MozMouseScrollFailed"),
                       PR_TRUE, PR_TRUE);
   }
   // The target frame might be destroyed in the event handler, at that time,
@@ -607,17 +610,17 @@ nsMouseWheelTransaction::OnTimeout(nsITi
     return;
   }
   // Store the sTargetFrame, the variable becomes null in EndTransaction.
   nsIFrame* frame = sTargetFrame;
   // We need to finish current transaction before DOM event firing. Because
   // the next DOM event might create strange situation for us.
   EndTransaction();
 
-  if (nsContentUtils::GetBoolPref("test.mousescroll", PR_FALSE)) {
+  if (Preferences::GetBool("test.mousescroll", PR_FALSE)) {
     // This event is used for automated tests, see bug 442774.
     nsContentUtils::DispatchTrustedEvent(
                       frame->GetContent()->GetOwnerDoc(),
                       frame->GetContent(),
                       NS_LITERAL_STRING("MozMouseScrollTransactionTimeout"),
                       PR_TRUE, PR_TRUE);
   }
 }
@@ -838,18 +841,18 @@ nsEventStateManager::Init()
 
   observerService->AddObserver(this, NS_XPCOM_SHUTDOWN_OBSERVER_ID, PR_TRUE);
 
   nsIPrefBranch2* prefBranch = nsContentUtils::GetPrefBranch();
 
   if (prefBranch) {
     if (sESMInstanceCount == 1) {
       sLeftClickOnly =
-        nsContentUtils::GetBoolPref("nglayout.events.dispatchLeftClickOnly",
-                                    sLeftClickOnly);
+        Preferences::GetBool("nglayout.events.dispatchLeftClickOnly",
+                             sLeftClickOnly);
       sChromeAccessModifier =
         GetAccessModifierMaskFromPref(nsIDocShellTreeItem::typeChrome);
       sContentAccessModifier =
         GetAccessModifierMaskFromPref(nsIDocShellTreeItem::typeContent);
     }
     prefBranch->AddObserver("accessibility.accesskeycausesactivation", this, PR_TRUE);
     prefBranch->AddObserver("nglayout.events.dispatchLeftClickOnly", this, PR_TRUE);
     prefBranch->AddObserver("ui.key.generalAccessKey", this, PR_TRUE);
@@ -870,17 +873,17 @@ nsEventStateManager::Init()
     prefBranch->AddObserver("mousewheel.withshiftkey.numlines", this, PR_TRUE);
     prefBranch->AddObserver("mousewheel.withshiftkey.sysnumlines", this, PR_TRUE);
 #endif
 
     prefBranch->AddObserver("dom.popup_allowed_events", this, PR_TRUE);
   }
 
   mClickHoldContextMenu =
-    nsContentUtils::GetBoolPref("ui.click_hold_context_menus", PR_FALSE);
+    Preferences::GetBool("ui.click_hold_context_menus", PR_FALSE);
 
   return NS_OK;
 }
 
 nsEventStateManager::~nsEventStateManager()
 {
   if (sActiveESM == this) {
     sActiveESM = nsnull;
@@ -963,36 +966,36 @@ nsEventStateManager::Observe(nsISupports
     Shutdown();
   else if (!nsCRT::strcmp(aTopic, NS_PREFBRANCH_PREFCHANGE_TOPIC_ID)) {
     if (!someData)
       return NS_OK;
 
     nsDependentString data(someData);
     if (data.EqualsLiteral("accessibility.accesskeycausesactivation")) {
       sKeyCausesActivation =
-        nsContentUtils::GetBoolPref("accessibility.accesskeycausesactivation",
-                                    sKeyCausesActivation);
+        Preferences::GetBool("accessibility.accesskeycausesactivation",
+                             sKeyCausesActivation);
     } else if (data.EqualsLiteral("nglayout.events.dispatchLeftClickOnly")) {
       sLeftClickOnly =
-        nsContentUtils::GetBoolPref("nglayout.events.dispatchLeftClickOnly",
-                                    sLeftClickOnly);
+        Preferences::GetBool("nglayout.events.dispatchLeftClickOnly",
+                             sLeftClickOnly);
     } else if (data.EqualsLiteral("ui.key.generalAccessKey")) {
       sChromeAccessModifier =
         GetAccessModifierMaskFromPref(nsIDocShellTreeItem::typeChrome);
       sContentAccessModifier =
         GetAccessModifierMaskFromPref(nsIDocShellTreeItem::typeContent);
     } else if (data.EqualsLiteral("ui.key.chromeAccess")) {
       sChromeAccessModifier =
         GetAccessModifierMaskFromPref(nsIDocShellTreeItem::typeChrome);
     } else if (data.EqualsLiteral("ui.key.contentAccess")) {
       sContentAccessModifier =
         GetAccessModifierMaskFromPref(nsIDocShellTreeItem::typeContent);
     } else if (data.EqualsLiteral("ui.click_hold_context_menus")) {
       mClickHoldContextMenu =
-        nsContentUtils::GetBoolPref("ui.click_hold_context_menus", PR_FALSE);
+        Preferences::GetBool("ui.click_hold_context_menus", PR_FALSE);
 #if 0
     } else if (data.EqualsLiteral("mousewheel.withaltkey.action")) {
     } else if (data.EqualsLiteral("mousewheel.withaltkey.numlines")) {
     } else if (data.EqualsLiteral("mousewheel.withaltkey.sysnumlines")) {
     } else if (data.EqualsLiteral("mousewheel.withcontrolkey.action")) {
     } else if (data.EqualsLiteral("mousewheel.withcontrolkey.numlines")) {
     } else if (data.EqualsLiteral("mousewheel.withcontrolkey.sysnumlines")) {
     } else if (data.EqualsLiteral("mousewheel.withshiftkey.action")) {
@@ -2459,20 +2462,21 @@ nsEventStateManager::DoScrollZoom(nsIFra
   nsIContent *content = aTargetFrame->GetContent();
   if (content &&
       !content->IsNodeOfType(nsINode::eHTML_FORM_CONTROL) &&
       !content->IsXUL())
     {
       // positive adjustment to decrease zoom, negative to increase
       PRInt32 change = (adjustment > 0) ? -1 : 1;
 
-      if (nsContentUtils::GetBoolPref("browser.zoom.full"))
+      if (Preferences::GetBool("browser.zoom.full")) {
         ChangeFullZoom(change);
-      else
+      } else {
         ChangeTextSize(change);
+      }
     }
 }
 
 static nsIFrame*
 GetParentFrameToScroll(nsIFrame* aFrame)
 {
   if (!aFrame)
     return nsnull;
@@ -2623,17 +2627,17 @@ nsEventStateManager::GetScrollLinesFor(n
 }
 
 PRBool
 nsEventStateManager::UseSystemScrollSettingFor(nsMouseScrollEvent* aMouseEvent)
 {
   nsCAutoString prefName;
   GetBasePrefKeyForMouseWheel(aMouseEvent, prefName);
   prefName.Append(".sysnumlines");
-  return nsContentUtils::GetBoolPref(prefName.get());
+  return Preferences::GetBool(prefName.get());
 }
 
 nsresult
 nsEventStateManager::DoScrollText(nsIFrame* aTargetFrame,
                                   nsMouseScrollEvent* aMouseEvent,
                                   nsIScrollableFrame::ScrollUnit aScrollQuantity,
                                   PRBool aAllowScrollSpeedOverride,
                                   nsQueryContentEvent* aQueryEvent)
@@ -3462,17 +3466,17 @@ nsEventStateManager::UpdateCursor(nsPres
         return;  // don't update the cursor if we failed to get it from the frame see bug 118877
       cursor = framecursor.mCursor;
       container = framecursor.mContainer;
       haveHotspot = framecursor.mHaveHotspot;
       hotspotX = framecursor.mHotspotX;
       hotspotY = framecursor.mHotspotY;
   }
 
-  if (nsContentUtils::GetBoolPref("ui.use_activity_cursor", PR_FALSE)) {
+  if (Preferences::GetBool("ui.use_activity_cursor", PR_FALSE)) {
     // Check whether or not to show the busy cursor
     nsCOMPtr<nsISupports> pcContainer = aPresContext->GetContainer();
     nsCOMPtr<nsIDocShell> docShell(do_QueryInterface(pcContainer));
     if (!docShell) return;
     PRUint32 busyFlags = nsIDocShell::BUSY_FLAGS_NONE;
     docShell->GetBusyFlags(&busyFlags);
 
     // Show busy cursor everywhere before page loads
--- a/content/html/content/src/nsGenericHTMLElement.cpp
+++ b/content/html/content/src/nsGenericHTMLElement.cpp
@@ -111,16 +111,19 @@
 #include "nsLayoutUtils.h"
 #include "nsContentCreatorFunctions.h"
 #include "mozAutoDocUpdate.h"
 #include "nsHtml5Module.h"
 #include "nsITextControlElement.h"
 #include "mozilla/dom/Element.h"
 #include "nsHTMLFieldSetElement.h"
 
+#include "mozilla/Preferences.h"
+
+using namespace mozilla;
 using namespace mozilla::dom;
 
 #include "nsThreadUtils.h"
 
 class nsINodeInfo;
 class nsIDOMNodeList;
 class nsRuleWalker;
 
@@ -2540,17 +2543,17 @@ nsGenericHTMLFormElement::BindToTree(nsI
                                                  aCompileEventHandlers);
   NS_ENSURE_SUCCESS(rv, rv);
 
   // An autofocus event has to be launched if the autofocus attribute is
   // specified and the element accept the autofocus attribute. In addition,
   // the document should not be already loaded and the "browser.autofocus"
   // preference should be 'true'.
   if (IsAutofocusable() && HasAttr(kNameSpaceID_None, nsGkAtoms::autofocus) &&
-      nsContentUtils::GetBoolPref("browser.autofocus", PR_TRUE)) {
+      Preferences::GetBool("browser.autofocus", PR_TRUE)) {
     nsCOMPtr<nsIRunnable> event = new nsAutoFocusEvent(this);
     rv = NS_DispatchToCurrentThread(event);
     NS_ENSURE_SUCCESS(rv, rv);
   }
 
   // If @form is set, the element *has* to be in a document, otherwise it
   // wouldn't be possible to find an element with the corresponding id.
   // If @form isn't set, the element *has* to have a parent, otherwise it
--- a/content/html/content/src/nsHTMLDNSPrefetch.cpp
+++ b/content/html/content/src/nsHTMLDNSPrefetch.cpp
@@ -57,16 +57,19 @@
 #include "nsContentUtils.h"
 #include "nsGkAtoms.h"
 #include "nsIDocument.h"
 #include "nsThreadUtils.h"
 #include "nsITimer.h"
 #include "nsIObserverService.h"
 #include "mozilla/dom/Link.h"
 
+#include "mozilla/Preferences.h"
+
+using namespace mozilla;
 using namespace mozilla::dom;
 using namespace mozilla::net;
 
 static NS_DEFINE_CID(kDNSServiceCID, NS_DNSSERVICE_CID);
 PRBool sDisablePrefetchHTTPSPref;
 static PRBool sInitialized = PR_FALSE;
 static nsIDNSService *sDNSService = nsnull;
 static nsHTMLDNSPrefetch::nsDeferrals *sPrefetches = nsnull;
@@ -94,17 +97,17 @@ nsHTMLDNSPrefetch::Initialize()
 
   sPrefetches->Activate();
 
   nsContentUtils::AddBoolPrefVarCache("network.dns.disablePrefetchFromHTTPS", 
                                       &sDisablePrefetchHTTPSPref);
   
   // Default is false, so we need an explicit call to prime the cache.
   sDisablePrefetchHTTPSPref = 
-    nsContentUtils::GetBoolPref("network.dns.disablePrefetchFromHTTPS", PR_TRUE);
+    Preferences::GetBool("network.dns.disablePrefetchFromHTTPS", PR_TRUE);
   
   NS_IF_RELEASE(sDNSService);
   nsresult rv;
   rv = CallGetService(kDNSServiceCID, &sDNSService);
   if (NS_FAILED(rv)) return rv;
   
   if (IsNeckoChild())
     NeckoChild::InitNeckoChild();
--- a/content/html/content/src/nsHTMLImageElement.cpp
+++ b/content/html/content/src/nsHTMLImageElement.cpp
@@ -70,17 +70,19 @@
 #include "nsRuleData.h"
 
 #include "nsIJSContextStack.h"
 #include "nsImageMapUtils.h"
 #include "nsIDOMHTMLMapElement.h"
 #include "nsEventDispatcher.h"
 
 #include "nsLayoutUtils.h"
+#include "mozilla/Preferences.h"
 
+using namespace mozilla;
 using namespace mozilla::dom;
 
 // XXX nav attrs: suppress
 
 class nsHTMLImageElement : public nsGenericHTMLElement,
                            public nsImageLoadingContent,
                            public nsIDOMHTMLImageElement,
                            public nsIJSNativeInitializer
@@ -495,17 +497,17 @@ nsHTMLImageElement::SetAttr(PRInt32 aNam
   // aNotify is false, we are coming from the parser or some such place; we'll
   // get bound after all the attributes have been set, so we'll do the
   // image load from BindToTree.  Skip the LoadImage call in that case.
   if (aNotify &&
       aNameSpaceID == kNameSpaceID_None && aName == nsGkAtoms::src) {
 
     // If caller is not chrome and dom.disable_image_src_set is true,
     // prevent setting image.src by exiting early
-    if (nsContentUtils::GetBoolPref("dom.disable_image_src_set") &&
+    if (Preferences::GetBool("dom.disable_image_src_set") &&
         !nsContentUtils::IsCallerChrome()) {
       return NS_OK;
     }
 
     // A hack to get animations to reset. See bug 594771.
     mNewRequestsWillNeedAnimationReset = PR_TRUE;
 
     // Force image loading here, so that we'll try to load the image from
--- a/content/html/content/src/nsHTMLMediaElement.cpp
+++ b/content/html/content/src/nsHTMLMediaElement.cpp
@@ -114,16 +114,19 @@ static PRLogModuleInfo* gMediaElementEve
 #define LOG(type, msg)
 #define LOG_EVENT(type, msg)
 #endif
 
 #include "nsIContentSecurityPolicy.h"
 #include "nsIChannelPolicy.h"
 #include "nsChannelPolicy.h"
 
+#include "mozilla/Preferences.h"
+
+using namespace mozilla;
 using namespace mozilla::dom;
 using namespace mozilla::layers;
 
 // Number of milliseconds between timeupdate events as defined by spec
 #define TIMEUPDATE_MS 250
 
 // Under certain conditions there may be no-one holding references to
 // a media element from script, DOM parent, etc, but the element may still
@@ -833,17 +836,17 @@ void nsHTMLMediaElement::ResumeLoad(Prel
     if (NS_FAILED(LoadResource(uri))) {
       LoadFromSourceChildren();
     }
   }
 }
 
 static PRBool IsAutoplayEnabled()
 {
-  return nsContentUtils::GetBoolPref("media.autoplay.enabled");
+  return Preferences::GetBool("media.autoplay.enabled");
 }
 
 void nsHTMLMediaElement::UpdatePreloadAction()
 {
   PreloadAction nextAction = PRELOAD_UNDEFINED;
   // If autoplay is set, or we're playing, we should always preload data,
   // as we'll need it to play.
   if ((IsAutoplayEnabled() && HasAttr(kNameSpaceID_None, nsGkAtoms::autoplay)) ||
@@ -1531,17 +1534,17 @@ static const char gRawTypes[][16] = {
 };
 
 static const char* gRawCodecs[] = {
   nsnull
 };
 
 static PRBool IsRawEnabled()
 {
-  return nsContentUtils::GetBoolPref("media.raw.enabled");
+  return Preferences::GetBool("media.raw.enabled");
 }
 
 static PRBool IsRawType(const nsACString& aType)
 {
   if (!IsRawEnabled())
     return PR_FALSE;
   for (PRUint32 i = 0; i < NS_ARRAY_LENGTH(gRawTypes); ++i) {
     if (aType.EqualsASCII(gRawTypes[i]))
@@ -1563,17 +1566,17 @@ char const *const nsHTMLMediaElement::gO
   "vorbis",
   "theora",
   nsnull
 };
 
 bool
 nsHTMLMediaElement::IsOggEnabled()
 {
-  return nsContentUtils::GetBoolPref("media.ogg.enabled");
+  return Preferences::GetBool("media.ogg.enabled");
 }
 
 bool
 nsHTMLMediaElement::IsOggType(const nsACString& aType)
 {
   if (!IsOggEnabled())
     return PR_FALSE;
   for (PRUint32 i = 0; i < NS_ARRAY_LENGTH(gOggTypes); ++i) {
@@ -1598,17 +1601,17 @@ const char nsHTMLMediaElement::gWaveType
 char const *const nsHTMLMediaElement::gWaveCodecs[2] = {
   "1", // Microsoft PCM Format
   nsnull
 };
 
 bool
 nsHTMLMediaElement::IsWaveEnabled()
 {
-  return nsContentUtils::GetBoolPref("media.wave.enabled");
+  return Preferences::GetBool("media.wave.enabled");
 }
 
 bool
 nsHTMLMediaElement::IsWaveType(const nsACString& aType)
 {
   if (!IsWaveEnabled())
     return PR_FALSE;
   for (PRUint32 i = 0; i < NS_ARRAY_LENGTH(gWaveTypes); ++i) {
@@ -1630,17 +1633,17 @@ char const *const nsHTMLMediaElement::gW
   "vp8.0",
   "vorbis",
   nsnull
 };
 
 bool
 nsHTMLMediaElement::IsWebMEnabled()
 {
-  return nsContentUtils::GetBoolPref("media.webm.enabled");
+  return Preferences::GetBool("media.webm.enabled");
 }
 
 bool
 nsHTMLMediaElement::IsWebMType(const nsACString& aType)
 {
   if (!IsWebMEnabled())
     return PR_FALSE;
   for (PRUint32 i = 0; i < NS_ARRAY_LENGTH(gWebMTypes); ++i) {
@@ -2078,18 +2081,17 @@ void nsHTMLMediaElement::DownloadStalled
 {
   if (mNetworkState == nsIDOMHTMLMediaElement::NETWORK_LOADING) {
     DispatchAsyncEvent(NS_LITERAL_STRING("stalled"));
   }
 }
 
 PRBool nsHTMLMediaElement::ShouldCheckAllowOrigin()
 {
-  return nsContentUtils::GetBoolPref("media.enforce_same_site_origin",
-                                     PR_TRUE);
+  return Preferences::GetBool("media.enforce_same_site_origin", PR_TRUE);
 }
 
 void nsHTMLMediaElement::UpdateReadyStateForData(NextFrameStatus aNextFrame)
 {
   if (mReadyState < nsIDOMHTMLMediaElement::HAVE_METADATA) {
     // aNextFrame might have a next frame because the decoder can advance
     // on its own thread before ResourceLoaded or MetadataLoaded gets
     // a chance to run.
--- a/content/html/document/src/nsImageDocument.cpp
+++ b/content/html/document/src/nsImageDocument.cpp
@@ -69,17 +69,19 @@
 #include "nsURILoader.h"
 #include "nsIDocShell.h"
 #include "nsIContentViewer.h"
 #include "nsIMarkupDocumentViewer.h"
 #include "nsIDocShellTreeItem.h"
 #include "nsThreadUtils.h"
 #include "nsIScrollableFrame.h"
 #include "mozilla/dom/Element.h"
+#include "mozilla/Preferences.h"
 
+using namespace mozilla;
 using namespace mozilla::dom;
 
 #define AUTOMATIC_IMAGE_RESIZING_PREF "browser.enable_automatic_image_resizing"
 #define CLICK_IMAGE_RESIZING_PREF "browser.enable_click_image_resizing"
 //XXX A hack needed for Firefox's site specific zoom.
 #define SITE_SPECIFIC_ZOOM "browser.zoom.siteSpecific"
 
 class nsImageDocument;
@@ -283,20 +285,18 @@ NS_INTERFACE_MAP_END_INHERITING(nsMediaD
 
 
 nsresult
 nsImageDocument::Init()
 {
   nsresult rv = nsMediaDocument::Init();
   NS_ENSURE_SUCCESS(rv, rv);
 
-  mResizeImageByDefault =
-    nsContentUtils::GetBoolPref(AUTOMATIC_IMAGE_RESIZING_PREF);
-  mClickResizingEnabled =
-    nsContentUtils::GetBoolPref(CLICK_IMAGE_RESIZING_PREF);
+  mResizeImageByDefault = Preferences::GetBool(AUTOMATIC_IMAGE_RESIZING_PREF);
+  mClickResizingEnabled = Preferences::GetBool(CLICK_IMAGE_RESIZING_PREF);
   mShouldResize = mResizeImageByDefault;
   mFirstResize = PR_TRUE;
 
   return NS_OK;
 }
 
 nsresult
 nsImageDocument::StartDocumentLoad(const char*         aCommand,
@@ -311,18 +311,17 @@ nsImageDocument::StartDocumentLoad(const
     nsMediaDocument::StartDocumentLoad(aCommand, aChannel, aLoadGroup,
                                        aContainer, aDocListener, aReset,
                                        aSink);
   if (NS_FAILED(rv)) {
     return rv;
   }
 
   mOriginalZoomLevel =
-    nsContentUtils::GetBoolPref(SITE_SPECIFIC_ZOOM, PR_FALSE) ?
-      1.0 : GetZoomLevel();
+    Preferences::GetBool(SITE_SPECIFIC_ZOOM, PR_FALSE) ? 1.0 : GetZoomLevel();
 
   NS_ASSERTION(aDocListener, "null aDocListener");
   *aDocListener = new ImageListener(this);
   if (!*aDocListener)
     return NS_ERROR_OUT_OF_MEMORY;
   NS_ADDREF(*aDocListener);
 
   return NS_OK;
@@ -393,18 +392,17 @@ nsImageDocument::SetScriptGlobalObject(n
 }
 
 void
 nsImageDocument::OnPageShow(PRBool aPersisted,
                             nsIDOMEventTarget* aDispatchStartTarget)
 {
   if (aPersisted) {
     mOriginalZoomLevel =
-      nsContentUtils::GetBoolPref(SITE_SPECIFIC_ZOOM, PR_FALSE) ?
-        1.0 : GetZoomLevel();
+      Preferences::GetBool(SITE_SPECIFIC_ZOOM, PR_FALSE) ? 1.0 : GetZoomLevel();
   }
   nsMediaDocument::OnPageShow(aPersisted, aDispatchStartTarget);
 }
 
 NS_IMETHODIMP
 nsImageDocument::GetImageResizingEnabled(PRBool* aImageResizingEnabled)
 {
   *aImageResizingEnabled = PR_TRUE;
--- a/content/svg/content/src/nsSVGImageElement.cpp
+++ b/content/svg/content/src/nsSVGImageElement.cpp
@@ -38,16 +38,17 @@
 
 #include "nsSVGImageElement.h"
 #include "nsCOMPtr.h"
 #include "nsIURI.h"
 #include "nsNetUtil.h"
 #include "imgIContainer.h"
 #include "imgIDecoderObserver.h"
 #include "gfxContext.h"
+#include "mozilla/Preferences.h"
 
 using namespace mozilla;
 
 nsSVGElement::LengthInfo nsSVGImageElement::sLengthInfo[4] =
 {
   { &nsGkAtoms::x, 0, nsIDOMSVGLength::SVG_LENGTHTYPE_NUMBER, nsSVGUtils::X },
   { &nsGkAtoms::y, 0, nsIDOMSVGLength::SVG_LENGTHTYPE_NUMBER, nsSVGUtils::Y },
   { &nsGkAtoms::width, 0, nsIDOMSVGLength::SVG_LENGTHTYPE_NUMBER, nsSVGUtils::X },
@@ -165,17 +166,17 @@ nsSVGImageElement::LoadSVGImage(PRBool a
 
 nsresult
 nsSVGImageElement::AfterSetAttr(PRInt32 aNamespaceID, nsIAtom* aName,
                                 const nsAString* aValue, PRBool aNotify)
 {
   if (aNamespaceID == kNameSpaceID_XLink && aName == nsGkAtoms::href) {
     // If caller is not chrome and dom.disable_image_src_set is true,
     // prevent setting image.src by exiting early
-    if (nsContentUtils::GetBoolPref("dom.disable_image_src_set") &&
+    if (Preferences::GetBool("dom.disable_image_src_set") &&
         !nsContentUtils::IsCallerChrome()) {
       return NS_OK;
     }
 
     if (aValue) {
       LoadSVGImage(PR_TRUE, aNotify);
     } else {
       CancelImageRequests(aNotify);
--- a/content/xml/document/src/nsXMLPrettyPrinter.cpp
+++ b/content/xml/document/src/nsXMLPrettyPrinter.cpp
@@ -47,17 +47,19 @@
 #include "nsIDOMElement.h"
 #include "nsIDOMDocument.h"
 #include "nsIServiceManager.h"
 #include "nsNetUtil.h"
 #include "mozilla/dom/Element.h"
 #include "nsIDOMDocumentFragment.h"
 #include "nsBindingManager.h"
 #include "nsIScriptSecurityManager.h"
+#include "mozilla/Preferences.h"
 
+using namespace mozilla;
 using namespace mozilla::dom;
 
 NS_IMPL_ISUPPORTS2(nsXMLPrettyPrinter,
                    nsIDocumentObserver,
                    nsIMutationObserver)
 
 nsXMLPrettyPrinter::nsXMLPrettyPrinter() : mDocument(nsnull),
                                            mUpdateDepth(0),
@@ -109,17 +111,17 @@ nsXMLPrettyPrinter::PrettyPrint(nsIDocum
             if (!visibility.EqualsLiteral("visible")) {
 
                 return NS_OK;
             }
         }
     }
 
     // check the pref
-    if (!nsContentUtils::GetBoolPref("layout.xml.prettyprint", PR_TRUE)) {
+    if (!Preferences::GetBool("layout.xml.prettyprint", PR_TRUE)) {
         return NS_OK;
     }
 
     // Ok, we should prettyprint. Let's do it!
     *aDidPrettyPrint = PR_TRUE;
     nsresult rv = NS_OK;
 
     // Load the XSLT
--- a/content/xul/content/src/nsXULPopupListener.cpp
+++ b/content/xul/content/src/nsXULPopupListener.cpp
@@ -65,26 +65,29 @@
 #include "nsIDOMNSEvent.h"
 #include "nsServiceManagerUtils.h"
 #include "nsIPrincipal.h"
 #include "nsIScriptSecurityManager.h"
 #include "nsLayoutUtils.h"
 #include "nsFrameManager.h"
 #include "nsHTMLReflowState.h"
 #include "nsIObjectLoadingContent.h"
+#include "mozilla/Preferences.h"
 
 // for event firing in context menus
 #include "nsPresContext.h"
 #include "nsIPresShell.h"
 #include "nsFocusManager.h"
 #include "nsPIDOMWindow.h"
 #include "nsIViewManager.h"
 #include "nsDOMError.h"
 #include "nsIMenuFrame.h"
 
+using namespace mozilla;
+
 // on win32 and os/2, context menus come up on mouse up. On other platforms,
 // they appear on mouse down. Certain bits of code care about this difference.
 #if !defined(XP_WIN) && !defined(XP_OS2)
 #define NS_CONTEXT_MENU_IS_MOUSEUP 1
 #endif
 
 nsXULPopupListener::nsXULPopupListener(nsIDOMElement *aElement, PRBool aIsContext)
   : mElement(aElement), mPopupContent(nsnull), mIsContext(aIsContext)
@@ -170,17 +173,17 @@ nsXULPopupListener::PreLaunchPopup(nsIDO
   }
 
   PRBool preventDefault;
   nsUIEvent->GetPreventDefault(&preventDefault);
   if (preventDefault && targetNode && mIsContext) {
     // Someone called preventDefault on a context menu.
     // Let's make sure they are allowed to do so.
     PRBool eventEnabled =
-      nsContentUtils::GetBoolPref("dom.event.contextmenu.enabled", PR_TRUE);
+      Preferences::GetBool("dom.event.contextmenu.enabled", PR_TRUE);
     if (!eventEnabled) {
       // If the target node is for plug-in, we should not open XUL context
       // menu on windowless plug-ins.
       nsCOMPtr<nsIObjectLoadingContent> olc = do_QueryInterface(targetNode);
       PRUint32 type;
       if (olc && NS_SUCCEEDED(olc->GetDisplayedType(&type)) &&
           type == nsIObjectLoadingContent::TYPE_PLUGIN) {
         return NS_OK;
--- a/content/xul/document/src/nsXULPrototypeCache.cpp
+++ b/content/xul/document/src/nsXULPrototypeCache.cpp
@@ -58,28 +58,32 @@
 #include "nsIObjectOutputStream.h"
 #include "nsIObserverService.h"
 
 #include "nsNetUtil.h"
 #include "nsAppDirectoryServiceDefs.h"
 
 #include "jsxdrapi.h"
 
+#include "mozilla/Preferences.h"
+
+using namespace mozilla;
+
 static NS_DEFINE_CID(kXULPrototypeCacheCID, NS_XULPROTOTYPECACHE_CID);
 
 static PRBool gDisableXULCache = PR_FALSE; // enabled by default
 static const char kDisableXULCachePref[] = "nglayout.debug.disable_xul_cache";
 
 //----------------------------------------------------------------------
 
 static int
 DisableXULCacheChangedCallback(const char* aPref, void* aClosure)
 {
     gDisableXULCache =
-        nsContentUtils::GetBoolPref(kDisableXULCachePref, gDisableXULCache);
+        Preferences::GetBool(kDisableXULCachePref, gDisableXULCache);
 
     // Flush the cache, regardless
     nsXULPrototypeCache* cache = nsXULPrototypeCache::GetInstance();
     if (cache)
         cache->Flush();
 
     return 0;
 }
@@ -127,17 +131,17 @@ NS_NewXULPrototypeCache(nsISupports* aOu
           result->mScriptTable.Init() &&
           result->mXBLDocTable.Init() &&
           result->mFastLoadURITable.Init())) {
         return NS_ERROR_OUT_OF_MEMORY;
     }
 
     // XXX Ignore return values.
     gDisableXULCache =
-        nsContentUtils::GetBoolPref(kDisableXULCachePref, gDisableXULCache);
+        Preferences::GetBool(kDisableXULCachePref, gDisableXULCache);
     nsContentUtils::RegisterPrefCallback(kDisableXULCachePref,
                                          DisableXULCacheChangedCallback,
                                          nsnull);
 
     nsresult rv = result->QueryInterface(aIID, aResult);
 
     nsCOMPtr<nsIObserverService> obsSvc =
         mozilla::services::GetObserverService();
@@ -591,31 +595,30 @@ nsXULPrototypeCache::StartFastLoadingURI
     return gFastLoadService->StartMuxedDocument(aURI, urlspec.get(), aDirectionFlags);
 }
 
 static int
 FastLoadPrefChangedCallback(const char* aPref, void* aClosure)
 {
     PRBool wasEnabled = !gDisableXULFastLoad;
     gDisableXULFastLoad =
-        nsContentUtils::GetBoolPref(kDisableXULFastLoadPref,
-                                    gDisableXULFastLoad);
+        Preferences::GetBool(kDisableXULFastLoadPref, gDisableXULFastLoad);
 
     if (wasEnabled && gDisableXULFastLoad) {
         static NS_DEFINE_CID(kXULPrototypeCacheCID, NS_XULPROTOTYPECACHE_CID);
         nsCOMPtr<nsIXULPrototypeCache> cache =
             do_GetService(kXULPrototypeCacheCID);
 
         if (cache)
             cache->AbortFastLoads();
     }
 
     gChecksumXULFastLoadFile =
-        nsContentUtils::GetBoolPref(kChecksumXULFastLoadFilePref,
-                                    gChecksumXULFastLoadFile);
+        Preferences::GetBool(kChecksumXULFastLoadFilePref,
+                             gChecksumXULFastLoadFile);
 
     return 0;
 }
 
 
 class nsXULFastLoadFileIO : public nsIFastLoadFileIO
 {
   public:
@@ -720,21 +723,20 @@ nsXULPrototypeCache::StartFastLoad(nsIUR
     // Use a local to refer to the service till we're sure we succeeded, then
     // commit to gFastLoadService.  Same for gFastLoadFile, which is used to
     // delete the FastLoad file on abort.
     nsCOMPtr<nsIFastLoadService> fastLoadService(do_GetFastLoadService());
     if (! fastLoadService)
         return NS_ERROR_FAILURE;
 
     gDisableXULFastLoad =
-        nsContentUtils::GetBoolPref(kDisableXULFastLoadPref,
-                                    gDisableXULFastLoad);
+        Preferences::GetBool(kDisableXULFastLoadPref, gDisableXULFastLoad);
     gChecksumXULFastLoadFile =
-        nsContentUtils::GetBoolPref(kChecksumXULFastLoadFilePref,
-                                    gChecksumXULFastLoadFile);
+        Preferences::GetBool(kChecksumXULFastLoadFilePref,
+                             gChecksumXULFastLoadFile);
     nsContentUtils::RegisterPrefCallback(kDisableXULFastLoadPref,
                                          FastLoadPrefChangedCallback,
                                          nsnull);
     nsContentUtils::RegisterPrefCallback(kChecksumXULFastLoadFilePref,
                                          FastLoadPrefChangedCallback,
                                          nsnull);
 
     if (gDisableXULFastLoad)
--- a/dom/base/nsDOMClassInfo.cpp
+++ b/dom/base/nsDOMClassInfo.cpp
@@ -88,16 +88,17 @@
 #include "nsIDOMNSEvent.h"
 #include "nsIDOMKeyEvent.h"
 #include "nsIDOMEventListener.h"
 #include "nsIDOMPopStateEvent.h"
 #include "nsIDOMHashChangeEvent.h"
 #include "nsContentUtils.h"
 #include "nsDOMWindowUtils.h"
 #include "nsIDOMGlobalPropertyInitializer.h"
+#include "mozilla/Preferences.h"
 
 // Window scriptable helper includes
 #include "nsIDocShell.h"
 #include "nsIDocShellTreeItem.h"
 #include "nsIDocShellTreeNode.h"
 #include "nsIScriptExternalNameSet.h"
 #include "nsJSUtils.h"
 #include "nsIInterfaceRequestor.h"
@@ -511,16 +512,17 @@
 #include "nsIIDBDatabaseException.h"
 #include "nsIDOMEventException.h"
 
 #include "nsIDOMMediaQueryList.h"
 
 #include "nsDOMTouchEvent.h"
 #include "nsIDOMCustomEvent.h"
 
+using namespace mozilla;
 using namespace mozilla::dom;
 
 static NS_DEFINE_CID(kDOMSOF_CID, NS_DOM_SCRIPT_OBJECT_FACTORY_CID);
 
 static const char kDOMStringBundleURL[] =
   "chrome://global/locale/dom/dom.properties";
 
 // NOTE: DEFAULT_SCRIPTABLE_FLAGS and DOM_DEFAULT_SCRIPTABLE_FLAGS
@@ -4427,20 +4429,20 @@ nsDOMClassInfo::Init()
 
   for (i = 0; i < eDOMClassInfoIDCount; ++i) {
     RegisterClassProtos(i);
   }
 
   RegisterExternalClasses();
 
   sDisableDocumentAllSupport =
-    nsContentUtils::GetBoolPref("browser.dom.document.all.disabled");
+    Preferences::GetBool("browser.dom.document.all.disabled");
 
   sDisableGlobalScopePollutionSupport =
-    nsContentUtils::GetBoolPref("browser.dom.global_scope_pollution.disabled");
+    Preferences::GetBool("browser.dom.global_scope_pollution.disabled");
 
   sIsInitialized = PR_TRUE;
 
   return NS_OK;
 }
 
 // static
 PRInt32
--- a/dom/base/nsFocusManager.cpp
+++ b/dom/base/nsFocusManager.cpp
@@ -80,22 +80,24 @@
 #include "nsFrameSelection.h"
 #include "nsXULPopupManager.h"
 #include "nsImageMapUtils.h"
 #include "nsIDOMNodeFilter.h"
 #include "nsIScriptObjectPrincipal.h"
 #include "nsIPrincipal.h"
 #include "mozilla/dom/Element.h"
 #include "mozAutoDocUpdate.h"
+#include "mozilla/Preferences.h"
 
 #ifdef MOZ_XUL
 #include "nsIDOMXULTextboxElement.h"
 #include "nsIDOMXULMenuListElement.h"
 #endif
 
+using namespace mozilla;
 using namespace mozilla::dom;
 
 //#define DEBUG_FOCUS 1
 //#define DEBUG_FOCUS_NAVIGATION 1
 #define PRINTTAGF(format, content)                     \
   {                                                    \
     nsAutoString tag(NS_LITERAL_STRING("(none)"));     \
     if (content)                                       \
@@ -183,21 +185,21 @@ nsresult
 nsFocusManager::Init()
 {
   nsFocusManager* fm = new nsFocusManager();
   NS_ENSURE_TRUE(fm, NS_ERROR_OUT_OF_MEMORY);
   NS_ADDREF(fm);
   sInstance = fm;
 
   nsIContent::sTabFocusModelAppliesToXUL =
-    nsContentUtils::GetBoolPref("accessibility.tabfocus_applies_to_xul",
-                                nsIContent::sTabFocusModelAppliesToXUL);
+    Preferences::GetBool("accessibility.tabfocus_applies_to_xul",
+                         nsIContent::sTabFocusModelAppliesToXUL);
 
   sMouseFocusesFormControl =
-    nsContentUtils::GetBoolPref("accessibility.mouse_focuses_formcontrol", PR_FALSE);
+    Preferences::GetBool("accessibility.mouse_focuses_formcontrol", PR_FALSE);
 
   nsIPrefBranch2* prefBranch = nsContentUtils::GetPrefBranch();
   if (prefBranch) {
     prefBranch->AddObserver("accessibility.browsewithcaret", fm, PR_TRUE);
     prefBranch->AddObserver("accessibility.tabfocus_applies_to_xul", fm, PR_TRUE);
     prefBranch->AddObserver("accessibility.mouse_focuses_formcontrol", fm, PR_TRUE);
   }
 
@@ -223,22 +225,23 @@ nsFocusManager::Observe(nsISupports *aSu
 {
   if (!nsCRT::strcmp(aTopic, NS_PREFBRANCH_PREFCHANGE_TOPIC_ID)) {
     nsDependentString data(aData);
     if (data.EqualsLiteral("accessibility.browsewithcaret")) {
       UpdateCaret(PR_FALSE, PR_TRUE, mFocusedContent);
     }
     else if (data.EqualsLiteral("accessibility.tabfocus_applies_to_xul")) {
       nsIContent::sTabFocusModelAppliesToXUL =
-        nsContentUtils::GetBoolPref("accessibility.tabfocus_applies_to_xul",
-                                    nsIContent::sTabFocusModelAppliesToXUL);
+        Preferences::GetBool("accessibility.tabfocus_applies_to_xul",
+                             nsIContent::sTabFocusModelAppliesToXUL);
     }
     else if (data.EqualsLiteral("accessibility.mouse_focuses_formcontrol")) {
       sMouseFocusesFormControl =
-        nsContentUtils::GetBoolPref("accessibility.mouse_focuses_formcontrol", PR_FALSE);
+        Preferences::GetBool("accessibility.mouse_focuses_formcontrol",
+                             PR_FALSE);
     }
   } else if (!nsCRT::strcmp(aTopic, "xpcom-shutdown")) {
     mActiveWindow = nsnull;
     mFocusedWindow = nsnull;
     mFocusedContent = nsnull;
     mFirstBlurEvent = nsnull;
     mFirstFocusEvent = nsnull;
     mWindowBeingLowered = nsnull;
@@ -1950,17 +1953,17 @@ nsFocusManager::UpdateCaret(PRBool aMove
     return;
 
   PRInt32 itemType;
   dsti->GetItemType(&itemType);
   if (itemType == nsIDocShellTreeItem::typeChrome)
     return;  // Never browse with caret in chrome
 
   PRPackedBool browseWithCaret =
-    nsContentUtils::GetBoolPref("accessibility.browsewithcaret");
+    Preferences::GetBool("accessibility.browsewithcaret");
 
   nsCOMPtr<nsIPresShell> presShell;
   focusedDocShell->GetPresShell(getter_AddRefs(presShell));
   if (!presShell)
     return;
 
   // If this is an editable document which isn't contentEditable, or a
   // contentEditable document and the node to focus is contentEditable,
--- a/dom/base/nsGlobalWindow.cpp
+++ b/dom/base/nsGlobalWindow.cpp
@@ -64,16 +64,17 @@
 #include "jsapi.h"              // for JSAutoRequest
 #include "jsdbgapi.h"           // for JS_ClearWatchPointsForObject
 #include "jsfriendapi.h"        // for JS_GetFrameScopeChainRaw
 #include "nsReadableUtils.h"
 #include "nsDOMClassInfo.h"
 #include "nsJSEnvironment.h"
 #include "nsCharSeparatedTokenizer.h" // for Accept-Language parsing
 #include "nsUnicharUtils.h"
+#include "mozilla/Preferences.h"
 
 // Other Classes
 #include "nsIEventListenerManager.h"
 #include "nsEscape.h"
 #include "nsStyleCoord.h"
 #include "nsMimeTypeArray.h"
 #include "nsNetUtil.h"
 #include "nsICachingChannel.h"
@@ -239,16 +240,17 @@
 #include "mozAutoDocUpdate.h"
 
 #ifdef PR_LOGGING
 static PRLogModuleInfo* gDOMLeakPRLog;
 #endif
 
 static const char kStorageEnabled[] = "dom.storage.enabled";
 
+using namespace mozilla;
 using namespace mozilla::dom;
 using mozilla::TimeStamp;
 using mozilla::TimeDuration;
 
 nsIDOMStorageList *nsGlobalWindow::sGlobalStorageList  = nsnull;
 nsGlobalWindow::WindowByIdTable *nsGlobalWindow::sOuterWindowsById = nsnull;
 
 static nsIEntropyCollector *gEntropyCollector          = nsnull;
@@ -5072,17 +5074,17 @@ nsGlobalWindow::Print()
                                 getter_AddRefs(webBrowserPrint)))) {
 
     nsCOMPtr<nsIPrintSettingsService> printSettingsService = 
       do_GetService("@mozilla.org/gfx/printsettings-service;1");
 
     nsCOMPtr<nsIPrintSettings> printSettings;
     if (printSettingsService) {
       PRBool printSettingsAreGlobal =
-        nsContentUtils::GetBoolPref("print.use_global_printsettings", PR_FALSE);
+        Preferences::GetBool("print.use_global_printsettings", PR_FALSE);
 
       if (printSettingsAreGlobal) {
         printSettingsService->GetGlobalPrintSettings(getter_AddRefs(printSettings));
 
         nsXPIDLString printerName;
         printSettings->GetPrinterName(getter_Copies(printerName));
         if (printerName.IsEmpty()) {
           printSettingsService->GetDefaultPrinterName(getter_Copies(printerName));
@@ -5096,17 +5098,17 @@ nsGlobalWindow::Print()
         printSettingsService->GetNewPrintSettings(getter_AddRefs(printSettings));
       }
 
       nsCOMPtr<nsIDOMWindow> callerWin = EnterModalState();
       webBrowserPrint->Print(printSettings, nsnull);
       LeaveModalState(callerWin);
 
       PRBool savePrintSettings =
-        nsContentUtils::GetBoolPref("print.save_print_settings", PR_FALSE);
+        Preferences::GetBool("print.save_print_settings", PR_FALSE);
       if (printSettingsAreGlobal && savePrintSettings) {
         printSettingsService->
           SavePrintSettingsToPrefs(printSettings,
                                    PR_TRUE,
                                    nsIPrintSettings::kInitSaveAll);
         printSettingsService->
           SavePrintSettingsToPrefs(printSettings,
                                    PR_FALSE,
@@ -5546,17 +5548,17 @@ nsGlobalWindow::CanSetProperty(const cha
 {
   // Chrome can set any property.
   if (nsContentUtils::IsCallerTrustedForWrite()) {
     return PR_TRUE;
   }
 
   // If the pref is set to true, we can not set the property
   // and vice versa.
-  return !nsContentUtils::GetBoolPref(aPrefName, PR_TRUE);
+  return !Preferences::GetBool(aPrefName, PR_TRUE);
 }
 
 PRBool
 nsGlobalWindow::PopupWhitelisted()
 {
   if (!IsPopupBlocked(mDocument))
     return PR_TRUE;
 
@@ -6182,18 +6184,17 @@ nsGlobalWindow::Close()
     // so the user can see that there was a blocked popup.
     return NS_OK;
   }
 
   // Don't allow scripts from content to close windows
   // that were not opened by script
   if (!mHadOriginalOpener && !nsContentUtils::IsCallerTrustedForWrite()) {
     PRBool allowClose =
-      nsContentUtils::GetBoolPref("dom.allow_scripts_to_close_windows",
-                                  PR_TRUE);
+      Preferences::GetBool("dom.allow_scripts_to_close_windows", PR_TRUE);
     if (!allowClose) {
       // We're blocking the close operation
       // report localized error msg in JS console
       nsContentUtils::ReportToConsole(
           nsContentUtils::eDOM_PROPERTIES,
           "WindowCloseBlockedWarning",
           nsnull, 0, // No params
           nsnull,
@@ -7839,18 +7840,19 @@ nsresult
 nsGlobalWindow::DispatchSyncPopState()
 {
   FORWARD_TO_INNER(DispatchSyncPopState, (), NS_OK);
 
   NS_ASSERTION(nsContentUtils::IsSafeToRunScript(),
                "Must be safe to run script here.");
 
   // Check that PopState hasn't been pref'ed off.
-  if (!nsContentUtils::GetBoolPref(sPopStatePrefStr, PR_FALSE))
+  if (!Preferences::GetBool(sPopStatePrefStr, PR_FALSE)) {
     return NS_OK;
+  }
 
   nsresult rv = NS_OK;
 
   // Bail if the window is frozen.
   if (IsFrozen()) {
     return NS_OK;
   }
 
@@ -8017,17 +8019,17 @@ nsGlobalWindow::GetSessionStorage(nsIDOM
   nsIPrincipal *principal = GetPrincipal();
   nsIDocShell* docShell = GetDocShell();
 
   if (!principal || !docShell) {
     *aSessionStorage = nsnull;
     return NS_OK;
   }
 
-  if (!nsContentUtils::GetBoolPref(kStorageEnabled)) {
+  if (!Preferences::GetBool(kStorageEnabled)) {
     *aSessionStorage = nsnull;
     return NS_OK;
   }
 
   if (mSessionStorage) {
 #ifdef PR_LOGGING
     if (PR_LOG_TEST(gDOMLeakPRLog, PR_LOG_DEBUG)) {
       PR_LogPrint("nsGlobalWindow %p has %p sessionStorage", this, mSessionStorage.get());
@@ -8081,17 +8083,17 @@ nsGlobalWindow::GetSessionStorage(nsIDOM
 }
 
 NS_IMETHODIMP
 nsGlobalWindow::GetGlobalStorage(nsIDOMStorageList ** aGlobalStorage)
 {
   NS_ENSURE_ARG_POINTER(aGlobalStorage);
 
 #ifdef MOZ_STORAGE
-  if (!nsContentUtils::GetBoolPref(kStorageEnabled)) {
+  if (!Preferences::GetBool(kStorageEnabled)) {
     *aGlobalStorage = nsnull;
     return NS_OK;
   }
 
   if (!sGlobalStorageList) {
     nsresult rv = NS_NewDOMStorageList(&sGlobalStorageList);
     NS_ENSURE_SUCCESS(rv, rv);
   }
@@ -8107,17 +8109,17 @@ nsGlobalWindow::GetGlobalStorage(nsIDOMS
 
 NS_IMETHODIMP
 nsGlobalWindow::GetLocalStorage(nsIDOMStorage ** aLocalStorage)
 {
   FORWARD_TO_INNER(GetLocalStorage, (aLocalStorage), NS_ERROR_UNEXPECTED);
 
   NS_ENSURE_ARG(aLocalStorage);
 
-  if (!nsContentUtils::GetBoolPref(kStorageEnabled)) {
+  if (!Preferences::GetBool(kStorageEnabled)) {
     *aLocalStorage = nsnull;
     return NS_OK;
   }
 
   if (!mLocalStorage) {
     *aLocalStorage = nsnull;
 
     nsresult rv;
@@ -10062,16 +10064,23 @@ nsGlobalWindow::GetURL(nsIDOMMozURLPrope
     mURLProperty = new nsDOMMozURLProperty(this);
   }
 
   NS_ADDREF(*aURL = mURLProperty);
 
   return NS_OK;
 }
 
+// static
+bool
+nsGlobalWindow::HasIndexedDBSupport()
+{
+  return Preferences::GetBool("indexedDB.feature.enabled", PR_TRUE);
+}
+
 // nsGlobalChromeWindow implementation
 
 NS_IMPL_CYCLE_COLLECTION_CLASS(nsGlobalChromeWindow)
 NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(nsGlobalChromeWindow,
                                                   nsGlobalWindow)
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mBrowserDOMWindow)
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mMessageManager)
 NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
@@ -10970,17 +10979,17 @@ nsNavigator::RefreshMIMEArray()
   if (mMimeTypes)
     rv = mMimeTypes->Refresh();
   return rv;
 }
 
 bool
 nsNavigator::HasDesktopNotificationSupport()
 {
-  return nsContentUtils::GetBoolPref("notification.feature.enabled", PR_FALSE);
+  return Preferences::GetBool("notification.feature.enabled", PR_FALSE);
 }
 
 //*****************************************************************************
 //    nsNavigator::nsIDOMClientInformation
 //*****************************************************************************
 
 NS_IMETHODIMP
 nsNavigator::RegisterContentHandler(const nsAString& aMIMEType, 
--- a/dom/base/nsGlobalWindow.h
+++ b/dom/base/nsGlobalWindow.h
@@ -104,17 +104,16 @@
 #include "nsIDOMStorageIndexedDB.h"
 #include "nsIDOMOfflineResourceList.h"
 #include "nsPIDOMEventTarget.h"
 #include "nsIArray.h"
 #include "nsIContent.h"
 #include "nsIIDBFactory.h"
 #include "nsFrameMessageManager.h"
 #include "mozilla/TimeStamp.h"
-#include "nsContentUtils.h"
 
 // JS includes
 #include "jsapi.h"
 #include "jswrapper.h"
 
 #define DEFAULT_HOME_PAGE "www.mozilla.org"
 #define PREF_BROWSER_STARTUP_HOMEPAGE "browser.startup.homepage"
 
@@ -563,19 +562,17 @@ public:
   virtual PRUint32 GetSerial() {
     return mSerial;
   }
 
   static nsGlobalWindow* GetOuterWindowWithId(PRUint64 aWindowID) {
     return sOuterWindowsById ? sOuterWindowsById->Get(aWindowID) : nsnull;
   }
 
-  static bool HasIndexedDBSupport() {
-    return nsContentUtils::GetBoolPref("indexedDB.feature.enabled", PR_TRUE);
-  }
+  static bool HasIndexedDBSupport();
 
 private:
   // Enable updates for the accelerometer.
   void EnableAccelerationUpdates();
 
   // Disables updates for the accelerometer.
   void DisableAccelerationUpdates();
 
--- a/dom/base/nsGlobalWindowCommands.cpp
+++ b/dom/base/nsGlobalWindowCommands.cpp
@@ -39,17 +39,17 @@
 
 #include "nsGlobalWindowCommands.h"
 
 #include "nsIComponentManager.h"
 #include "nsIInterfaceRequestor.h"
 #include "nsIInterfaceRequestorUtils.h"
 #include "nsCRT.h"
 #include "nsString.h"
-#include "nsContentUtils.h"
+#include "mozilla/Preferences.h"
 
 #include "nsIControllerCommandTable.h"
 #include "nsICommandParams.h"
 
 #include "nsPIDOMWindow.h"
 #include "nsIPresShell.h"
 #include "nsIDocShell.h"
 #include "nsIDocShellTreeItem.h"
@@ -59,16 +59,18 @@
 #include "nsIContentViewer.h"
 #include "nsFocusManager.h"
 #include "nsCopySupport.h"
 #include "nsGUIEvent.h"
 
 #include "nsIClipboardDragDropHooks.h"
 #include "nsIClipboardDragDropHookList.h"
 
+using namespace mozilla;
+
 const char * const sSelectAllString = "cmd_selectAll";
 const char * const sSelectNoneString = "cmd_selectNone";
 const char * const sCopyImageLocationString = "cmd_copyImageLocation";
 const char * const sCopyImageContentsString = "cmd_copyImageContents";
 const char * const sCopyImageString = "cmd_copyImage";
 
 const char * const sScrollTopString = "cmd_scrollTop";
 const char * const sScrollBottomString = "cmd_scrollBottom";
@@ -241,17 +243,17 @@ nsSelectMoveScrollCommand::DoSelectComma
   NS_ENSURE_TRUE(selCont, NS_ERROR_NOT_INITIALIZED);       
 
   // We allow the caret to be moved with arrow keys on any window for which
   // the caret is enabled. In particular, this includes caret-browsing mode
   // in non-chrome documents.
   PRBool caretOn = PR_FALSE;
   selCont->GetCaretEnabled(&caretOn);
   if (!caretOn) {
-    caretOn = nsContentUtils::GetBoolPref("accessibility.browsewithcaret");
+    caretOn = Preferences::GetBool("accessibility.browsewithcaret");
     if (caretOn) {
       nsCOMPtr<nsPIDOMWindow> piWindow = do_QueryInterface(aWindow);
       if (piWindow) {
         nsCOMPtr<nsIDocShellTreeItem> dsti = do_QueryInterface(piWindow->GetDocShell());
         if (dsti) {
           PRInt32 itemType;
           dsti->GetItemType(&itemType);
           if (itemType == nsIDocShellTreeItem::typeChrome) {
--- a/dom/base/nsHistory.cpp
+++ b/dom/base/nsHistory.cpp
@@ -55,16 +55,19 @@
 #include "nsIServiceManager.h"
 #include "nsIInterfaceRequestorUtils.h"
 #include "nsXPIDLString.h"
 #include "nsReadableUtils.h"
 #include "nsDOMClassInfo.h"
 #include "nsContentUtils.h"
 #include "nsIDOMNSDocument.h"
 #include "nsISHistoryInternal.h"
+#include "mozilla/Preferences.h"
+
+using namespace mozilla;
 
 static const char* sAllowPushStatePrefStr  =
   "browser.history.allowPushState";
 static const char* sAllowReplaceStatePrefStr =
   "browser.history.allowReplaceState";
 
 //
 //  History class implementation 
@@ -282,18 +285,19 @@ nsHistory::Go(PRInt32 aDelta)
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsHistory::PushState(nsIVariant *aData, const nsAString& aTitle,
                      const nsAString& aURL, JSContext* aCx)
 {
   // Check that PushState hasn't been pref'ed off.
-  if (!nsContentUtils::GetBoolPref(sAllowPushStatePrefStr, PR_FALSE))
+  if (!Preferences::GetBool(sAllowPushStatePrefStr, PR_FALSE)) {
     return NS_OK;
+  }
 
   nsCOMPtr<nsPIDOMWindow> win(do_QueryReferent(mInnerWindow));
   if (!win)
     return NS_ERROR_NOT_AVAILABLE;
 
   if (!nsContentUtils::CanCallerAccess(win->GetOuterWindow()))
     return NS_ERROR_DOM_SECURITY_ERR;
 
@@ -311,18 +315,19 @@ nsHistory::PushState(nsIVariant *aData, 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsHistory::ReplaceState(nsIVariant *aData, const nsAString& aTitle,
                         const nsAString& aURL, JSContext* aCx)
 {
   // Check that ReplaceState hasn't been pref'ed off
-  if (!nsContentUtils::GetBoolPref(sAllowReplaceStatePrefStr, PR_FALSE))
+  if (!Preferences::GetBool(sAllowReplaceStatePrefStr, PR_FALSE)) {
     return NS_OK;
+  }
 
   nsCOMPtr<nsPIDOMWindow> win(do_QueryReferent(mInnerWindow));
   if (!win)
     return NS_ERROR_NOT_AVAILABLE;
 
   if (!nsContentUtils::CanCallerAccess(win->GetOuterWindow()))
     return NS_ERROR_DOM_SECURITY_ERR;
 
--- a/dom/base/nsJSEnvironment.cpp
+++ b/dom/base/nsJSEnvironment.cpp
@@ -111,16 +111,17 @@
 #ifdef MOZ_LOGGING
 // Force PR_LOGGING so we can get JS strict warnings even in release builds
 #define FORCE_PR_LOG 1
 #endif
 #include "prlog.h"
 #include "prthread.h"
 
 #include "mozilla/FunctionTimer.h"
+#include "mozilla/Preferences.h"
 
 using namespace mozilla;
 
 const size_t gStackSize = 8192;
 
 #ifdef PR_LOGGING
 static PRLogModuleInfo* gJSDiagnostics;
 #endif
@@ -921,39 +922,39 @@ static const char js_memlog_option_str[]
 
 int
 nsJSContext::JSOptionChangedCallback(const char *pref, void *data)
 {
   nsJSContext *context = reinterpret_cast<nsJSContext *>(data);
   PRUint32 oldDefaultJSOptions = context->mDefaultJSOptions;
   PRUint32 newDefaultJSOptions = oldDefaultJSOptions;
 
-  sPostGCEventsToConsole = nsContentUtils::GetBoolPref(js_memlog_option_str);
-
-  PRBool strict = nsContentUtils::GetBoolPref(js_strict_option_str);
+  sPostGCEventsToConsole = Preferences::GetBool(js_memlog_option_str);
+
+  PRBool strict = Preferences::GetBool(js_strict_option_str);
   if (strict)
     newDefaultJSOptions |= JSOPTION_STRICT;
   else
     newDefaultJSOptions &= ~JSOPTION_STRICT;
 
   nsIScriptGlobalObject *global = context->GetGlobalObject();
   // XXX should we check for sysprin instead of a chrome window, to make
   // XXX components be covered by the chrome pref instead of the content one?
   nsCOMPtr<nsIDOMChromeWindow> chromeWindow(do_QueryInterface(global));
 
-  PRBool useTraceJIT = nsContentUtils::GetBoolPref(chromeWindow ?
-                                                   js_tracejit_chrome_str :
-                                                   js_tracejit_content_str);
-  PRBool useMethodJIT = nsContentUtils::GetBoolPref(chromeWindow ?
-                                                    js_methodjit_chrome_str :
-                                                    js_methodjit_content_str);
-  PRBool useProfiling = nsContentUtils::GetBoolPref(chromeWindow ?
-                                                    js_profiling_chrome_str :
-                                                    js_profiling_content_str);
-  PRBool useMethodJITAlways = nsContentUtils::GetBoolPref(js_methodjit_always_str);
+  PRBool useTraceJIT = Preferences::GetBool(chromeWindow ?
+                                              js_tracejit_chrome_str :
+                                              js_tracejit_content_str);
+  PRBool useMethodJIT = Preferences::GetBool(chromeWindow ?
+                                               js_methodjit_chrome_str :
+                                               js_methodjit_content_str);
+  PRBool useProfiling = Preferences::GetBool(chromeWindow ?
+                                               js_profiling_chrome_str :
+                                               js_profiling_content_str);
+  PRBool useMethodJITAlways = Preferences::GetBool(js_methodjit_always_str);
   nsCOMPtr<nsIXULRuntime> xr = do_GetService(XULRUNTIME_SERVICE_CONTRACTID);
   if (xr) {
     PRBool safeMode = PR_FALSE;
     xr->GetInSafeMode(&safeMode);
     if (safeMode) {
       useTraceJIT = PR_FALSE;
       useMethodJIT = PR_FALSE;
       useProfiling = PR_FALSE;
@@ -979,32 +980,32 @@ nsJSContext::JSOptionChangedCallback(con
   if (useMethodJITAlways)
     newDefaultJSOptions |= JSOPTION_METHODJIT_ALWAYS;
   else
     newDefaultJSOptions &= ~JSOPTION_METHODJIT_ALWAYS;
 
 #ifdef DEBUG
   // In debug builds, warnings are enabled in chrome context if
   // javascript.options.strict.debug is true
-  PRBool strictDebug = nsContentUtils::GetBoolPref(js_strict_debug_option_str);
+  PRBool strictDebug = Preferences::GetBool(js_strict_debug_option_str);
   // Note this callback is also called from context's InitClasses thus we don't
   // need to enable this directly from InitContext
   if (strictDebug && (newDefaultJSOptions & JSOPTION_STRICT) == 0) {
     if (chromeWindow)
       newDefaultJSOptions |= JSOPTION_STRICT;
   }
 #endif
 
-  PRBool werror = nsContentUtils::GetBoolPref(js_werror_option_str);
+  PRBool werror = Preferences::GetBool(js_werror_option_str);
   if (werror)
     newDefaultJSOptions |= JSOPTION_WERROR;
   else
     newDefaultJSOptions &= ~JSOPTION_WERROR;
 
-  PRBool relimit = nsContentUtils::GetBoolPref(js_relimit_option_str);
+  PRBool relimit = Preferences::GetBool(js_relimit_option_str);
   if (relimit)
     newDefaultJSOptions |= JSOPTION_RELIMIT;
   else
     newDefaultJSOptions &= ~JSOPTION_RELIMIT;
 
   ::JS_SetOptions(context->mContext, newDefaultJSOptions & JSRUNOPTION_MASK);
 
   // Save the new defaults for the next page load (InitContext).
@@ -3624,17 +3625,17 @@ MaxScriptRunTimePrefChangedCallback(cons
   }
 
   return 0;
 }
 
 static int
 ReportAllJSExceptionsPrefChangedCallback(const char* aPrefName, void* aClosure)
 {
-  PRBool reportAll = nsContentUtils::GetBoolPref(aPrefName, PR_FALSE);
+  PRBool reportAll = Preferences::GetBool(aPrefName, PR_FALSE);
   nsContentUtils::XPConnect()->SetReportAllJSExceptions(reportAll);
   return 0;
 }
 
 static int
 SetMemoryHighWaterMarkPrefChangedCallback(const char* aPrefName, void* aClosure)
 {
   PRInt32 highwatermark = nsContentUtils::GetIntPref(aPrefName, 128);
@@ -3652,17 +3653,17 @@ SetMemoryMaxPrefChangedCallback(const ch
   PRUint32 max = (pref <= 0 || pref >= 0x1000) ? -1 : (PRUint32)pref * 1024 * 1024;
   JS_SetGCParameter(nsJSRuntime::sRuntime, JSGC_MAX_BYTES, max);
   return 0;
 }
 
 static int
 SetMemoryGCModePrefChangedCallback(const char* aPrefName, void* aClosure)
 {
-  PRBool enableCompartmentGC = nsContentUtils::GetBoolPref(aPrefName);
+  PRBool enableCompartmentGC = Preferences::GetBool(aPrefName);
   JS_SetGCParameter(nsJSRuntime::sRuntime, JSGC_MODE, enableCompartmentGC
                                                       ? JSGC_MODE_COMPARTMENT
                                                       : JSGC_MODE_GLOBAL);
   return 0;
 }
 
 static JSPrincipals *
 ObjectPrincipalFinder(JSContext *cx, JSObject *obj)
--- a/dom/indexedDB/CheckPermissionsHelper.cpp
+++ b/dom/indexedDB/CheckPermissionsHelper.cpp
@@ -46,37 +46,39 @@
 #include "nsIScriptObjectPrincipal.h"
 #include "nsIURI.h"
 
 #include "nsContentUtils.h"
 #include "nsDOMStorage.h"
 #include "nsNetUtil.h"
 #include "nsThreadUtils.h"
 #include "mozilla/Services.h"
+#include "mozilla/Preferences.h"
 
 #include "IndexedDatabaseManager.h"
 
 #define PERMISSION_INDEXEDDB "indexedDB"
 #define PREF_INDEXEDDB_ENABLED "dom.indexedDB.enabled"
 #define TOPIC_PERMISSIONS_PROMPT "indexedDB-permissions-prompt"
 #define TOPIC_PERMISSIONS_RESPONSE "indexedDB-permissions-response"
 
+using namespace mozilla;
 USING_INDEXEDDB_NAMESPACE
 using namespace mozilla::services;
 
 namespace {
 
 inline
 PRUint32
 GetIndexedDBPermissions(const nsACString& aASCIIOrigin,
                         nsIDOMWindow* aWindow)
 {
   NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
 
-  if (!nsContentUtils::GetBoolPref(PREF_INDEXEDDB_ENABLED)) {
+  if (!Preferences::GetBool(PREF_INDEXEDDB_ENABLED)) {
     return nsIPermissionManager::DENY_ACTION;
   }
 
   nsCOMPtr<nsIScriptObjectPrincipal> sop(do_QueryInterface(aWindow));
   NS_ENSURE_TRUE(sop, nsIPermissionManager::DENY_ACTION);
 
   if (nsContentUtils::IsSystemPrincipal(sop->GetPrincipal())) {
     return nsIPermissionManager::ALLOW_ACTION;
--- a/dom/src/geolocation/nsGeolocation.cpp
+++ b/dom/src/geolocation/nsGeolocation.cpp
@@ -67,16 +67,17 @@
 #include "nsIPermissionManager.h"
 #include "nsIObserverService.h"
 #include "nsIPrefService.h"
 #include "nsIPrefBranch2.h"
 #include "nsIJSContextStack.h"
 #include "nsThreadUtils.h"
 #include "mozilla/Services.h"
 #include "mozilla/unused.h"
+#include "mozilla/Preferences.h"
 
 #include <math.h>
 
 #ifdef MOZ_MAEMO_LIBLOCATION
 #include "MaemoLocationProvider.h"
 #endif
 
 #ifdef ANDROID
@@ -86,16 +87,17 @@
 #include "nsIDOMDocument.h"
 #include "nsIDocument.h"
 
 // Some limit to the number of get or watch geolocation requests
 // that a window can make.
 #define MAX_GEO_REQUESTS_PER_WINDOW  1500
 
 using mozilla::unused;          // <snicker>
+using namespace mozilla;
 using namespace mozilla::dom;
 
 class RequestPromptEvent : public nsRunnable
 {
 public:
   RequestPromptEvent(nsGeolocationRequest* request)
     : mRequest(request)
   {
@@ -494,25 +496,25 @@ NS_IMPL_THREADSAFE_RELEASE(nsGeolocation
 
 
 static PRBool sGeoEnabled = PR_TRUE;
 static PRBool sGeoIgnoreLocationFilter = PR_FALSE;
 
 static int
 GeoEnabledChangedCallback(const char *aPrefName, void *aClosure)
 {
-  sGeoEnabled = nsContentUtils::GetBoolPref("geo.enabled", PR_TRUE);
+  sGeoEnabled = Preferences::GetBool("geo.enabled", PR_TRUE);
   return 0;
 }
 
 static int
 GeoIgnoreLocationFilterChangedCallback(const char *aPrefName, void *aClosure)
 {
-  sGeoIgnoreLocationFilter = nsContentUtils::GetBoolPref("geo.ignore.location_filter",
-                                                         PR_TRUE);
+  sGeoIgnoreLocationFilter =
+    Preferences::GetBool("geo.ignore.location_filter", PR_TRUE);
   return 0;
 }
 
 
 nsresult nsGeolocationService::Init()
 {
   mTimeout = nsContentUtils::GetIntPref("geo.timeout", 6000);
 
@@ -1048,19 +1050,20 @@ nsGeolocation::RegisterRequestWithPrompt
 
     nsCString type = NS_LITERAL_CSTRING("geolocation");
     child->SendPContentPermissionRequestConstructor(request, type, IPC::URI(mURI));
     
     request->Sendprompt();
     return true;
   }
 
-  if (nsContentUtils::GetBoolPref("geo.prompt.testing", PR_FALSE))
-  {
-    nsCOMPtr<nsIRunnable> ev  = new RequestAllowEvent(nsContentUtils::GetBoolPref("geo.prompt.testing.allow", PR_FALSE), request);
+  if (Preferences::GetBool("geo.prompt.testing", PR_FALSE)) {
+    nsCOMPtr<nsIRunnable> ev =
+      new RequestAllowEvent(Preferences::GetBool("geo.prompt.testing.allow",
+                                                 PR_FALSE), request);
     NS_DispatchToMainThread(ev);
     return true;
   }
 
   nsCOMPtr<nsIRunnable> ev  = new RequestPromptEvent(request);
   NS_DispatchToMainThread(ev);
   return true;
 }
--- a/dom/src/notification/nsDesktopNotification.cpp
+++ b/dom/src/notification/nsDesktopNotification.cpp
@@ -36,17 +36,19 @@
 
 #include "nsDesktopNotification.h"
 
 #include "nsContentPermissionHelper.h"
 #include "nsXULAppAPI.h"
 
 #include "mozilla/dom/PBrowserChild.h"
 #include "TabChild.h"
+#include "mozilla/Preferences.h"
 
+using namespace mozilla;
 using namespace mozilla::dom;
 
 /* ------------------------------------------------------------------------ */
 /* AlertServiceObserver                                                     */
 /* ------------------------------------------------------------------------ */
 
 NS_IMPL_ISUPPORTS1(AlertServiceObserver, nsIObserver)
 
@@ -104,23 +106,24 @@ nsDOMDesktopNotification::nsDOMDesktopNo
   , mIconURL(iconURL)
   , mURI(uri)
   , mAllow(PR_FALSE)
   , mShowHasBeenCalled(PR_FALSE)
 {
   mOwner = aWindow;
   mScriptContext = aScriptContext;
 
-  if (nsContentUtils::GetBoolPref("notification.disabled", PR_FALSE))
+  if (Preferences::GetBool("notification.disabled", PR_FALSE)) {
     return;
+  }
 
   // If we are in testing mode (running mochitests, for example)
   // and we are suppose to allow requests, then just post an allow event.
-  if (nsContentUtils::GetBoolPref("notification.prompt.testing", PR_FALSE) &&
-      nsContentUtils::GetBoolPref("notification.prompt.testing.allow", PR_TRUE)) {
+  if (Preferences::GetBool("notification.prompt.testing", PR_FALSE) &&
+      Preferences::GetBool("notification.prompt.testing.allow", PR_TRUE)) {
     mAllow = PR_TRUE;
     return;
   }
 
   nsRefPtr<nsDesktopNotificationRequest> request = new nsDesktopNotificationRequest(this);
 
   // if we are in the content process, then remote it to the parent.
   if (XRE_GetProcessType() == GeckoProcessType_Content) {
--- a/dom/src/storage/nsDOMStorage.cpp
+++ b/dom/src/storage/nsDOMStorage.cpp
@@ -66,16 +66,19 @@ using mozilla::dom::StorageChild;
 #include "nsIPermissionManager.h"
 #include "nsCycleCollectionParticipant.h"
 #include "nsIOfflineCacheUpdate.h"
 #include "nsIJSContextStack.h"
 #include "nsIPrivateBrowsingService.h"
 #include "nsDOMString.h"
 #include "nsNetCID.h"
 #include "nsIProxyObjectManager.h"
+#include "mozilla/Preferences.h"
+
+using namespace mozilla;
 
 static const PRUint32 ASK_BEFORE_ACCEPT = 1;
 static const PRUint32 ACCEPT_SESSION = 2;
 static const PRUint32 BEHAVIOR_REJECT = 2;
 
 static const PRUint32 DEFAULT_QUOTA = 5 * 1024;
 // Be generous with offline apps by default...
 static const PRUint32 DEFAULT_OFFLINE_APP_QUOTA = 200 * 1024;
@@ -1454,18 +1457,19 @@ nsDOMStorage::InitAsGlobalStorage(const 
 PRBool
 nsDOMStorage::CanUseStorage(PRPackedBool* aSessionOnly)
 {
   // check if the calling domain can use storage. Downgrade to session
   // only if only session storage may be used.
   NS_ASSERTION(aSessionOnly, "null session flag");
   *aSessionOnly = PR_FALSE;
 
-  if (!nsContentUtils::GetBoolPref(kStorageEnabled))
+  if (!Preferences::GetBool(kStorageEnabled)) {
     return PR_FALSE;
+  }
 
   // chrome can always use storage regardless of permission preferences
   if (nsContentUtils::IsCallerChrome())
     return PR_TRUE;
 
   nsCOMPtr<nsIPrincipal> subjectPrincipal;
   nsContentUtils::GetSecurityManager()->
     GetSubjectPrincipal(getter_AddRefs(subjectPrincipal));
--- a/layout/base/nsCaret.cpp
+++ b/layout/base/nsCaret.cpp
@@ -63,27 +63,30 @@
 #include "nsISelectionController.h"
 #include "nsDisplayList.h"
 #include "nsCaret.h"
 #include "nsTextFrame.h"
 #include "nsXULPopupManager.h"
 #include "nsMenuPopupFrame.h"
 #include "nsTextFragment.h"
 #include "nsThemeConstants.h"
+#include "mozilla/Preferences.h"
 
 // The bidi indicator hangs off the caret to one side, to show which
 // direction the typing is in. It needs to be at least 2x2 to avoid looking like 
 // an insignificant dot
 static const PRInt32 kMinBidiIndicatorPixels = 2;
 
 #ifdef IBMBIDI
 #include "nsIBidiKeyboard.h"
 #include "nsContentUtils.h"
 #endif //IBMBIDI
 
+using namespace mozilla;
+
 /**
  * Find the first frame in an in-order traversal of the frame subtree rooted
  * at aFrame which is either a text frame logically at the end of a line,
  * or which is aStopAtFrame. Return null if no such frame is found. We don't
  * descend into the children of non-eLineParticipant frames.
  */
 static nsIFrame*
 CheckForTrailingTextFrameRecursive(nsIFrame* aFrame, nsIFrame* aStopAtFrame)
@@ -220,17 +223,17 @@ nsresult nsCaret::Init(nsIPresShell *inP
   mDomSelectionWeak = do_GetWeakReference(domSelection);
   
   // set up the blink timer
   if (mVisible)
   {
     StartBlinking();
   }
 #ifdef IBMBIDI
-  mBidiUI = nsContentUtils::GetBoolPref("bidi.browser.ui");
+  mBidiUI = Preferences::GetBool("bidi.browser.ui");
 #endif
 
   return NS_OK;
 }
 
 static PRBool
 DrawCJKCaret(nsIFrame* aFrame, PRInt32 aOffset)
 {
--- a/layout/base/nsPresContext.cpp
+++ b/layout/base/nsPresContext.cpp
@@ -107,16 +107,17 @@
 #endif // MOZ_SMIL
 
 #ifdef IBMBIDI
 #include "nsBidiPresUtils.h"
 #endif // IBMBIDI
 
 #include "nsContentUtils.h"
 #include "nsPIWindowRoot.h"
+#include "mozilla/Preferences.h"
 
 // Needed for Start/Stop of Image Animation
 #include "imgIContainer.h"
 #include "nsIImageLoadingContent.h"
 
 //needed for resetting of image service color
 #include "nsLayoutCID.h"
 
@@ -598,18 +599,17 @@ nsPresContext::GetDocumentColorPreferenc
     else {
       mLookAndFeel->GetMetric(nsILookAndFeel::eMetric_UseAccessibilityTheme, useAccessibilityTheme);
       usePrefColors = !useAccessibilityTheme;
     }
 
   }
   if (usePrefColors) {
     usePrefColors =
-      !nsContentUtils::GetBoolPref("browser.display.use_system_colors",
-                                   PR_FALSE);
+      !Preferences::GetBool("browser.display.use_system_colors", PR_FALSE);
   }
 
   if (usePrefColors) {
     nsAdoptingCString colorStr =
       nsContentUtils::GetCharPref("browser.display.foreground_color");
 
     if (!colorStr.IsEmpty()) {
       mDefaultColor = MakeColorPref(colorStr);
@@ -632,18 +632,18 @@ nsPresContext::GetDocumentColorPreferenc
   }
 
   // Wherever we got the default background color from, ensure it is
   // opaque.
   mBackgroundColor = NS_ComposeColors(NS_RGB(0xFF, 0xFF, 0xFF),
                                       mBackgroundColor);
 
   mUseDocumentColors = !useAccessibilityTheme &&
-    nsContentUtils::GetBoolPref("browser.display.use_document_colors",
-                                mUseDocumentColors);
+    Preferences::GetBool("browser.display.use_document_colors",
+                         mUseDocumentColors);
 }
 
 void
 nsPresContext::GetUserPreferences()
 {
   if (!GetPresShell()) {
     // No presshell means nothing to do here.  We'll do this when we
     // get a presshell.
@@ -657,22 +657,22 @@ nsPresContext::GetUserPreferences()
 
   mAutoQualityMinFontSizePixelsPref =
     nsContentUtils::GetIntPref("browser.display.auto_quality_min_font_size");
 
   // * document colors
   GetDocumentColorPreferences();
 
   mSendAfterPaintToContent =
-    nsContentUtils::GetBoolPref("dom.send_after_paint_to_content",
-                                mSendAfterPaintToContent);
+    Preferences::GetBool("dom.send_after_paint_to_content",
+                         mSendAfterPaintToContent);
 
   // * link colors
   mUnderlineLinks =
-    nsContentUtils::GetBoolPref("browser.underline_anchors", mUnderlineLinks);
+    Preferences::GetBool("browser.underline_anchors", mUnderlineLinks);
 
   nsAdoptingCString colorStr =
     nsContentUtils::GetCharPref("browser.anchor_color");
 
   if (!colorStr.IsEmpty()) {
     mLinkColor = MakeColorPref(colorStr);
   }
 
@@ -685,18 +685,17 @@ nsPresContext::GetUserPreferences()
 
   colorStr = nsContentUtils::GetCharPref("browser.visited_color");
 
   if (!colorStr.IsEmpty()) {
     mVisitedLinkColor = MakeColorPref(colorStr);
   }
 
   mUseFocusColors =
-    nsContentUtils::GetBoolPref("browser.display.use_focus_colors",
-                                mUseFocusColors);
+    Preferences::GetBool("browser.display.use_focus_colors", mUseFocusColors);
 
   mFocusTextColor = mDefaultColor;
   mFocusBackgroundColor = mBackgroundColor;
 
   colorStr = nsContentUtils::GetCharPref("browser.display.focus_text_color");
 
   if (!colorStr.IsEmpty()) {
     mFocusTextColor = MakeColorPref(colorStr);
@@ -709,29 +708,29 @@ nsPresContext::GetUserPreferences()
     mFocusBackgroundColor = MakeColorPref(colorStr);
   }
 
   mFocusRingWidth =
     nsContentUtils::GetIntPref("browser.display.focus_ring_width",
                                mFocusRingWidth);
 
   mFocusRingOnAnything =
-    nsContentUtils::GetBoolPref("browser.display.focus_ring_on_anything",
-                                mFocusRingOnAnything);
+    Preferences::GetBool("browser.display.focus_ring_on_anything",
+                         mFocusRingOnAnything);
 
   mFocusRingStyle =
           nsContentUtils::GetIntPref("browser.display.focus_ring_style",
                                       mFocusRingStyle);
   // * use fonts?
   mUseDocumentFonts =
     nsContentUtils::GetIntPref("browser.display.use_document_fonts") != 0;
 
   // * replace backslashes with Yen signs? (bug 245770)
   mEnableJapaneseTransform =
-    nsContentUtils::GetBoolPref("layout.enable_japanese_specific_transform");
+    Preferences::GetBool("layout.enable_japanese_specific_transform");
 
   mPrefScrollbarSide =
     nsContentUtils::GetIntPref("layout.scrollbar.side");
 
   GetFontPreferences();
 
   // * image animation
   const nsAdoptingCString& animatePref =
--- a/layout/base/nsPresShell.cpp
+++ b/layout/base/nsPresShell.cpp
@@ -204,16 +204,17 @@
 #include "nsCanvasFrame.h"
 
 // Content viewer interfaces
 #include "nsIContentViewer.h"
 #include "imgIEncoder.h"
 #include "gfxPlatform.h"
 
 #include "mozilla/FunctionTimer.h"
+#include "mozilla/Preferences.h"
 
 #include "Layers.h"
 
 #ifdef NS_FUNCTION_TIMER
 #define NS_TIME_FUNCTION_DECLARE_DOCURL                \
   nsCAutoString docURL__("N/A");                       \
   nsIURI *uri__ = mDocument->GetDocumentURI();         \
   if (uri__) uri__->GetSpec(docURL__);
@@ -1880,23 +1881,23 @@ PresShell::Init(nsIDocument* aDocument,
   }
 
   // cache the drag service so we can check it during reflows
   mDragService = do_GetService("@mozilla.org/widget/dragservice;1");
 
 #ifdef MOZ_REFLOW_PERF
     if (mReflowCountMgr) {
       PRBool paintFrameCounts =
-        nsContentUtils::GetBoolPref("layout.reflow.showframecounts");
+        Preferences::GetBool("layout.reflow.showframecounts");
 
       PRBool dumpFrameCounts =
-        nsContentUtils::GetBoolPref("layout.reflow.dumpframecounts");
+        Preferences::GetBool("layout.reflow.dumpframecounts");
 
       PRBool dumpFrameByFrameCounts =
-        nsContentUtils::GetBoolPref("layout.reflow.dumpframebyframecounts");
+        Preferences::GetBool("layout.reflow.dumpframebyframecounts");
 
       mReflowCountMgr->SetDumpFrameCounts(dumpFrameCounts);
       mReflowCountMgr->SetDumpFrameByFrameCounts(dumpFrameByFrameCounts);
       mReflowCountMgr->SetPaintFrameCounts(paintFrameCounts);
     }
 #endif
 
 #ifdef MOZ_SMIL
@@ -3915,17 +3916,17 @@ PresShell::GoToAnchor(const nsAString& a
       if (rootScroll) {
         mLastAnchorScrolledTo = content;
         mLastAnchorScrollPositionY = rootScroll->GetScrollPosition().y;
       }
     }
 
     // Should we select the target? This action is controlled by a
     // preference: the default is to not select.
-    PRBool selectAnchor = nsContentUtils::GetBoolPref("layout.selectanchor");
+    PRBool selectAnchor = Preferences::GetBool("layout.selectanchor");
 
     // Even if select anchor pref is false, we must still move the
     // caret there. That way tabbing will start from the new
     // location
     nsCOMPtr<nsIDOMRange> jumpToRange = do_CreateInstance(kRangeCID);
     if (jumpToRange) {
       while (content && content->GetChildCount() > 0) {
         content = content->GetChildAt(0);
--- a/layout/forms/nsComboboxControlFrame.cpp
+++ b/layout/forms/nsComboboxControlFrame.cpp
@@ -85,18 +85,19 @@
 #include "nsNodeInfoManager.h"
 #include "nsContentCreatorFunctions.h"
 #include "nsLayoutUtils.h"
 #include "nsDisplayList.h"
 #include "nsITheme.h"
 #include "nsThemeConstants.h"
 #include "nsPLDOMEvent.h"
 #include "nsRenderingContext.h"
+#include "mozilla/Preferences.h"
 
-namespace dom = mozilla::dom;
+using namespace mozilla;
 
 NS_IMETHODIMP
 nsComboboxControlFrame::RedisplayTextEvent::Run()
 {
   if (mControlFrame)
     mControlFrame->HandleRedisplayTextEvent();
   return NS_OK;
 }
@@ -1513,11 +1514,11 @@ nsComboboxControlFrame::RestoreState(nsP
 //
 // Also, Fennec use a custom combobox built-in widget
 // 
 
 /* static */
 PRBool
 nsComboboxControlFrame::ToolkitHasNativePopup()
 {
-  return nsContentUtils::GetBoolPref("ui.use_native_popup_windows");
+  return Preferences::GetBool("ui.use_native_popup_windows");
 }
 
--- a/layout/generic/nsFrame.cpp
+++ b/layout/generic/nsFrame.cpp
@@ -125,16 +125,18 @@
 #include "nsSVGIntegrationUtils.h"
 #include "nsSVGEffects.h"
 #endif
 
 #include "gfxContext.h"
 #include "CSSCalc.h"
 #include "nsAbsoluteContainingBlock.h"
 
+#include "mozilla/Preferences.h"
+
 using namespace mozilla;
 using namespace mozilla::layers;
 
 static NS_DEFINE_CID(kLookAndFeelCID,  NS_LOOKANDFEEL_CID);
 
 // Struct containing cached metrics for box-wrapped frames.
 struct nsBoxLayoutMetrics
 {
@@ -2349,17 +2351,17 @@ nsFrame::HandleMultiplePress(nsPresConte
   // (on platforms that support quadruple-click).
   nsSelectionAmount beginAmount, endAmount;
   nsMouseEvent *me = (nsMouseEvent *)aEvent;
   if (!me) return NS_OK;
 
   if (me->clickCount == 4) {
     beginAmount = endAmount = eSelectParagraph;
   } else if (me->clickCount == 3) {
-    if (nsContentUtils::GetBoolPref("browser.triple_click_selects_paragraph")) {
+    if (Preferences::GetBool("browser.triple_click_selects_paragraph")) {
       beginAmount = endAmount = eSelectParagraph;
     } else {
       beginAmount = eSelectBeginLine;
       endAmount = eSelectEndLine;
     }
   } else if (me->clickCount == 2) {
     // We only want inline frames; PeekBackwardAndForward dislikes blocks
     beginAmount = endAmount = eSelectWord;
@@ -5645,17 +5647,17 @@ nsIFrame::PeekOffset(nsPeekOffsetStruct*
         //       eStartWord: eat the space if we're moving forwards
         wordSelectEatSpace = ((aPos->mWordMovementType == eEndWord) == (aPos->mDirection == eDirPrevious));
       }
       else {
         // Use the hidden preference which is based on operating system behavior.
         // This pref only affects whether moving forward by word should go to the end of this word or start of the next word.
         // When going backwards, the start of the word is always used, on every operating system.
         wordSelectEatSpace = aPos->mDirection == eDirNext &&
-          nsContentUtils::GetBoolPref("layout.word_select.eat_space_to_next_word");
+          Preferences::GetBool("layout.word_select.eat_space_to_next_word");
       }
       
       // mSawBeforeType means "we already saw characters of the type
       // before the boundary we're looking for". Examples:
       // 1. If we're moving forward, looking for a word beginning (i.e. a boundary
       //    between whitespace and non-whitespace), then eatingWS==PR_TRUE means
       //    "we already saw some whitespace".
       // 2. If we're moving backward, looking for a word beginning (i.e. a boundary
@@ -5953,17 +5955,17 @@ nsFrame::BreakWordBetweenPunctuation(con
                                      PRBool aIsKeyboardSelect)
 {
   NS_ASSERTION(aPunctAfter != aState->mLastCharWasPunctuation,
                "Call this only at punctuation boundaries");
   if (aState->mLastCharWasWhitespace) {
     // We always stop between whitespace and punctuation
     return PR_TRUE;
   }
-  if (!nsContentUtils::GetBoolPref("layout.word_select.stop_at_punctuation")) {
+  if (!Preferences::GetBool("layout.word_select.stop_at_punctuation")) {
     // When this pref is false, we never stop at a punctuation boundary unless
     // it's after whitespace
     return PR_FALSE;
   }
   if (!aIsKeyboardSelect) {
     // mouse caret movement (e.g. word selection) always stops at every punctuation boundary
     return PR_TRUE;
   }
--- a/layout/generic/nsFrameSetFrame.cpp
+++ b/layout/generic/nsFrameSetFrame.cpp
@@ -68,16 +68,19 @@
 #include "nsINameSpaceManager.h"
 #include "nsCSSAnonBoxes.h"
 #include "nsAutoPtr.h"
 #include "nsStyleSet.h"
 #include "mozilla/dom/Element.h"
 #include "nsDisplayList.h"
 #include "nsNodeUtils.h"
 #include "mozAutoDocUpdate.h"
+#include "mozilla/Preferences.h"
+
+using namespace mozilla;
 
 // masks for mEdgeVisibility
 #define LEFT_VIS   0x0001
 #define RIGHT_VIS  0x0002
 #define TOP_VIS    0x0004
 #define BOTTOM_VIS 0x0008
 #define ALL_VIS    0x000F
 #define NONE_VIS   0x0000
@@ -258,18 +261,17 @@ nsHTMLFramesetFrame::FrameResizePrefCall
   if (doc) {
     nsNodeUtils::AttributeWillChange(frame->GetContent()->AsElement(),
                                      kNameSpaceID_None,
                                      nsGkAtoms::frameborder,
                                      nsIDOMMutationEvent::MODIFICATION);
   }
 
   frame->mForceFrameResizability =
-    nsContentUtils::GetBoolPref(kFrameResizePref,
-                                frame->mForceFrameResizability);
+    Preferences::GetBool(kFrameResizePref, frame->mForceFrameResizability);
 
   frame->RecalculateBorderResize();
   if (doc) {
     nsNodeUtils::AttributeChanged(frame->GetContent()->AsElement(),
                                   kNameSpaceID_None,
                                   nsGkAtoms::frameborder,
                                   nsIDOMMutationEvent::MODIFICATION);
   }
@@ -969,18 +971,17 @@ nsHTMLFramesetFrame::Reflow(nsPresContex
     ? aDesiredSize.width : aReflowState.availableWidth;
   nscoord height = (aDesiredSize.height <= aReflowState.availableHeight)
     ? aDesiredSize.height : aReflowState.availableHeight;
 
   PRBool firstTime = (GetStateBits() & NS_FRAME_FIRST_REFLOW) != 0;
   if (firstTime) {
     nsContentUtils::RegisterPrefCallback(kFrameResizePref,
                                          FrameResizePrefCallback, this);
-    mForceFrameResizability =
-      nsContentUtils::GetBoolPref(kFrameResizePref);
+    mForceFrameResizability = Preferences::GetBool(kFrameResizePref);
   }
   
   // subtract out the width of all of the potential borders. There are
   // only borders between <frame>s. There are none on the edges (e.g the
   // leftmost <frame> has no left border).
   PRInt32 borderWidth = GetBorderWidth(aPresContext, PR_TRUE);
 
   width  -= (mNumCols - 1) * borderWidth;
--- a/layout/generic/nsHTMLReflowState.cpp
+++ b/layout/generic/nsHTMLReflowState.cpp
@@ -51,16 +51,17 @@
 #include "nsLineBox.h"
 #include "nsImageFrame.h"
 #include "nsTableFrame.h"
 #include "nsTableCellFrame.h"
 #include "nsIServiceManager.h"
 #include "nsIPercentHeightObserver.h"
 #include "nsContentUtils.h"
 #include "nsLayoutUtils.h"
+#include "mozilla/Preferences.h"
 #ifdef IBMBIDI
 #include "nsBidiUtils.h"
 #endif
 
 #ifdef NS_DEBUG
 #undef NOISY_VERTICAL_ALIGN
 #else
 #undef NOISY_VERTICAL_ALIGN
@@ -1608,17 +1609,17 @@ nsHTMLReflowState::ComputeContainingBloc
   }
 }
 
 // Prefs callback to pick up changes
 static int
 PrefsChanged(const char *aPrefName, void *instance)
 {
   sBlinkIsAllowed =
-    nsContentUtils::GetBoolPref("browser.blink_allowed", sBlinkIsAllowed);
+    Preferences::GetBool("browser.blink_allowed", sBlinkIsAllowed);
 
   return 0; /* PREF_OK */
 }
 
 // Check to see if |text-decoration: blink| is allowed.  The first time
 // called, register the callback and then force-load the pref.  After that,
 // just use the cached value.
 static PRBool BlinkIsAllowed(void)
--- a/layout/generic/nsImageFrame.cpp
+++ b/layout/generic/nsImageFrame.cpp
@@ -98,16 +98,20 @@
 #include "nsEventStates.h"
 #include "nsLayoutErrors.h"
 #include "nsBidiUtils.h"
 #include "nsBidiPresUtils.h"
 
 #include "gfxRect.h"
 #include "ImageLayers.h"
 
+#include "mozilla/Preferences.h"
+
+using namespace mozilla;
+
 // sizes (pixels) for image icon, padding and border frame
 #define ICON_SIZE        (16)
 #define ICON_PADDING     (3)
 #define ALT_BORDER_WIDTH (1)
 
 
 //we must add hooks soon
 #define IMAGE_EDITOR_CHECK 1
@@ -1911,21 +1915,20 @@ nsImageFrame::IconLoad::Observe(nsISuppo
 
   GetPrefs();
   return NS_OK;
 }
 
 void nsImageFrame::IconLoad::GetPrefs()
 {
   mPrefForceInlineAltText =
-    nsContentUtils::GetBoolPref("browser.display.force_inline_alttext");
+    Preferences::GetBool("browser.display.force_inline_alttext");
 
   mPrefShowPlaceholders =
-    nsContentUtils::GetBoolPref("browser.display.show_image_placeholders",
-                                PR_TRUE);
+    Preferences::GetBool("browser.display.show_image_placeholders", PR_TRUE);
 }
 
 
 
 NS_IMETHODIMP
 nsImageFrame::IconLoad::OnStartRequest(imgIRequest *aRequest)
 {
   return NS_OK;
--- a/layout/generic/nsSelection.cpp
+++ b/layout/generic/nsSelection.cpp
@@ -82,16 +82,17 @@
 #include "nsBidiPresUtils.h"
 static NS_DEFINE_CID(kFrameTraversalCID, NS_FRAMETRAVERSAL_CID);
 #include "nsTextFrame.h"
 
 #include "nsIDOMText.h"
 
 #include "nsContentUtils.h"
 #include "nsThreadUtils.h"
+#include "mozilla/Preferences.h"
 
 //included for desired x position;
 #include "nsPresContext.h"
 #include "nsIPresShell.h"
 #include "nsCaret.h"
 
 
 #include "nsITimer.h"
@@ -108,16 +109,18 @@ static NS_DEFINE_CID(kFrameTraversalCID,
 #include "nsIClipboard.h"
 
 #ifdef IBMBIDI
 #include "nsIBidiKeyboard.h"
 #endif // IBMBIDI
 
 #include "nsDOMError.h"
 
+using namespace mozilla;
+
 //#define DEBUG_TABLE 1
 
 static NS_DEFINE_IID(kCContentIteratorCID, NS_CONTENTITERATOR_CID);
 static NS_DEFINE_IID(kCSubtreeIteratorCID, NS_SUBTREEITERATOR_CID);
 
 //PROTOTYPES
 class nsSelectionIterator;
 class nsFrameSelection;
@@ -725,17 +728,17 @@ nsFrameSelection::nsFrameSelection()
   mCaretBidiLevel = BIDI_LEVEL_UNDEFINED;
 #endif
   mDragSelectingCells = PR_FALSE;
   mSelectingTableCellMode = 0;
   mSelectedCellIndex = 0;
 
   // Check to see if the autocopy pref is enabled
   //   and add the autocopy listener if it is
-  if (nsContentUtils::GetBoolPref("clipboard.autocopy")) {
+  if (Preferences::GetBool("clipboard.autocopy")) {
     nsAutoCopyListener *autoCopy = nsAutoCopyListener::GetInstance();
 
     if (autoCopy) {
       PRInt8 index =
         GetIndexFromSelectionType(nsISelectionController::SELECTION_NORMAL);
       if (mDomSelections[index]) {
         autoCopy->Listen(mDomSelections[index]);
       }
--- a/layout/printing/nsPrintEngine.cpp
+++ b/layout/printing/nsPrintEngine.cpp
@@ -118,16 +118,17 @@ static const char kPrintingPromptService
 #include "nsIDOMHTMLCollection.h"
 #include "nsIDOMHTMLElement.h"
 #include "nsIDOMRange.h"
 #include "nsContentCID.h"
 #include "nsLayoutCID.h"
 #include "nsContentUtils.h"
 #include "nsIPresShell.h"
 #include "nsLayoutUtils.h"
+#include "mozilla/Preferences.h"
 
 #include "nsViewsCID.h"
 #include "nsWidgetsCID.h"
 #include "nsIDeviceContextSpec.h"
 #include "nsIViewManager.h"
 #include "nsIView.h"
 #include "nsRenderingContext.h"
 
@@ -160,16 +161,17 @@ static const char kPrintingPromptService
 
 #include "nsPIDOMWindow.h"
 #include "nsFocusManager.h"
 #include "nsRange.h"
 #include "nsCDefaultURIFixup.h"
 #include "nsIURIFixup.h"
 #include "mozilla/dom/Element.h"
 
+using namespace mozilla;
 using namespace mozilla::dom;
 
 //-----------------------------------------------------
 // PR LOGGING
 #ifdef MOZ_LOGGING
 #define FORCE_PR_LOG /* Allow logging in the release build */
 #endif
 
@@ -592,18 +594,18 @@ nsPrintEngine::DoCommonPrint(PRBool     
     mPrt->mDebugFilePtr = mDebugFile;
 #endif
 
     scriptSuppressor.Suppress();
     PRBool printSilently;
     mPrt->mPrintSettings->GetPrintSilent(&printSilently);
 
     // Check prefs for a default setting as to whether we should print silently
-    printSilently = nsContentUtils::GetBoolPref("print.always_print_silent",
-                                                printSilently);
+    printSilently =
+      Preferences::GetBool("print.always_print_silent", printSilently);
 
     // Ask dialog to be Print Shown via the Plugable Printing Dialog Service
     // This service is for the Print Dialog and the Print Progress Dialog
     // If printing silently or you can't get the service continue on
     if (!printSilently) {
       nsCOMPtr<nsIPrintingPromptService> printPromptService(do_GetService(kPrintingPromptService));
       if (printPromptService) {
         nsIDOMWindow *domWin = mDocument->GetWindow(); 
@@ -1007,18 +1009,17 @@ nsPrintEngine::ShowPrintProgress(PRBool 
   aDoNotify = PR_FALSE;
 
   // Assume we can't do progress and then see if we can
   PRBool showProgresssDialog = PR_FALSE;
 
   // if it is already being shown then don't bother to find out if it should be
   // so skip this and leave mShowProgressDialog set to FALSE
   if (!mProgressDialogIsShown) {
-    showProgresssDialog =
-      nsContentUtils::GetBoolPref("print.show_print_progress");
+    showProgresssDialog = Preferences::GetBool("print.show_print_progress");
   }
 
   // Turning off the showing of Print Progress in Prefs overrides
   // whether the calling PS desire to have it on or off, so only check PS if 
   // prefs says it's ok to be on.
   if (showProgresssDialog) {
     mPrt->mPrintSettings->GetShowPrintProgress(&showProgresssDialog);
   }
--- a/layout/style/nsCSSRuleProcessor.cpp
+++ b/layout/style/nsCSSRuleProcessor.cpp
@@ -89,19 +89,20 @@
 #include "prlog.h"
 #include "nsIObserverService.h"
 #include "nsIPrivateBrowsingService.h"
 #include "nsNetCID.h"
 #include "mozilla/Services.h"
 #include "mozilla/dom/Element.h"
 #include "nsGenericElement.h"
 #include "nsNthIndexCache.h"
+#include "mozilla/Preferences.h"
 
+using namespace mozilla;
 using namespace mozilla::dom;
-namespace css = mozilla::css;
 
 #define VISITED_PSEUDO_PREF "layout.css.visited_links_enabled"
 
 static PRBool gSupportVisitedPseudo = PR_TRUE;
 
 static NS_DEFINE_CID(kLookAndFeelCID, NS_LOOKANDFEEL_CID);
 static nsTArray< nsCOMPtr<nsIAtom> >* sSystemMetrics = 0;
 
@@ -959,18 +960,17 @@ nsCSSRuleProcessor::~nsCSSRuleProcessor(
 NS_IMPL_ISUPPORTS1(nsCSSRuleProcessor, nsIStyleRuleProcessor)
 
 /* static */ nsresult
 nsCSSRuleProcessor::Startup()
 {
   nsContentUtils::AddBoolPrefVarCache(VISITED_PSEUDO_PREF,
                                       &gSupportVisitedPseudo);
   // We want to default to true, not false as AddBoolPrefVarCache does.
-  gSupportVisitedPseudo =
-    nsContentUtils::GetBoolPref(VISITED_PSEUDO_PREF, PR_TRUE);
+  gSupportVisitedPseudo = Preferences::GetBool(VISITED_PSEUDO_PREF, PR_TRUE);
 
   gPrivateBrowsingObserver = new nsPrivateBrowsingObserver();
   NS_ENSURE_TRUE(gPrivateBrowsingObserver, NS_ERROR_OUT_OF_MEMORY);
   NS_ADDREF(gPrivateBrowsingObserver);
   gPrivateBrowsingObserver->Init();
 
   return NS_OK;
 }
--- a/layout/style/nsCSSScanner.cpp
+++ b/layout/style/nsCSSScanner.cpp
@@ -55,16 +55,19 @@
 #include "nsIURI.h"
 #include "nsIConsoleService.h"
 #include "nsIScriptError.h"
 #include "nsIStringBundle.h"
 #include "nsContentUtils.h"
 #include "mozilla/Services.h"
 #include "mozilla/css/Loader.h"
 #include "nsCSSStyleSheet.h"
+#include "mozilla/Preferences.h"
+
+using namespace mozilla;
 
 #ifdef CSS_REPORT_PARSE_ERRORS
 static PRBool gReportErrors = PR_TRUE;
 static nsIConsoleService *gConsoleService;
 static nsIFactory *gScriptErrorFactory;
 static nsIStringBundle *gStringBundle;
 #endif
 
@@ -320,17 +323,17 @@ nsCSSScanner::SetLowLevelError(nsresult 
 }
 
 #ifdef CSS_REPORT_PARSE_ERRORS
 #define CSS_ERRORS_PREF "layout.css.report_errors"
 
 static int
 CSSErrorsPrefChanged(const char *aPref, void *aClosure)
 {
-  gReportErrors = nsContentUtils::GetBoolPref(CSS_ERRORS_PREF, PR_TRUE);
+  gReportErrors = Preferences::GetBool(CSS_ERRORS_PREF, PR_TRUE);
   return NS_OK;
 }
 #endif
 
 /* static */ PRBool
 nsCSSScanner::InitGlobals()
 {
 #ifdef CSS_REPORT_PARSE_ERRORS
--- a/layout/svg/base/src/nsSVGUtils.cpp
+++ b/layout/svg/base/src/nsSVGUtils.cpp
@@ -83,16 +83,17 @@
 #include "nsSVGIntegrationUtils.h"
 #include "nsSVGFilterPaintCallback.h"
 #include "nsSVGGeometryFrame.h"
 #include "nsComputedDOMStyle.h"
 #include "nsSVGPathGeometryFrame.h"
 #include "prdtoa.h"
 #include "mozilla/dom/Element.h"
 #include "gfxUtils.h"
+#include "mozilla/Preferences.h"
 
 using namespace mozilla;
 using namespace mozilla::dom;
 
 // c = n / 255
 // (c <= 0.0031308 ? c * 12.92 : 1.055 * pow(c, 1 / 2.4) - 0.055) * 255 + 0.5
 static const PRUint8 glinearRGBTosRGBMap[256] = {
   0,  13,  22,  28,  34,  38,  42,  46,
@@ -170,29 +171,29 @@ 239, 242, 244, 246, 248, 250, 253, 255
 static PRBool gSMILEnabled;
 static const char SMIL_PREF_STR[] = "svg.smil.enabled";
 #endif // MOZ_SMIL
 
 #ifdef MOZ_SMIL
 static int
 SMILPrefChanged(const char *aPref, void *aClosure)
 {
-  PRBool prefVal = nsContentUtils::GetBoolPref(SMIL_PREF_STR);
+  PRBool prefVal = Preferences::GetBool(SMIL_PREF_STR);
   gSMILEnabled = prefVal;
   return 0;
 }
 
 PRBool
 NS_SMILEnabled()
 {
   static PRBool sInitialized = PR_FALSE;
   
   if (!sInitialized) {
     /* check and register ourselves with the pref */
-    gSMILEnabled = nsContentUtils::GetBoolPref(SMIL_PREF_STR);
+    gSMILEnabled = Preferences::GetBool(SMIL_PREF_STR);
     nsContentUtils::RegisterPrefCallback(SMIL_PREF_STR, SMILPrefChanged, nsnull);
 
     sInitialized = PR_TRUE;
   }
 
   return gSMILEnabled;
 }
 #endif // MOZ_SMIL
@@ -1294,17 +1295,17 @@ nsSVGUtils::GetBBox(nsIFrame *aFrame)
   if (aFrame->GetContent()->IsNodeOfType(nsINode::eTEXT)) {
     aFrame = aFrame->GetParent();
   }
   gfxRect bbox;
   nsISVGChildFrame *svg = do_QueryFrame(aFrame);
   if (svg) {
     // It is possible to apply a gradient, pattern, clipping path, mask or
     // filter to text. When one of these facilities is applied to text
-    // the bounding box is the entire ‘text’ element in all
+    // the bounding box is the entire text element in all
     // cases.
     nsSVGTextContainerFrame* metrics = do_QueryFrame(
       GetFirstNonAAncestorFrame(aFrame));
     if (metrics) {
       while (aFrame->GetType() != nsGkAtoms::svgTextFrame) {
         aFrame = aFrame->GetParent();
       }
       svg = do_QueryFrame(aFrame);
--- a/layout/xul/base/src/nsBoxFrame.cpp
+++ b/layout/xul/base/src/nsBoxFrame.cpp
@@ -88,23 +88,25 @@
 #include "nsIDOMDocument.h"
 #include "nsIDOMElement.h"
 #include "nsITheme.h"
 #include "nsTransform2D.h"
 #include "nsEventStateManager.h"
 #include "nsEventDispatcher.h"
 #include "nsIDOMEvent.h"
 #include "nsIPrivateDOMEvent.h"
-#include "nsContentUtils.h"
 #include "nsDisplayList.h"
+#include "mozilla/Preferences.h"
 
 // Needed for Print Preview
 #include "nsIDocument.h"
 #include "nsIURI.h"
 
+using namespace mozilla;
+
 //define DEBUG_REDRAW
 
 #define DEBUG_SPRING_SIZE 8
 #define DEBUG_BORDER_SIZE 2
 #define COIL_SIZE 8
 
 //#define TEST_SANITY
 
@@ -1241,17 +1243,17 @@ nsBoxFrame::AttributeChanged(PRInt32 aNa
 
   return rv;
 }
 
 #ifdef DEBUG_LAYOUT
 void
 nsBoxFrame::GetDebugPref(nsPresContext* aPresContext)
 {
-    gDebug = nsContentUtils::GetBoolPref("xul.debug.box");
+    gDebug = Preferences::GetBool("xul.debug.box");
 }
 
 class nsDisplayXULDebug : public nsDisplayItem {
 public:
   nsDisplayXULDebug(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame) :
     nsDisplayItem(aBuilder, aFrame) {
     MOZ_COUNT_CTOR(nsDisplayXULDebug);
   }
--- a/layout/xul/base/src/nsMenuBarListener.cpp
+++ b/layout/xul/base/src/nsMenuBarListener.cpp
@@ -53,16 +53,19 @@
 #include "nsWidgetsCID.h"
 #include "nsCOMPtr.h"
 #include "nsIDOMKeyEvent.h"
 #include "nsIContent.h"
 #include "nsIDOMNode.h"
 #include "nsIDOMElement.h"
 
 #include "nsContentUtils.h"
+#include "mozilla/Preferences.h"
+
+using namespace mozilla;
 
 /*
  * nsMenuBarListener implementation
  */
 
 NS_IMPL_ADDREF(nsMenuBarListener)
 NS_IMPL_RELEASE(nsMenuBarListener)
 NS_INTERFACE_MAP_BEGIN(nsMenuBarListener)
@@ -125,18 +128,17 @@ void nsMenuBarListener::InitAccessKey()
     mAccessKeyMask = MODIFIER_SHIFT;
   else if (mAccessKey == nsIDOMKeyEvent::DOM_VK_CONTROL)
     mAccessKeyMask = MODIFIER_CONTROL;
   else if (mAccessKey == nsIDOMKeyEvent::DOM_VK_ALT)
     mAccessKeyMask = MODIFIER_ALT;
   else if (mAccessKey == nsIDOMKeyEvent::DOM_VK_META)
     mAccessKeyMask = MODIFIER_META;
 
-  mAccessKeyFocuses =
-    nsContentUtils::GetBoolPref("ui.key.menuAccessKeyFocuses");
+  mAccessKeyFocuses = Preferences::GetBool("ui.key.menuAccessKeyFocuses");
 }
 
 void
 nsMenuBarListener::ToggleMenuActiveState()
 {
   nsMenuFrame* closemenu = mMenuBarFrame->ToggleMenuActiveState();
   nsXULPopupManager* pm = nsXULPopupManager::GetInstance();
   if (pm && closemenu) {
--- a/layout/xul/base/src/nsMenuPopupFrame.cpp
+++ b/layout/xul/base/src/nsMenuPopupFrame.cpp
@@ -81,16 +81,19 @@
 #include "nsBindingManager.h"
 #include "nsIDocShellTreeOwner.h"
 #include "nsIBaseWindow.h"
 #include "nsISound.h"
 #include "nsIRootBox.h"
 #include "nsIScreenManager.h"
 #include "nsIServiceManager.h"
 #include "nsThemeConstants.h"
+#include "mozilla/Preferences.h"
+
+using namespace mozilla;
 
 PRInt8 nsMenuPopupFrame::sDefaultLevelIsTop = -1;
 
 // NS_NewMenuPopupFrame
 //
 // Wrapper for creating a new menu popup container
 //
 nsIFrame*
@@ -125,17 +128,17 @@ nsMenuPopupFrame::nsMenuPopupFrame(nsIPr
   mHFlip(PR_FALSE),
   mVFlip(PR_FALSE)
 {
   // the preference name is backwards here. True means that the 'top' level is
   // the default, and false means that the 'parent' level is the default.
   if (sDefaultLevelIsTop >= 0)
     return;
   sDefaultLevelIsTop =
-    nsContentUtils::GetBoolPref("ui.panel.default_level_parent", PR_FALSE);
+    Preferences::GetBool("ui.panel.default_level_parent", PR_FALSE);
 } // ctor
 
 
 NS_IMETHODIMP
 nsMenuPopupFrame::Init(nsIContent*      aContent,
                        nsIFrame*        aParent,
                        nsIFrame*        aPrevInFlow)
 {
--- a/layout/xul/base/src/nsSliderFrame.cpp
+++ b/layout/xul/base/src/nsSliderFrame.cpp
@@ -65,16 +65,19 @@
 #include "nsRepeatService.h"
 #include "nsBoxLayoutState.h"
 #include "nsSprocketLayout.h"
 #include "nsIServiceManager.h"
 #include "nsGUIEvent.h"
 #include "nsContentUtils.h"
 #include "nsLayoutUtils.h"
 #include "nsDisplayList.h"
+#include "mozilla/Preferences.h"
+
+using namespace mozilla;
 
 PRBool nsSliderFrame::gMiddlePref = PR_FALSE;
 PRInt32 nsSliderFrame::gSnapMultiplier;
 
 // Turn this on if you want to debug slider frames.
 #undef DEBUG_SLIDER
 
 static already_AddRefed<nsIContent>
@@ -112,17 +115,17 @@ nsSliderFrame::Init(nsIContent*      aCo
                     nsIFrame*        aPrevInFlow)
 {
   nsresult rv = nsBoxFrame::Init(aContent, aParent, aPrevInFlow);
 
   static PRBool gotPrefs = PR_FALSE;
   if (!gotPrefs) {
     gotPrefs = PR_TRUE;
 
-    gMiddlePref = nsContentUtils::GetBoolPref("middlemouse.scrollbarPosition");
+    gMiddlePref = Preferences::GetBool("middlemouse.scrollbarPosition");
     gSnapMultiplier = nsContentUtils::GetIntPref("slider.snapMultiplier");
   }
 
   mCurPos = GetCurrentPosition(aContent);
 
   return rv;
 }
 
--- a/layout/xul/base/src/nsXULTooltipListener.cpp
+++ b/layout/xul/base/src/nsXULTooltipListener.cpp
@@ -57,16 +57,19 @@
 #include "nsIScriptContext.h"
 #include "nsPIDOMWindow.h"
 #include "nsContentUtils.h"
 #ifdef MOZ_XUL
 #include "nsXULPopupManager.h"
 #endif
 #include "nsIRootBox.h"
 #include "nsEventDispatcher.h"
+#include "mozilla/Preferences.h"
+
+using namespace mozilla;
 
 nsXULTooltipListener* nsXULTooltipListener::mInstance = nsnull;
 
 //////////////////////////////////////////////////////////////////////////
 //// nsISupports
 
 nsXULTooltipListener::nsXULTooltipListener()
   : mMouseScreenX(0)
@@ -318,18 +321,18 @@ nsXULTooltipListener::HandleEvent(nsIDOM
 //////////////////////////////////////////////////////////////////////////
 //// nsXULTooltipListener
 
 // static
 int
 nsXULTooltipListener::ToolbarTipsPrefChanged(const char *aPref,
                                              void *aClosure)
 {
-  sShowTooltips = nsContentUtils::GetBoolPref("browser.chrome.toolbar_tips",
-                                              sShowTooltips);
+  sShowTooltips =
+    Preferences::GetBool("browser.chrome.toolbar_tips", sShowTooltips);
 
   return 0;
 }
 
 //////////////////////////////////////////////////////////////////////////
 //// nsXULTooltipListener
 
 PRBool nsXULTooltipListener::sShowTooltips = PR_FALSE;