Bug 968643 - Part 1: Stop using [PrefControlled]; r=bzbarsky
authorEhsan Akhgari <ehsan.akhgari@gmail.com>
Thu, 06 Feb 2014 13:28:14 -0500
changeset 172757 20a329b254aed056453d859c65a13639c293d433
parent 172756 7ec2f01992186924d9bfa9864c55b52ecf7dc4ea
child 172758 197880d71d9dbc4ad4e7d02bac7c452bc42e7672
push id3503
push userraliiev@mozilla.com
push dateMon, 28 Apr 2014 18:51:11 +0000
treeherdermozilla-esr52@c95ac01e332e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbzbarsky
bugs968643
milestone30.0a1
Bug 968643 - Part 1: Stop using [PrefControlled]; r=bzbarsky
content/base/src/EventSource.cpp
content/base/src/EventSource.h
content/base/src/ShadowRoot.cpp
content/base/src/ShadowRoot.h
content/base/src/WebSocket.cpp
content/base/src/WebSocket.h
content/html/content/src/UndoManager.cpp
content/html/content/src/UndoManager.h
content/media/webspeech/recognition/EnableWebSpeechRecognitionCheck.cpp
content/media/webspeech/recognition/EnableWebSpeechRecognitionCheck.h
content/media/webspeech/synth/EnableSpeechSynthesisCheck.cpp
content/media/webspeech/synth/EnableSpeechSynthesisCheck.h
dom/activities/src/Activity.h
dom/events/Touch.cpp
dom/events/Touch.h
dom/events/nsDOMTouchEvent.cpp
dom/events/nsDOMTouchEvent.h
dom/file/ArchiveReader.cpp
dom/file/ArchiveReader.h
dom/file/ArchiveRequest.h
dom/src/notification/Notification.cpp
dom/src/notification/Notification.h
dom/time/TimeManager.h
dom/webidl/ArchiveReader.webidl
dom/webidl/CSS.webidl
dom/webidl/EventSource.webidl
dom/webidl/MozActivity.webidl
dom/webidl/MozTimeManager.webidl
dom/webidl/Notification.webidl
dom/webidl/ShadowRoot.webidl
dom/webidl/SharedWorker.webidl
dom/webidl/SpeechGrammar.webidl
dom/webidl/SpeechGrammarList.webidl
dom/webidl/SpeechRecognition.webidl
dom/webidl/SpeechRecognitionAlternative.webidl
dom/webidl/SpeechRecognitionResult.webidl
dom/webidl/SpeechRecognitionResultList.webidl
dom/webidl/SpeechSynthesis.webidl
dom/webidl/SpeechSynthesisUtterance.webidl
dom/webidl/SpeechSynthesisVoice.webidl
dom/webidl/Touch.webidl
dom/webidl/TouchEvent.webidl
dom/webidl/TouchList.webidl
dom/webidl/UndoManager.webidl
dom/webidl/WebSocket.webidl
dom/workers/SharedWorker.cpp
dom/workers/SharedWorker.h
layout/style/CSS.h
modules/libpref/src/init/all.js
--- a/content/base/src/EventSource.cpp
+++ b/content/base/src/EventSource.cpp
@@ -660,17 +660,17 @@ EventSource::GetInterface(const nsIID & 
     return wwatch->GetPrompt(window, aIID, aResult);
   }
 
   return QueryInterface(aIID, aResult);
 }
 
 // static
 bool
-EventSource::PrefEnabled()
+EventSource::PrefEnabled(JSContext* aCx, JSObject* aGlobal)
 {
   return Preferences::GetBool("dom.server-events.enabled", false);
 }
 
 nsresult
 EventSource::GetBaseURI(nsIURI **aBaseURI)
 {
   NS_ENSURE_ARG_POINTER(aBaseURI);
--- a/content/base/src/EventSource.h
+++ b/content/base/src/EventSource.h
@@ -93,17 +93,17 @@ public:
   }
 
   IMPL_EVENT_HANDLER(open)
   IMPL_EVENT_HANDLER(message)
   IMPL_EVENT_HANDLER(error)
   void Close();
 
   // Determine if preferences allow EventSource
-  static bool PrefEnabled();
+  static bool PrefEnabled(JSContext* aCx = nullptr, JSObject* aGlobal = nullptr);
 
   virtual void DisconnectFromOwner() MOZ_OVERRIDE;
 
 protected:
   nsresult Init(nsISupports* aOwner,
                 const nsAString& aURL,
                 bool aWithCredentials);
 
--- a/content/base/src/ShadowRoot.cpp
+++ b/content/base/src/ShadowRoot.cpp
@@ -229,22 +229,16 @@ ShadowRoot::RemoveFromIdTable(Element* a
 }
 
 already_AddRefed<nsContentList>
 ShadowRoot::GetElementsByClassName(const nsAString& aClasses)
 {
   return nsContentUtils::GetElementsByClassName(this, aClasses);
 }
 
-bool
-ShadowRoot::PrefEnabled()
-{
-  return Preferences::GetBool("dom.webcomponents.enabled", false);
-}
-
 void
 ShadowRoot::AddInsertionPoint(HTMLContentElement* aInsertionPoint)
 {
   TreeOrderComparator comparator;
   mInsertionPoints.InsertElementSorted(aInsertionPoint, comparator);
 }
 
 void
