Bug 834699 - Stop checking dom.xbl_scopes. r=bz
authorBobby Holley <bobbyholley@gmail.com>
Thu, 02 May 2013 16:02:03 -0700
changeset 130676 d56decca3e60
parent 130675 a780fd43acc2
child 130677 e4074e65f6e2
push id27484
push userbobbyholley@gmail.com
push dateThu, 02 May 2013 23:03:56 +0000
treeherdermozilla-inbound@e4074e65f6e2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbz
bugs834699
milestone23.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 834699 - Stop checking dom.xbl_scopes. r=bz
content/base/public/nsINode.h
content/base/src/nsINode.cpp
dom/base/nsGlobalWindow.cpp
dom/webidl/Node.webidl
js/xpconnect/src/XPCJSRuntime.cpp
js/xpconnect/src/XPCWrappedNativeScope.cpp
js/xpconnect/src/xpcprivate.h
modules/libpref/src/init/all.js
--- a/content/base/public/nsINode.h
+++ b/content/base/public/nsINode.h
@@ -1138,17 +1138,17 @@ public:
   
     return NS_OK;
   }
 
   /**
    * Control if GetUserData and SetUserData methods will be exposed to
    * unprivileged content.
    */
-  static bool ShouldExposeUserData(JSContext* aCx, JSObject* /* unused */);
+  static bool IsChromeOrXBL(JSContext* aCx, JSObject* /* unused */);
 
   void LookupPrefix(const nsAString& aNamespace, nsAString& aResult);
   bool IsDefaultNamespace(const nsAString& aNamespaceURI)
   {
     nsAutoString defaultNamespace;
     LookupNamespaceURI(EmptyString(), defaultNamespace);
     return aNamespaceURI.Equals(defaultNamespace);
   }
--- a/content/base/src/nsINode.cpp
+++ b/content/base/src/nsINode.cpp
@@ -90,17 +90,16 @@
 #include "nsSVGFeatures.h"
 #include "nsSVGUtils.h"
 #include "nsTextNode.h"
 #include "nsUnicharUtils.h"
 #include "nsXBLBinding.h"
 #include "nsXBLInsertionPoint.h"
 #include "nsXBLPrototypeBinding.h"
 #include "prprf.h"
-#include "xpcprivate.h" // XBLScopesEnabled
 #include "xpcpublic.h"
 #include "nsCSSRuleProcessor.h"
 #include "nsCSSParser.h"
 #include "HTMLLegendElement.h"
 #include "nsWrapperCacheInlines.h"
 #include "WrapperFactory.h"
 #include "DocumentType.h"
 #include <algorithm>
@@ -717,22 +716,21 @@ nsINode::GetUserData(JSContext* aCx, con
   JSAutoCompartment ac(aCx, GetWrapper());
   aError = nsContentUtils::XPConnect()->VariantToJS(aCx, GetWrapper(), data,
                                                     &result);
   return result;
 }
 
 //static
 bool
