From 4d84f3f37ca4704f53d4036b8f00262b78e75455 Mon Sep 17 00:00:00 2001 From: Bobby Holley Date: Thu, 2 May 2013 16:02:03 -0700 Subject: [PATCH] Bug 834699 - Stop checking dom.xbl_scopes. r=bz --- content/base/public/nsINode.h | 2 +- content/base/src/nsINode.cpp | 6 ++---- dom/base/nsGlobalWindow.cpp | 4 +--- dom/webidl/Node.webidl | 4 ++-- js/xpconnect/src/XPCJSRuntime.cpp | 6 ------ js/xpconnect/src/XPCWrappedNativeScope.cpp | 3 +-- js/xpconnect/src/xpcprivate.h | 6 ------ modules/libpref/src/init/all.js | 3 --- 8 files changed, 7 insertions(+), 27 deletions(-) diff --git a/content/base/public/nsINode.h b/content/base/public/nsINode.h index 30aef162e80..cb579efe0f9 100644 --- a/content/base/public/nsINode.h +++ b/content/base/public/nsINode.h @@ -1143,7 +1143,7 @@ public: * 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) diff --git a/content/base/src/nsINode.cpp b/content/base/src/nsINode.cpp index c413a9b4cad..b4630a3e214 100644 --- a/content/base/src/nsINode.cpp +++ b/content/base/src/nsINode.cpp @@ -95,7 +95,6 @@ #include "nsXBLInsertionPoint.h" #include "nsXBLPrototypeBinding.h" #include "prprf.h" -#include "xpcprivate.h" // XBLScopesEnabled #include "xpcpublic.h" #include "nsCSSRuleProcessor.h" #include "nsCSSParser.h" @@ -722,12 +721,11 @@ nsINode::GetUserData(JSContext* aCx, const nsAString& aKey, ErrorResult& aError) //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 diff --git a/dom/base/nsGlobalWindow.cpp b/dom/base/nsGlobalWindow.cpp index 87e1beb07be..88db8d0b1c8 100644 --- a/dom/base/nsGlobalWindow.cpp +++ b/dom/base/nsGlobalWindow.cpp @@ -2090,9 +2090,7 @@ CreateNativeGlobalForInner(JSContext* aCx, 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); diff --git a/dom/webidl/Node.webidl b/dom/webidl/Node.webidl index e878eaa1340..c6084de8f9f 100644 --- a/dom/webidl/Node.webidl +++ b/dom/webidl/Node.webidl @@ -96,9 +96,9 @@ interface Node : EventTarget { 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; diff --git a/js/xpconnect/src/XPCJSRuntime.cpp b/js/xpconnect/src/XPCJSRuntime.cpp index 20ea380f167..fc7564c449d 100644 --- a/js/xpconnect/src/XPCJSRuntime.cpp +++ b/js/xpconnect/src/XPCJSRuntime.cpp @@ -2496,8 +2496,6 @@ CompartmentNameCallback(JSRuntime *rt, JSCompartment *comp, memcpy(buf, name.get(), name.Length() + 1); } -bool XPCJSRuntime::gXBLScopesEnabled; - static bool PreserveWrapper(JSContext *cx, JSObject *objArg) { @@ -2668,10 +2666,6 @@ XPCJSRuntime::XPCJSRuntime(nsXPConnect* aXPConnect) #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; diff --git a/js/xpconnect/src/XPCWrappedNativeScope.cpp b/js/xpconnect/src/XPCWrappedNativeScope.cpp index 7a8c385fbf4..ba4f05a0c8b 100644 --- a/js/xpconnect/src/XPCWrappedNativeScope.cpp +++ b/js/xpconnect/src/XPCWrappedNativeScope.cpp @@ -160,8 +160,7 @@ XPCWrappedNativeScope::XPCWrappedNativeScope(JSContext *cx, // 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; diff --git a/js/xpconnect/src/xpcprivate.h b/js/xpconnect/src/xpcprivate.h index c845ea78659..228d52807b5 100644 --- a/js/xpconnect/src/xpcprivate.h +++ b/js/xpconnect/src/xpcprivate.h @@ -889,10 +889,6 @@ public: static void CTypesActivityCallback(JSContext *cx, js::CTypesActivityType type); - bool XBLScopesEnabled() { - return gXBLScopesEnabled; - } - size_t SizeOfIncludingThis(nsMallocSizeOfFun mallocSizeOf); AutoMarkingPtr** GetAutoRootsAdr() {return &mAutoRoots;} @@ -910,8 +906,6 @@ private: void ReleaseIncrementally(nsTArray &array); - static bool gXBLScopesEnabled; - static const char* mStrings[IDX_TOTAL_COUNT]; jsid mStrIDs[IDX_TOTAL_COUNT]; jsval mStrJSVals[IDX_TOTAL_COUNT]; diff --git a/modules/libpref/src/init/all.js b/modules/libpref/src/init/all.js index c127d2bccda..c02c58ec817 100644 --- a/modules/libpref/src/init/all.js +++ b/modules/libpref/src/init/all.js @@ -736,9 +736,6 @@ 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);