--- a/content/base/src/ShadowRoot.h
+++ b/content/base/src/ShadowRoot.h
@@ -43,17 +43,16 @@ public:
   NS_DECL_NSIMUTATIONOBSERVER_CONTENTREMOVED
 
   ShadowRoot(nsIContent* aContent, already_AddRefed<nsINodeInfo> aNodeInfo,
              nsXBLPrototypeBinding* aProtoBinding);
   virtual ~ShadowRoot();
 
   void AddToIdTable(Element* aElement, nsIAtom* aId);
   void RemoveFromIdTable(Element* aElement, nsIAtom* aId);
-  static bool PrefEnabled();
   void InsertSheet(nsCSSStyleSheet* aSheet, nsIContent* aLinkingContent);
   void RemoveSheet(nsCSSStyleSheet* aSheet);
   bool ApplyAuthorStyles();
   void SetApplyAuthorStyles(bool aApplyAuthorStyles);
   nsIDOMStyleSheetList* StyleSheets();
   HTMLShadowElement* GetShadowElement() { return mShadowElement; }
 
   /**
--- a/content/base/src/WebSocket.cpp
+++ b/content/base/src/WebSocket.cpp
@@ -949,17 +949,17 @@ WebSocket::CreateAndDispatchCloseEvent(b
   NS_ENSURE_SUCCESS(rv, rv);
 
   event->SetTrusted(true);
 
   return DispatchDOMEvent(nullptr, event, nullptr, nullptr);
 }
 
 bool
-WebSocket::PrefEnabled()
+WebSocket::PrefEnabled(JSContext* aCx, JSObject* aGlobal)
 {
   return Preferences::GetBool("network.websocket.enabled", true);
 }
 
 nsresult
 WebSocket::ParseURL(const nsString& aURL)
 {
   NS_ENSURE_TRUE(!aURL.IsEmpty(), NS_ERROR_DOM_SYNTAX_ERR);
--- a/content/base/src/WebSocket.h
+++ b/content/base/src/WebSocket.h
@@ -69,17 +69,17 @@ public:
   nsPIDOMWindow* GetParentObject() { return GetOwner(); }
 
   virtual JSObject* WrapObject(JSContext *cx,
                                JS::Handle<JSObject*> scope) MOZ_OVERRIDE;
 
 public: // static helpers:
 
   // Determine if preferences allow WebSocket
-  static bool PrefEnabled();
+  static bool PrefEnabled(JSContext* aCx = nullptr, JSObject* aGlobal = nullptr);
 
 public: // WebIDL interface:
 
   // Constructor:
   static already_AddRefed<WebSocket> Constructor(const GlobalObject& aGlobal,
                                                  const nsAString& aUrl,
                                                  ErrorResult& rv);
 
--- a/content/html/content/src/UndoManager.cpp
+++ b/content/html/content/src/UndoManager.cpp
@@ -1222,16 +1222,8 @@ UndoManager::GetTransactionManager()
   return mTxnManager;
 }
 
 void
 UndoManager::Disconnect()
 {
   mIsDisconnected = true;
 }
-
-bool
-UndoManager::PrefEnabled()
-{
-  static bool sPrefValue = Preferences::GetBool("dom.undo_manager.enabled", false);
-  return sPrefValue;
-}
-
--- a/content/html/content/src/UndoManager.h
+++ b/content/html/content/src/UndoManager.h
@@ -41,17 +41,16 @@ public:
   void Redo(JSContext* acx, ErrorResult& aRv);
   void Item(uint32_t aIndex,
             Nullable<nsTArray<nsRefPtr<DOMTransaction> > >& aItems,
             ErrorResult& aRv);
   uint32_t GetLength(ErrorResult& aRv);
   uint32_t GetPosition(ErrorResult& aRv);
   void ClearUndo(ErrorResult& aRv);
   void ClearRedo(ErrorResult& aRv);
-  static bool PrefEnabled();
   void Disconnect();
 
   nsISupports* GetParentObject() const
   {
     return mHostNode;
   }
 
   virtual JSObject* WrapObject(JSContext* aCx,
--- a/content/media/webspeech/recognition/EnableWebSpeechRecognitionCheck.cpp
+++ b/content/media/webspeech/recognition/EnableWebSpeechRecognitionCheck.cpp
@@ -13,17 +13,17 @@ bool gPrefInitialized = false;
 bool gWebSpeechEnabled = false;
 
 }
 
 namespace mozilla {
 namespace dom {
 
 /* static */ bool
-EnableWebSpeechRecognitionCheck::PrefEnabled()
+EnableWebSpeechRecognitionCheck::PrefEnabled(JSContext* aCx, JSObject* aGlobal)
 {
   if (!gPrefInitialized) {
     Preferences::AddBoolVarCache(&gWebSpeechEnabled, "media.webspeech.recognition.enable");
     gPrefInitialized = true;
   }
   return gWebSpeechEnabled;
 }
 