-nsINode::ShouldExposeUserData(JSContext* aCx, JSObject* /* unused */)
+nsINode::IsChromeOrXBL(JSContext* aCx, JSObject* /* unused */)
 {
   JSCompartment* compartment = js::GetContextCompartment(aCx);
   return xpc::AccessCheck::isChrome(compartment) ||
-         xpc::IsXBLScope(compartment) ||
-         !XPCJSRuntime::Get()->XBLScopesEnabled();
+         xpc::IsXBLScope(compartment);
 }
 
 uint16_t
 nsINode::CompareDocumentPosition(nsINode& aOtherNode) const
 {
   if (this == &aOtherNode) {
     return 0;
   }
--- a/dom/base/nsGlobalWindow.cpp
+++ b/dom/base/nsGlobalWindow.cpp
@@ -2085,19 +2085,17 @@ CreateNativeGlobalForInner(JSContext* aC
     if (top->GetGlobalJSObject()) {
       zoneSpec = JS::SameZoneAs(top->GetGlobalJSObject());
     }
   }
 
   nsIXPConnect* xpc = nsContentUtils::XPConnect();
 
   // Determine if we need the Components object.
-  bool componentsInContent =
-    !Preferences::GetBool("dom.omit_components_in_content", true) ||
-    !Preferences::GetBool("dom.xbl_scopes", true);
+  bool componentsInContent = !Preferences::GetBool("dom.omit_components_in_content", true);
   bool needComponents = componentsInContent ||
                         nsContentUtils::IsSystemPrincipal(aPrincipal) ||
                         TreatAsRemoteXUL(aPrincipal);
   uint32_t flags = needComponents ? 0 : nsIXPConnect::OMIT_COMPONENTS_OBJECT;
 
   nsRefPtr<nsIXPConnectJSObjectHolder> jsholder;
   nsresult rv = xpc->InitClassesWithNewWrappedGlobal(
     aCx, ToSupports(aNewInner),
--- a/dom/webidl/Node.webidl
+++ b/dom/webidl/Node.webidl
@@ -91,17 +91,17 @@ interface Node : EventTarget {
   [Constant]
   readonly attribute DOMString? namespaceURI;
   [Constant]
   readonly attribute DOMString? prefix;
   [Constant]
   readonly attribute DOMString? localName;
 
   boolean hasAttributes();
-  [Throws, Func="nsINode::ShouldExposeUserData"]
+  [Throws, Func="nsINode::IsChromeOrXBL"]
   any setUserData(DOMString key, any data, UserDataHandler? handler);
-  [Throws, Func="nsINode::ShouldExposeUserData"]
+  [Throws, Func="nsINode::IsChromeOrXBL"]
   any getUserData(DOMString key);
   [ChromeOnly]
   readonly attribute Principal nodePrincipal;
   [ChromeOnly]
   readonly attribute URI? baseURIObject;
 };
--- a/js/xpconnect/src/XPCJSRuntime.cpp
+++ b/js/xpconnect/src/XPCJSRuntime.cpp
@@ -2491,18 +2491,16 @@ CompartmentNameCallback(JSRuntime *rt, J
 {
     nsCString name;
     GetCompartmentName(comp, name, false);
     if (name.Length() >= bufsize)
         name.Truncate(bufsize - 1);
     memcpy(buf, name.get(), name.Length() + 1);
 }
 
-bool XPCJSRuntime::gXBLScopesEnabled;
-
 static bool
 PreserveWrapper(JSContext *cx, JSObject *objArg)
 {
     MOZ_ASSERT(cx);
     MOZ_ASSERT(objArg);
     MOZ_ASSERT(js::GetObjectClass(objArg)->ext.isWrappedNative ||
                mozilla::dom::IsDOMObject(objArg));
 
@@ -2663,20 +2661,16 @@ XPCJSRuntime::XPCJSRuntime(nsXPConnect* 
 {
 #ifdef XPC_CHECK_WRAPPERS_AT_SHUTDOWN
     DEBUG_WrappedNativeHashtable =
         JS_NewDHashTable(JS_DHashGetStubOps(), nullptr,
                          sizeof(JSDHashEntryStub), 128);
 #endif
 
     DOM_InitInterfaces();
-    Preferences::AddBoolVarCache(&gXBLScopesEnabled,
-                                 "dom.xbl_scopes",
-                                 false);
-
 
     // these jsids filled in later when we have a JSContext to work with.
     mStrIDs[0] = JSID_VOID;
 
     mJSRuntime = JS_NewRuntime(32L * 1024L * 1024L, JS_USE_HELPER_THREADS); // pref ?
     if (!mJSRuntime)
         NS_RUNTIMEABORT("JS_NewRuntime failed.");
 
--- a/js/xpconnect/src/XPCWrappedNativeScope.cpp
+++ b/js/xpconnect/src/XPCWrappedNativeScope.cpp
@@ -155,18 +155,17 @@ XPCWrappedNativeScope::XPCWrappedNativeS
     // Attach ourselves to the compartment private.
     CompartmentPrivate *priv = EnsureCompartmentPrivate(aGlobal);
     priv->scope = this;
 
     // Determine whether we would allow an XBL scope in this situation.
     // In addition to being pref-controlled, we also disable XBL scopes for
     // remote XUL domains, _except_ if we have an additional pref override set.
     nsIPrincipal *principal = GetPrincipal();
-    mAllowXBLScope = XPCJSRuntime::Get()->XBLScopesEnabled() &&
-                     !RemoteXULForbidsXBLScope(principal);
+    mAllowXBLScope = !RemoteXULForbidsXBLScope(principal);
 
     // Determine whether to use an XBL scope.
     mUseXBLScope = mAllowXBLScope;
     if (mUseXBLScope) {
       js::Class *clasp = js::GetObjectClass(mGlobalJSObject);
       mUseXBLScope = !strcmp(clasp->name, "Window") ||
                      !strcmp(clasp->name, "ChromeWindow") ||
                      !strcmp(clasp->name, "ModalContentWindow");
--- a/js/xpconnect/src/xpcprivate.h
+++ b/js/xpconnect/src/xpcprivate.h
@@ -884,20 +884,16 @@ public:
 
     void AddGCCallback(JSGCCallback cb);
     void RemoveGCCallback(JSGCCallback cb);
 
     static void ActivityCallback(void *arg, JSBool active);
     static void CTypesActivityCallback(JSContext *cx,
                                        js::CTypesActivityType type);
 
-    bool XBLScopesEnabled() {
-        return gXBLScopesEnabled;
-    }
-
     size_t SizeOfIncludingThis(nsMallocSizeOfFun mallocSizeOf);
 
     AutoMarkingPtr**  GetAutoRootsAdr() {return &mAutoRoots;}
 
     JSObject* GetJunkScope();
     void DeleteJunkScope();
 private:
     XPCJSRuntime(); // no implementation
@@ -905,18 +901,16 @@ private:
 
     // The caller must be holding the GC lock
     void RescheduleWatchdog(XPCContext* ccx);
 
     static void WatchdogMain(void *arg);
 
     void ReleaseIncrementally(nsTArray<nsISupports *> &array);
 
-    static bool gXBLScopesEnabled;
-
     static const char* mStrings[IDX_TOTAL_COUNT];
     jsid mStrIDs[IDX_TOTAL_COUNT];
     jsval mStrJSVals[IDX_TOTAL_COUNT];
 
     nsXPConnect*             mXPConnect;
     JSRuntime*               mJSRuntime;
     XPCJSContextStack*       mJSContextStack;
     XPCCallContext*          mCallContext;
--- a/modules/libpref/src/init/all.js
+++ b/modules/libpref/src/init/all.js
@@ -731,19 +731,16 @@ pref("dom.storage.default_quota",      5
 
 pref("dom.send_after_paint_to_content", false);
 
 // Timeout clamp in ms for timeouts we clamp
 pref("dom.min_timeout_value", 4);
 // And for background windows
 pref("dom.min_background_timeout_value", 1000);
 
-// Run content XBL in a separate scope.
-pref("dom.xbl_scopes", true);
-
 // Stop defining the Components object in content.
 pref("dom.omit_components_in_content", true);
 
 // Don't use new input types
 pref("dom.experimental_forms", false);
 
 // Don't enable <input type=range> yet:
 pref("dom.experimental_forms_range", true);