--- a/content/media/webspeech/recognition/EnableWebSpeechRecognitionCheck.h
+++ b/content/media/webspeech/recognition/EnableWebSpeechRecognitionCheck.h
@@ -2,21 +2,23 @@
 /* vim:set ts=2 sw=2 sts=2 et cindent: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef EnableWebSpeechRecognitionCheck_h
 #define EnableWebSpeechRecognitionCheck_h
 
+#include "js/TypeDecls.h"
+
 namespace mozilla {
 namespace dom {
 
 class EnableWebSpeechRecognitionCheck
 {
 public:
-  static bool PrefEnabled();
+  static bool PrefEnabled(JSContext* aCx, JSObject* aGlobal);
 };
 
 }
 }
 
 #endif
--- a/content/media/webspeech/synth/EnableSpeechSynthesisCheck.cpp
+++ b/content/media/webspeech/synth/EnableSpeechSynthesisCheck.cpp
@@ -13,17 +13,17 @@ bool gPrefInitialized = false;
 bool gWebSpeechEnabled = false;
 
 }
 
 namespace mozilla {
 namespace dom {
 
 /* static */ bool
-EnableSpeechSynthesisCheck::PrefEnabled()
+EnableSpeechSynthesisCheck::PrefEnabled(JSContext* aCx, JSObject* aGlobal)
 {
   if (!gPrefInitialized) {
     Preferences::AddBoolVarCache(&gWebSpeechEnabled, "media.webspeech.synth.enabled");
     gPrefInitialized = true;
   }
 
   return gWebSpeechEnabled;
 }
--- a/content/media/webspeech/synth/EnableSpeechSynthesisCheck.h
+++ b/content/media/webspeech/synth/EnableSpeechSynthesisCheck.h
@@ -2,23 +2,25 @@
 /* vim:set ts=2 sw=2 sts=2 et cindent: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef mozilla_dom_EnableSpeechSynthesisCheck_h
 #define mozilla_dom_EnableSpeechSynthesisCheck_h
 
+#include "js/TypeDecls.h"
+
 namespace mozilla {
 namespace dom {
 
 // This is a helper class which enables Web Speech to be enabled or disabled
 // as whole.  Individual Web Speech object classes should inherit from this.
 class EnableSpeechSynthesisCheck
 {
 public:
-  static bool PrefEnabled();
+  static bool PrefEnabled(JSContext* aCx = nullptr, JSObject* aGlobal = nullptr);
 };
 
 }
 }
 
 #endif
--- a/dom/activities/src/Activity.h
+++ b/dom/activities/src/Activity.h
@@ -18,21 +18,16 @@ class Activity : public DOMRequest
 {
 public:
   NS_DECL_ISUPPORTS_INHERITED
   NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_INHERITED(Activity, DOMRequest)
 
   virtual JSObject* WrapObject(JSContext* aCx,
                                JS::Handle<JSObject*> aScope) MOZ_OVERRIDE;
 
-  static bool PrefEnabled()
-  {
-    return Preferences::GetBool("dom.sysmsg.enabled", false);
-  }
-
   static already_AddRefed<Activity>
   Constructor(const GlobalObject& aOwner,
               nsIDOMMozActivityOptions* aOptions,
               ErrorResult& aRv)
   {
     nsCOMPtr<nsPIDOMWindow> window = do_QueryInterface(aOwner.GetAsSupports());
     if (!window) {
       aRv.Throw(NS_ERROR_UNEXPECTED);
--- a/dom/events/Touch.cpp
+++ b/dom/events/Touch.cpp
@@ -67,19 +67,19 @@ Touch::Touch(int32_t aIdentifier,
   nsJSContext::LikelyShortLivingObjectCreated();
 }
 
 Touch::~Touch()
 {
 }
 
  /* static */ bool
-Touch::PrefEnabled()
+Touch::PrefEnabled(JSContext* aCx, JSObject* aGlobal)
 {
-  return nsDOMTouchEvent::PrefEnabled();
+  return nsDOMTouchEvent::PrefEnabled(aCx, aGlobal);
 }
 
 NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE_1(Touch, mTarget)
 
 NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(Touch)
   NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
   NS_INTERFACE_MAP_ENTRY(nsISupports)
 NS_INTERFACE_MAP_END
--- a/dom/events/Touch.h
+++ b/dom/events/Touch.h
@@ -18,17 +18,17 @@ namespace mozilla {
 namespace dom {
 
 class EventTarget;
 
 class Touch MOZ_FINAL : public nsISupports
                       , public nsWrapperCache
 {
 public:
-  static bool PrefEnabled();
+  static bool PrefEnabled(JSContext* aCx, JSObject* aGlobal);
 
   Touch(mozilla::dom::EventTarget* aTarget,
         int32_t aIdentifier,
         int32_t aPageX,
         int32_t aPageY,
         int32_t aScreenX,
         int32_t aScreenY,
         int32_t aClientX,
--- a/dom/events/nsDOMTouchEvent.cpp
+++ b/dom/events/nsDOMTouchEvent.cpp
@@ -28,19 +28,19 @@ NS_IMPL_CYCLE_COLLECTING_RELEASE(nsDOMTo
 
 /* virtual */ JSObject*
 nsDOMTouchList::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aScope)
 {
   return TouchListBinding::Wrap(aCx, aScope, this);
 }
 
 /* static */ bool
-nsDOMTouchList::PrefEnabled()
+nsDOMTouchList::PrefEnabled(JSContext* aCx, JSObject* aGlobal)
 {
-  return nsDOMTouchEvent::PrefEnabled();
+  return nsDOMTouchEvent::PrefEnabled(aCx, aGlobal);
 }
 
 Touch*
 nsDOMTouchList::IdentifiedTouch(int32_t aIdentifier) const
 {
   for (uint32_t i = 0; i < mPoints.Length(); ++i) {
     Touch* point = mPoints[i];
     if (point && point->Identifier() == aIdentifier) {
@@ -178,17 +178,17 @@ nsDOMTouchEvent::ChangedTouches()
 #ifdef XP_WIN
 namespace mozilla {
 namespace widget {
 extern int32_t IsTouchDeviceSupportPresent();
 } }
 #endif
 
 bool
-nsDOMTouchEvent::PrefEnabled()
+nsDOMTouchEvent::PrefEnabled(JSContext* aCx, JSObject* aGlobal)
 {
   bool prefValue = false;
   int32_t flag = 0;
   if (NS_SUCCEEDED(Preferences::GetInt("dom.w3c_touch_events.enabled",
                                         &flag))) {
     if (flag == 2) {
 #ifdef XP_WIN
       static bool sDidCheckTouchDeviceSupport = false;
--- a/dom/events/nsDOMTouchEvent.h
+++ b/dom/events/nsDOMTouchEvent.h
@@ -49,17 +49,17 @@ public:
   virtual JSObject*
   WrapObject(JSContext* aCx, JS::Handle<JSObject*> aScope) MOZ_OVERRIDE;
 
   nsISupports* GetParentObject() const
   {
     return mParent;
   }
 
-  static bool PrefEnabled();
+  static bool PrefEnabled(JSContext* aCx = nullptr, JSObject* aGlobal = nullptr);
 
   uint32_t Length() const
   {
     return mPoints.Length();
   }
   Touch* Item(uint32_t aIndex) const
   {
     return mPoints.SafeElementAt(aIndex);
@@ -113,16 +113,16 @@ public:
                       bool aAltKey,
                       bool aShiftKey,
                       bool aMetaKey,
                       nsDOMTouchList* aTouches,
                       nsDOMTouchList* aTargetTouches,
                       nsDOMTouchList* aChangedTouches,
                       mozilla::ErrorResult& aRv);
 
-  static bool PrefEnabled();
+  static bool PrefEnabled(JSContext* aCx = nullptr, JSObject* aGlobal = nullptr);
 protected:
   nsRefPtr<nsDOMTouchList> mTouches;
   nsRefPtr<nsDOMTouchList> mTargetTouches;
   nsRefPtr<nsDOMTouchList> mChangedTouches;
 };
 
 #endif /* !defined(nsDOMTouchEvent_h_) */
--- a/dom/file/ArchiveReader.cpp
+++ b/dom/file/ArchiveReader.cpp
@@ -23,17 +23,16 @@ USING_FILE_NAMESPACE
 
 /* static */ already_AddRefed<ArchiveReader>
 ArchiveReader::Constructor(const GlobalObject& aGlobal,
                            nsIDOMBlob* aBlob,
                            const ArchiveReaderOptions& aOptions,
                            ErrorResult& aError)
 {
   MOZ_ASSERT(aBlob);
-  MOZ_ASSERT(PrefEnabled());
 
   nsCOMPtr<nsPIDOMWindow> window = do_QueryInterface(aGlobal.GetAsSupports());
   if (!window) {
     aError.Throw(NS_ERROR_UNEXPECTED);
     return nullptr;
   }
 
   nsAutoCString encoding;
@@ -66,22 +65,16 @@ ArchiveReader::~ArchiveReader()
 }
 
 /* virtual */ JSObject*
 ArchiveReader::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aScope)
 {
   return ArchiveReaderBinding::Wrap(aCx, aScope, this);
 }
 
-/* static */ bool
-ArchiveReader::PrefEnabled()
-{
-  return Preferences::GetBool("dom.archivereader.enabled", true);
-}
-
 nsresult
 ArchiveReader::RegisterRequest(ArchiveRequest* aRequest)
 {
   switch (mStatus) {
     // Append to the list and let's start to work:
     case NOT_STARTED:
       mRequests.AppendElement(aRequest);
       return OpenArchive();
--- a/dom/file/ArchiveReader.h
+++ b/dom/file/ArchiveReader.h
@@ -53,18 +53,16 @@ public:
 
   already_AddRefed<ArchiveRequest> GetFilenames();
   already_AddRefed<ArchiveRequest> GetFile(const nsAString& filename);
   already_AddRefed<ArchiveRequest> GetFiles();
 
   nsresult GetInputStream(nsIInputStream** aInputStream);
   nsresult GetSize(uint64_t* aSize);
 
-  static bool PrefEnabled();
-
 public: // for the ArchiveRequest:
   nsresult RegisterRequest(ArchiveRequest* aRequest);
 
 public: // For events:
   void Ready(nsTArray<nsCOMPtr<nsIDOMFile> >& aFileList,
              nsresult aStatus);
 
 private:
--- a/dom/file/ArchiveRequest.h
+++ b/dom/file/ArchiveRequest.h
@@ -18,21 +18,16 @@ BEGIN_FILE_NAMESPACE
 
 /**
  * This is the ArchiveRequest that handles any operation
  * related to ArchiveReader
  */
 class ArchiveRequest : public mozilla::dom::DOMRequest
 {
 public:
-  static bool PrefEnabled()
-  {
-    return ArchiveReader::PrefEnabled();
-  }
-
   virtual JSObject* WrapObject(JSContext* aCx,
                                JS::Handle<JSObject*> aScope) MOZ_OVERRIDE;
 
   ArchiveReader* Reader() const;
 
   NS_DECL_ISUPPORTS_INHERITED
 
   NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(ArchiveRequest, DOMRequest)
--- a/dom/src/notification/Notification.cpp
+++ b/dom/src/notification/Notification.cpp
@@ -721,22 +721,16 @@ Notification::Get(const GlobalObject& aG
   aRv = notificationStorage->Get(origin, tag, callback);
   if (aRv.Failed()) {
     return nullptr;
   }
 
   return promise.forget();
 }
 
-bool
-Notification::PrefEnabled()
-{
-  return Preferences::GetBool("dom.webnotifications.enabled", false);
-}
-
 JSObject*
 Notification::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aScope)
 {
   return mozilla::dom::NotificationBinding::Wrap(aCx, aScope, this);
 }
 
 void
 Notification::Close()
--- a/dom/src/notification/Notification.h
+++ b/dom/src/notification/Notification.h
@@ -80,18 +80,16 @@ public:
                                               ErrorResult& aRv);
 
   static already_AddRefed<Promise> Get(const GlobalObject& aGlobal,
                                        const GetNotificationOptions& aFilter,
                                        ErrorResult& aRv);
 
   void Close();
 
-  static bool PrefEnabled();
-
   nsPIDOMWindow* GetParentObject()
   {
     return GetOwner();
   }
 
   virtual JSObject* WrapObject(JSContext* aCx,
                                JS::Handle<JSObject*> aScope) MOZ_OVERRIDE;
 protected:
--- a/dom/time/TimeManager.h
+++ b/dom/time/TimeManager.h
@@ -16,17 +16,17 @@ namespace dom {
 class Date;
 
 namespace time {
 
 class TimeManager MOZ_FINAL : public nsISupports
                             , public nsWrapperCache
 {
 public:
-  static bool PrefEnabled()
+  static bool PrefEnabled(JSContext* aCx, JSObject* aGlobal)
   {
 #ifdef MOZ_TIME_MANAGER
     return true;
 #else
     return false;
 #endif
   }
 
--- a/dom/webidl/ArchiveReader.webidl
+++ b/dom/webidl/ArchiveReader.webidl
@@ -1,14 +1,14 @@
 /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
-[PrefControlled,
+[Pref="dom.archivereader.enabled",
  Constructor(Blob blob, optional ArchiveReaderOptions options)]
 interface ArchiveReader {
   ArchiveRequest getFilenames();
   ArchiveRequest getFile(DOMString filename);
   ArchiveRequest getFiles();
 };
 
 dictionary ArchiveReaderOptions {
--- a/dom/webidl/CSS.webidl
+++ b/dom/webidl/CSS.webidl
@@ -5,16 +5,16 @@
  *
  * The origin of this IDL file is
  * http://dev.w3.org/csswg/css3-conditional/
  *
  * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C
  * liability, trademark and document use rules apply.
  */
 
-[PrefControlled]
+[Pref="layout.css.supports-rule.enabled"]
 interface CSS {
   [Throws, Pref="layout.css.supports-rule.enabled"]
   static boolean supports(DOMString property, DOMString value);
 
   [Throws, Pref="layout.css.supports-rule.enabled"]
   static boolean supports(DOMString conditionText);
 };
--- a/dom/webidl/EventSource.webidl
+++ b/dom/webidl/EventSource.webidl
@@ -6,17 +6,18 @@
  * The origin of this IDL file is
  * http://www.whatwg.org/specs/web-apps/current-work/
  *
  * © Copyright 2004-2011 Apple Computer, Inc., Mozilla Foundation, and
  * Opera Software ASA. You are granted a license to use, reproduce
  * and create derivative works of this document.
  */
 
-[Constructor(DOMString url, optional EventSourceInit eventSourceInitDict), PrefControlled]
+[Constructor(DOMString url, optional EventSourceInit eventSourceInitDict),
+ Func="mozilla::dom::EventSource::PrefEnabled"]
 interface EventSource : EventTarget {
   [Constant]
   readonly attribute DOMString url;
   [Constant]
   readonly attribute boolean withCredentials;
 
   // ready state
   const unsigned short CONNECTING = 0;
--- a/dom/webidl/MozActivity.webidl
+++ b/dom/webidl/MozActivity.webidl
@@ -1,11 +1,12 @@
 /* -*- Mode: IDL; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim: set ts=2 et sw=2 tw=80: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 interface ActivityOptions;
 
-[PrefControlled, Constructor(ActivityOptions options)]
+[Pref="dom.sysmsg.enabled",
+ Constructor(ActivityOptions options)]
 interface MozActivity : DOMRequest {
 };
--- a/dom/webidl/MozTimeManager.webidl
+++ b/dom/webidl/MozTimeManager.webidl
@@ -1,13 +1,13 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
-[PrefControlled]
+[Func="mozilla::dom::time::TimeManager::PrefEnabled"]
 interface MozTimeManager {
   /* Set the system time.
    *
    * The |time| argument can be either a Date object or a number.
    *
    * - If |time| is a number, it's interpreted as milliseconds
    *   since the epoch (midnight UTC on January 1, 1970).
    * - If |time| is a Date object, |set(time)| is equivalent to
--- a/dom/webidl/Notification.webidl
+++ b/dom/webidl/Notification.webidl
@@ -6,17 +6,18 @@
  * The origin of this IDL file is
  * http://notifications.spec.whatwg.org/
  *
  * Copyright:
  * To the extent possible under law, the editors have waived all copyright and
  * related or neighboring rights to this work.
  */
 
-[PrefControlled, Constructor(DOMString title, optional NotificationOptions options)]
+[Pref="dom.webnotifications.enabled",
+ Constructor(DOMString title, optional NotificationOptions options)]
 interface Notification : EventTarget {
   [GetterThrows]
   static readonly attribute NotificationPermission permission;
 
   [Throws]
   static void requestPermission(optional NotificationPermissionCallback permissionCallback);
 
   [Throws]
--- a/dom/webidl/ShadowRoot.webidl
+++ b/dom/webidl/ShadowRoot.webidl
@@ -5,17 +5,17 @@
  *
  * The origin of this IDL file is
  * https://dvcs.w3.org/hg/webcomponents/raw-file/tip/spec/shadow/index.html
  *
  * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C
  * liability, trademark and document use rules apply.
  */
 
-[PrefControlled]
+[Pref="dom.webcomponents.enabled"]
 interface ShadowRoot : DocumentFragment
 {
   Element? getElementById(DOMString elementId);
   HTMLCollection getElementsByTagName(DOMString localName);
   HTMLCollection getElementsByTagNameNS(DOMString? namespace, DOMString localName);
   HTMLCollection getElementsByClassName(DOMString classNames);
   [SetterThrows,TreatNullAs=EmptyString]
   attribute DOMString innerHTML;
--- a/dom/webidl/SharedWorker.webidl
+++ b/dom/webidl/SharedWorker.webidl
@@ -1,13 +1,13 @@
 /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
-[PrefControlled,
+[Pref="dom.workers.sharedWorkers.enabled",
  Constructor(DOMString scriptURL, optional DOMString name)]
 interface SharedWorker : EventTarget {
     readonly attribute MessagePort port;
 };
 
 SharedWorker implements AbstractWorker;
--- a/dom/webidl/SpeechGrammar.webidl
+++ b/dom/webidl/SpeechGrammar.webidl
@@ -5,16 +5,17 @@
  *
  * The origin of this IDL file is
  * http://dvcs.w3.org/hg/speech-api/raw-file/tip/speechapi.html
  *
  * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C
  * liability, trademark and document use rules apply.
  */
 
-[Constructor, PrefControlled]
+[Constructor,
+ Func="mozilla::dom::SpeechGrammar::PrefEnabled"]
 interface SpeechGrammar {
     [Throws]
     attribute DOMString src;
     [Throws]
     attribute float weight;
 };
 
--- a/dom/webidl/SpeechGrammarList.webidl
+++ b/dom/webidl/SpeechGrammarList.webidl
@@ -5,17 +5,17 @@
  *
  * The origin of this IDL file is
  * http://dvcs.w3.org/hg/speech-api/raw-file/tip/speechapi.html
  *
  * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C
  * liability, trademark and document use rules apply.
  */
 
-[PrefControlled]
+[Func="mozilla::dom::SpeechGrammarList::PrefEnabled"]
 interface SpeechGrammarList {
     readonly attribute unsigned long length;
     [Throws]
     getter SpeechGrammar item(unsigned long index);
     [Throws]
     void addFromURI(DOMString src, optional float weight);
     [Throws]
     void addFromString(DOMString string, optional float weight);
--- a/dom/webidl/SpeechRecognition.webidl
+++ b/dom/webidl/SpeechRecognition.webidl
@@ -5,17 +5,18 @@
  *
  * The origin of this IDL file is
  * http://dvcs.w3.org/hg/speech-api/raw-file/tip/speechapi.html
  *
  * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C
  * liability, trademark and document use rules apply.
  */
 
-[Constructor, PrefControlled]
+[Constructor,
+ Func="mozilla::dom::SpeechRecognition::PrefEnabled"]
 interface SpeechRecognition : EventTarget {
     // recognition parameters
     [Throws]
     attribute SpeechGrammarList grammars;
     [Throws]
     attribute DOMString lang;
     [Throws]
     attribute boolean continuous;
--- a/dom/webidl/SpeechRecognitionAlternative.webidl
+++ b/dom/webidl/SpeechRecognitionAlternative.webidl
@@ -5,13 +5,13 @@
  *
  * The origin of this IDL file is
  * http://dvcs.w3.org/hg/speech-api/raw-file/tip/speechapi.html
  *
  * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C
  * liability, trademark and document use rules apply.
  */
 
-[PrefControlled]
+[Func="mozilla::dom::SpeechRecognitionAlternative::PrefEnabled"]
 interface SpeechRecognitionAlternative {
     readonly attribute DOMString transcript;
     readonly attribute float confidence;
 };
--- a/dom/webidl/SpeechRecognitionResult.webidl
+++ b/dom/webidl/SpeechRecognitionResult.webidl
@@ -5,14 +5,14 @@
  *
  * The origin of this IDL file is
  * http://dvcs.w3.org/hg/speech-api/raw-file/tip/speechapi.html
  *
  * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C
  * liability, trademark and document use rules apply.
  */
 
-[PrefControlled]
+[Func="mozilla::dom::SpeechRecognitionResult::PrefEnabled"]
 interface SpeechRecognitionResult {
     readonly attribute unsigned long length;
     getter SpeechRecognitionAlternative item(unsigned long index);
     readonly attribute boolean final;
 };
--- a/dom/webidl/SpeechRecognitionResultList.webidl
+++ b/dom/webidl/SpeechRecognitionResultList.webidl
@@ -5,13 +5,13 @@
  *
  * The origin of this IDL file is
  * http://dvcs.w3.org/hg/speech-api/raw-file/tip/speechapi.html
  *
  * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C
  * liability, trademark and document use rules apply.
  */
 
-[PrefControlled]
+[Func="mozilla::dom::SpeechRecognitionResultList::PrefEnabled"]
 interface SpeechRecognitionResultList {
     readonly attribute unsigned long length;
     getter SpeechRecognitionResult item(unsigned long index);
 };
--- a/dom/webidl/SpeechSynthesis.webidl
+++ b/dom/webidl/SpeechSynthesis.webidl
@@ -5,17 +5,17 @@
  *
  * The origin of this IDL file is
  * http://dvcs.w3.org/hg/speech-api/raw-file/tip/speechapi.html
  *
  * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C
  * liability, trademark and document use rules apply.
  */
 
-[PrefControlled]
+[Func="mozilla::dom::SpeechSynthesis::PrefEnabled"]
 interface SpeechSynthesis {
   readonly attribute boolean pending;
   readonly attribute boolean speaking;
   readonly attribute boolean paused;
 
   void speak(SpeechSynthesisUtterance utterance);
   void cancel();
   void pause();
--- a/dom/webidl/SpeechSynthesisUtterance.webidl
+++ b/dom/webidl/SpeechSynthesisUtterance.webidl
@@ -5,17 +5,17 @@
  *
  * The origin of this IDL file is
  * http://dvcs.w3.org/hg/speech-api/raw-file/tip/speechapi.html
  *
  * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C
  * liability, trademark and document use rules apply.
  */
 
-[PrefControlled,
+[Func="mozilla::dom::SpeechSynthesisUtterance::PrefEnabled",
  Constructor,
  Constructor(DOMString text)]
 interface SpeechSynthesisUtterance : EventTarget {
   attribute DOMString text;
   attribute DOMString lang;
   attribute SpeechSynthesisVoice? voice;
   attribute float volume;
   attribute float rate;
--- a/dom/webidl/SpeechSynthesisVoice.webidl
+++ b/dom/webidl/SpeechSynthesisVoice.webidl
@@ -5,16 +5,16 @@
  *
  * The origin of this IDL file is
  * http://dvcs.w3.org/hg/speech-api/raw-file/tip/speechapi.html
  *
  * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C
  * liability, trademark and document use rules apply.
  */
 
-[PrefControlled]
+[Func="mozilla::dom::SpeechSynthesisVoice::PrefEnabled"]
 interface SpeechSynthesisVoice {
   readonly attribute DOMString voiceURI;
   readonly attribute DOMString name;
   readonly attribute DOMString lang;
   readonly attribute boolean localService;
   readonly attribute boolean default;
 };
--- a/dom/webidl/Touch.webidl
+++ b/dom/webidl/Touch.webidl
@@ -5,17 +5,17 @@
  *
  * The origin of this IDL file is
  * http://dvcs.w3.org/hg/webevents/raw-file/default/touchevents.html
  *
  * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C
  * liability, trademark and document use rules apply.
  */
 
-[PrefControlled]
+[Func="mozilla::dom::Touch::PrefEnabled"]
 interface Touch {
   readonly    attribute long        identifier;
   readonly    attribute EventTarget target;
   readonly    attribute long        screenX;
   readonly    attribute long        screenY;
   readonly    attribute long        clientX;
   readonly    attribute long        clientY;
   readonly    attribute long        pageX;
--- a/dom/webidl/TouchEvent.webidl
+++ b/dom/webidl/TouchEvent.webidl
@@ -1,17 +1,17 @@
 /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
 interface WindowProxy;
 
-[PrefControlled]
+[Func="nsDOMTouchEvent::PrefEnabled"]
 interface TouchEvent : UIEvent {
   readonly attribute TouchList touches;
   readonly attribute TouchList targetTouches;
   readonly attribute TouchList changedTouches;
 
   readonly attribute boolean altKey;
   readonly attribute boolean metaKey;
   readonly attribute boolean ctrlKey;
--- a/dom/webidl/TouchList.webidl
+++ b/dom/webidl/TouchList.webidl
@@ -5,17 +5,17 @@
  *
  * The origin of this IDL file is
  * https://dvcs.w3.org/hg/webevents/raw-file/v1/touchevents.html
  *
  * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C
  * liability, trademark and document use rules apply.
  */
 
-[PrefControlled]
+[Func="nsDOMTouchList::PrefEnabled"]
 interface TouchList {
   [Pure]
   readonly attribute unsigned long length;
   getter Touch? item(unsigned long index);
 };
 
 /* Mozilla extension. */
 partial interface TouchList {
--- a/dom/webidl/UndoManager.webidl
+++ b/dom/webidl/UndoManager.webidl
@@ -5,17 +5,17 @@
  *
  * The origin of this IDL file is
  * http://dvcs.w3.org/hg/undomanager/raw-file/tip/undomanager.html
  *
  * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C
  * liability, trademark and document use rules apply.
  */
 
-[PrefControlled]
+[Pref="dom.undo_manager.enabled"]
 interface UndoManager {
   [Throws] void transact(DOMTransaction transaction, boolean merge);
   [Throws] void undo();
   [Throws] void redo();
   [Throws] sequence<DOMTransaction>? item(unsigned long index);
   [Throws] readonly attribute unsigned long length;
   [Throws] readonly attribute unsigned long position;
   [Throws] void clearUndo();
--- a/dom/webidl/WebSocket.webidl
+++ b/dom/webidl/WebSocket.webidl
@@ -7,17 +7,17 @@
  * http://www.whatwg.org/html/#network
  *
  * © Copyright 2004-2011 Apple Computer, Inc., Mozilla Foundation, and Opera Software ASA.
  * You are granted a license to use, reproduce and create derivative works of this document.
  */
 
 enum BinaryType { "blob", "arraybuffer" };
 
-[PrefControlled,
+[Func="mozilla::dom::WebSocket::PrefEnabled",
  Constructor(DOMString url),
  Constructor(DOMString url, DOMString protocols),
  Constructor(DOMString url, sequence<DOMString> protocols)]
 interface WebSocket : EventTarget {
 
   readonly attribute DOMString url;
 
   // ready state
--- a/dom/workers/SharedWorker.cpp
+++ b/dom/workers/SharedWorker.cpp
@@ -18,22 +18,16 @@
 #include "RuntimeService.h"
 #include "WorkerPrivate.h"
 
 using mozilla::dom::Optional;
 using mozilla::dom::Sequence;
 
 USING_WORKERS_NAMESPACE
 
-namespace {
-
-const char kSharedWorkersEnabledPref[] = "dom.workers.sharedWorkers.enabled";
-
-} // anonymous namespace
-
 SharedWorker::SharedWorker(nsPIDOMWindow* aWindow,
                            WorkerPrivate* aWorkerPrivate)
 : nsDOMEventTargetHelper(aWindow), mWorkerPrivate(aWorkerPrivate),
   mSuspended(false)
 {
   AssertIsOnMainThread();
   MOZ_ASSERT(aWorkerPrivate);
 
@@ -43,25 +37,16 @@ SharedWorker::SharedWorker(nsPIDOMWindow
 }
 
 SharedWorker::~SharedWorker()
 {
   AssertIsOnMainThread();
   MOZ_ASSERT(!mWorkerPrivate);
 }
 
-//static
-bool
-SharedWorker::PrefEnabled()
-{
-  AssertIsOnMainThread();
-
-  return mozilla::Preferences::GetBool(kSharedWorkersEnabledPref, false);
-}
-
 // static
 already_AddRefed<SharedWorker>
 SharedWorker::Constructor(const GlobalObject& aGlobal, JSContext* aCx,
                           const nsAString& aScriptURL,
                           const mozilla::dom::Optional<nsAString>& aName,
                           ErrorResult& aRv)
 {
   AssertIsOnMainThread();
--- a/dom/workers/SharedWorker.h
+++ b/dom/workers/SharedWorker.h
@@ -31,19 +31,16 @@ class SharedWorker MOZ_FINAL : public ns
 
   nsRefPtr<WorkerPrivate> mWorkerPrivate;
   nsRefPtr<MessagePort> mMessagePort;
   nsTArray<nsCOMPtr<nsIDOMEvent>> mSuspendedEvents;
   uint64_t mSerial;
   bool mSuspended;
 
 public:
-  static bool
-  PrefEnabled();
-
   static already_AddRefed<SharedWorker>
   Constructor(const GlobalObject& aGlobal, JSContext* aCx,
               const nsAString& aScriptURL, const Optional<nsAString>& aName,
               ErrorResult& aRv);
 
   already_AddRefed<MessagePort>
   Port();
 
--- a/layout/style/CSS.h
+++ b/layout/style/CSS.h
@@ -27,19 +27,14 @@ public:
   static bool Supports(const GlobalObject& aGlobal,
                        const nsAString& aProperty,
                        const nsAString& aValue,
                        ErrorResult& aRv);
 
   static bool Supports(const GlobalObject& aGlobal,
                        const nsAString& aDeclaration,
                        ErrorResult& aRv);
-
-  static bool PrefEnabled()
-  {
-    return Preferences::GetBool("layout.css.supports-rule.enabled");
-  }
 };
 
 } // namespace dom
 } // namespace mozilla
 
 #endif // mozilla_dom_CSS_h_
--- a/modules/libpref/src/init/all.js
+++ b/modules/libpref/src/init/all.js
@@ -108,16 +108,19 @@ pref("dom.enable_performance", true);
 // Whether the Gamepad API is enabled
 pref("dom.gamepad.enabled", true);
 #ifdef RELEASE_BUILD
 pref("dom.gamepad.non_standard_events.enabled", false);
 #else
 pref("dom.gamepad.non_standard_events.enabled", true);
 #endif
 
+// Whether the UndoManager API is enabled
+pref("dom.undo_manager.enabled", false);
+
 // Fastback caching - if this pref is negative, then we calculate the number
 // of content viewers to cache based on the amount of available memory.
 pref("browser.sessionhistory.max_total_viewers", -1);
 
 pref("ui.use_native_colors", true);
 pref("ui.click_hold_context_menus", false);
 pref("browser.display.use_document_fonts",  1);  // 0 = never, 1 = quick, 2 = always
 pref("browser.display.use_document_colors", true);