diff --git a/caps/src/nsScriptSecurityManager.cpp b/caps/src/nsScriptSecurityManager.cpp index 0f8f38935b08..189155bbc507 100644 --- a/caps/src/nsScriptSecurityManager.cpp +++ b/caps/src/nsScriptSecurityManager.cpp @@ -1039,7 +1039,7 @@ nsScriptSecurityManager::CanCreateWrapper(JSContext *cx, } // We give remote-XUL whitelisted domains a free pass here. See bug 932906. - if (!xpc::AllowXBLScope(js::GetContextCompartment(cx))) + if (!xpc::AllowContentXBLScope(js::GetContextCompartment(cx))) { return NS_OK; } diff --git a/content/base/public/nsContentUtils.h b/content/base/public/nsContentUtils.h index 5b9e63053a35..c4adeb32df44 100644 --- a/content/base/public/nsContentUtils.h +++ b/content/base/public/nsContentUtils.h @@ -188,7 +188,7 @@ public: static bool IsCallerChrome(); static bool ThreadsafeIsCallerChrome(); - static bool IsCallerXBL(); + static bool IsCallerContentXBL(); static bool IsImageSrcSetDisabled(); diff --git a/content/base/src/nsContentUtils.cpp b/content/base/src/nsContentUtils.cpp index 003ad36d0957..f47f55fe78e2 100644 --- a/content/base/src/nsContentUtils.cpp +++ b/content/base/src/nsContentUtils.cpp @@ -1714,7 +1714,7 @@ nsContentUtils::ThreadsafeIsCallerChrome() } bool -nsContentUtils::IsCallerXBL() +nsContentUtils::IsCallerContentXBL() { JSContext *cx = GetCurrentJSContext(); if (!cx) @@ -1724,12 +1724,12 @@ nsContentUtils::IsCallerXBL() // For remote XUL, we run XBL in the XUL scope. Given that we care about // compat and not security for remote XUL, just always claim to be XBL. - if (!xpc::AllowXBLScope(c)) { + if (!xpc::AllowContentXBLScope(c)) { MOZ_ASSERT(nsContentUtils::AllowXULXBLForPrincipal(xpc::GetCompartmentPrincipal(c))); return true; } - return xpc::IsXBLScope(c); + return xpc::IsContentXBLScope(c); } @@ -5585,7 +5585,7 @@ nsContentTypeParser::GetParameter(const char* aParameterName, nsAString& aResult bool nsContentUtils::CanAccessNativeAnon() { - return IsCallerChrome() || IsCallerXBL(); + return IsCallerChrome() || IsCallerContentXBL(); } /* static */ nsresult diff --git a/content/base/src/nsINode.cpp b/content/base/src/nsINode.cpp index 8b1a6bb33b3e..af3d3f5784c6 100644 --- a/content/base/src/nsINode.cpp +++ b/content/base/src/nsINode.cpp @@ -2660,7 +2660,7 @@ nsINode::WrapObject(JSContext *aCx) JS::Rooted obj(aCx, WrapNode(aCx)); MOZ_ASSERT_IF(ChromeOnlyAccess(), - xpc::IsInXBLScope(obj) || !xpc::UseXBLScope(js::GetObjectCompartment(obj))); + xpc::IsInContentXBLScope(obj) || !xpc::UseContentXBLScope(js::GetObjectCompartment(obj))); return obj; } diff --git a/content/base/src/nsObjectLoadingContent.cpp b/content/base/src/nsObjectLoadingContent.cpp index 4b6bb1bd8244..4e4efb74e40f 100644 --- a/content/base/src/nsObjectLoadingContent.cpp +++ b/content/base/src/nsObjectLoadingContent.cpp @@ -2650,7 +2650,7 @@ nsObjectLoadingContent::ScriptRequestPluginInstance(JSContext* aCx, MOZ_ASSERT_IF(nsContentUtils::GetCurrentJSContext(), aCx == nsContentUtils::GetCurrentJSContext()); bool callerIsContentJS = (!nsContentUtils::IsCallerChrome() && - !nsContentUtils::IsCallerXBL() && + !nsContentUtils::IsCallerContentXBL() && js::IsContextRunningJS(aCx)); nsCOMPtr thisContent = diff --git a/dom/bindings/BindingUtils.h b/dom/bindings/BindingUtils.h index 5daef9d9508f..5e4219afb4d4 100644 --- a/dom/bindings/BindingUtils.h +++ b/dom/bindings/BindingUtils.h @@ -1405,7 +1405,7 @@ WrapNativeParent(JSContext* cx, T* p, nsWrapperCache* cache, // If useXBLScope is true, it means that the canonical reflector for this // native object should live in the XBL scope. - if (xpc::IsInXBLScope(parent)) { + if (xpc::IsInContentXBLScope(parent)) { return parent; } JS::Rooted rootedParent(cx, parent); diff --git a/dom/xbl/nsXBLBinding.cpp b/dom/xbl/nsXBLBinding.cpp index 634f57d6ef0e..5731ad3b4afd 100644 --- a/dom/xbl/nsXBLBinding.cpp +++ b/dom/xbl/nsXBLBinding.cpp @@ -104,7 +104,7 @@ static const JSClass gPrototypeJSClass = { // Constructors/Destructors nsXBLBinding::nsXBLBinding(nsXBLPrototypeBinding* aBinding) : mMarkedForDeath(false) - , mUsingXBLScope(false) + , mUsingContentXBLScope(false) , mPrototypeBinding(aBinding) { NS_ASSERTION(mPrototypeBinding, "Must have a prototype binding!"); @@ -115,7 +115,7 @@ nsXBLBinding::nsXBLBinding(nsXBLPrototypeBinding* aBinding) // Constructor used by web components. nsXBLBinding::nsXBLBinding(ShadowRoot* aShadowRoot, nsXBLPrototypeBinding* aBinding) : mMarkedForDeath(false), - mUsingXBLScope(false), + mUsingContentXBLScope(false), mPrototypeBinding(aBinding), mContent(aShadowRoot) { @@ -278,7 +278,7 @@ nsXBLBinding::SetBoundElement(nsIContent* aElement) // is not given in the handler declaration. nsCOMPtr go = mBoundElement->OwnerDoc()->GetScopeObject(); NS_ENSURE_TRUE_VOID(go && go->GetGlobalJSObject()); - mUsingXBLScope = xpc::UseXBLScope(js::GetObjectCompartment(go->GetGlobalJSObject())); + mUsingContentXBLScope = xpc::UseContentXBLScope(js::GetObjectCompartment(go->GetGlobalJSObject())); } bool @@ -512,7 +512,7 @@ nsXBLBinding::InstallEventHandlers() bool hasAllowUntrustedAttr = curr->HasAllowUntrustedAttr(); if ((hasAllowUntrustedAttr && curr->AllowUntrustedEvents()) || - (!hasAllowUntrustedAttr && !isChromeDoc && !mUsingXBLScope)) { + (!hasAllowUntrustedAttr && !isChromeDoc && !mUsingContentXBLScope)) { flags.mAllowUntrustedEvents = true; } @@ -528,7 +528,7 @@ nsXBLBinding::InstallEventHandlers() for (i = 0; i < keyHandlers->Count(); ++i) { nsXBLKeyEventHandler* handler = keyHandlers->ObjectAt(i); handler->SetIsBoundToChrome(isChromeDoc); - handler->SetUsingXBLScope(mUsingXBLScope); + handler->SetUsingContentXBLScope(mUsingContentXBLScope); nsAutoString type; handler->GetEventName(type); @@ -920,8 +920,8 @@ GetOrCreateMapEntryForPrototype(JSContext *cx, JS::Handle proto) // So we define two maps - one class objects that live in content (prototyped // to content prototypes), and the other for class objects that live in the // XBL scope (prototyped to cross-compartment-wrapped content prototypes). - const char* name = xpc::IsInXBLScope(proto) ? "__ContentClassObjectMap__" - : "__XBLClassObjectMap__"; + const char* name = xpc::IsInContentXBLScope(proto) ? "__ContentClassObjectMap__" + : "__XBLClassObjectMap__"; // Now, enter the XBL scope, since that's where we need to operate, and wrap // the proto accordingly. @@ -1116,7 +1116,7 @@ nsXBLBinding::LookupMember(JSContext* aCx, JS::Handle aId, // We do a release-mode assertion here to be extra safe. JS::Rooted boundScope(aCx, js::GetGlobalForObjectCrossCompartment(mBoundElement->GetWrapper())); - MOZ_RELEASE_ASSERT(!xpc::IsInXBLScope(boundScope)); + MOZ_RELEASE_ASSERT(!xpc::IsInContentXBLScope(boundScope)); JS::Rooted xblScope(aCx, xpc::GetXBLScope(aCx, boundScope)); NS_ENSURE_TRUE(xblScope, false); MOZ_ASSERT(boundScope != xblScope); diff --git a/dom/xbl/nsXBLBinding.h b/dom/xbl/nsXBLBinding.h index 999543d721de..65d7182151a1 100644 --- a/dom/xbl/nsXBLBinding.h +++ b/dom/xbl/nsXBLBinding.h @@ -160,7 +160,7 @@ public: protected: bool mMarkedForDeath; - bool mUsingXBLScope; + bool mUsingContentXBLScope; nsXBLPrototypeBinding* mPrototypeBinding; // Weak, but we're holding a ref to the docinfo nsCOMPtr mContent; // Strong. Our anonymous content stays around with us. diff --git a/dom/xbl/nsXBLEventHandler.cpp b/dom/xbl/nsXBLEventHandler.cpp index 5dfe99d733d0..28bfa0a02b2c 100644 --- a/dom/xbl/nsXBLEventHandler.cpp +++ b/dom/xbl/nsXBLEventHandler.cpp @@ -71,7 +71,7 @@ nsXBLKeyEventHandler::nsXBLKeyEventHandler(nsIAtom* aEventType, uint8_t aPhase, mPhase(aPhase), mType(aType), mIsBoundToChrome(false), - mUsingXBLScope(false) + mUsingContentXBLScope(false) { } @@ -97,7 +97,7 @@ nsXBLKeyEventHandler::ExecuteMatchedHandlers(nsIDOMKeyEvent* aKeyEvent, bool hasAllowUntrustedAttr = handler->HasAllowUntrustedAttr(); if ((trustedEvent || (hasAllowUntrustedAttr && handler->AllowUntrustedEvents()) || - (!hasAllowUntrustedAttr && !mIsBoundToChrome && !mUsingXBLScope)) && + (!hasAllowUntrustedAttr && !mIsBoundToChrome && !mUsingContentXBLScope)) && handler->KeyEventMatched(aKeyEvent, aCharCode, aIgnoreShiftKey)) { handler->ExecuteHandler(target, aKeyEvent); executed = true; diff --git a/dom/xbl/nsXBLEventHandler.h b/dom/xbl/nsXBLEventHandler.h index 11ecf4634990..8f4469ef97b2 100644 --- a/dom/xbl/nsXBLEventHandler.h +++ b/dom/xbl/nsXBLEventHandler.h @@ -86,9 +86,9 @@ public: mIsBoundToChrome = aIsBoundToChrome; } - void SetUsingXBLScope(bool aUsingXBLScope) + void SetUsingContentXBLScope(bool aUsingContentXBLScope) { - mUsingXBLScope = aUsingXBLScope; + mUsingContentXBLScope = aUsingContentXBLScope; } private: @@ -101,7 +101,7 @@ private: uint8_t mPhase; uint8_t mType; bool mIsBoundToChrome; - bool mUsingXBLScope; + bool mUsingContentXBLScope; }; nsresult diff --git a/dom/xbl/nsXBLProtoImplMethod.cpp b/dom/xbl/nsXBLProtoImplMethod.cpp index 10b7cb605b7f..57cf88007d08 100644 --- a/dom/xbl/nsXBLProtoImplMethod.cpp +++ b/dom/xbl/nsXBLProtoImplMethod.cpp @@ -104,7 +104,7 @@ nsXBLProtoImplMethod::InstallMember(JSContext* aCx, MOZ_ASSERT(js::IsObjectInContextCompartment(aTargetClassObject, aCx)); JS::Rooted globalObject(aCx, JS_GetGlobalForObject(aCx, aTargetClassObject)); - MOZ_ASSERT(xpc::IsInXBLScope(globalObject) || + MOZ_ASSERT(xpc::IsInContentXBLScope(globalObject) || globalObject == xpc::GetXBLScope(aCx, globalObject)); JS::Rooted jsMethodObject(aCx, GetCompiledMethod()); diff --git a/dom/xbl/nsXBLProtoImplProperty.cpp b/dom/xbl/nsXBLProtoImplProperty.cpp index b8ea3d375f5d..7e55d9e7c109 100644 --- a/dom/xbl/nsXBLProtoImplProperty.cpp +++ b/dom/xbl/nsXBLProtoImplProperty.cpp @@ -129,7 +129,7 @@ nsXBLProtoImplProperty::InstallMember(JSContext *aCx, MOZ_ASSERT(mGetter.IsCompiled() && mSetter.IsCompiled()); MOZ_ASSERT(js::IsObjectInContextCompartment(aTargetClassObject, aCx)); JS::Rooted globalObject(aCx, JS_GetGlobalForObject(aCx, aTargetClassObject)); - MOZ_ASSERT(xpc::IsInXBLScope(globalObject) || + MOZ_ASSERT(xpc::IsInContentXBLScope(globalObject) || globalObject == xpc::GetXBLScope(aCx, globalObject)); JS::Rooted getter(aCx, mGetter.GetJSFunction()); diff --git a/js/xpconnect/src/XPCJSRuntime.cpp b/js/xpconnect/src/XPCJSRuntime.cpp index a6687048c5b6..4cc181d25acf 100644 --- a/js/xpconnect/src/XPCJSRuntime.cpp +++ b/js/xpconnect/src/XPCJSRuntime.cpp @@ -503,19 +503,19 @@ Scriptability::Get(JSObject *aScope) } bool -IsXBLScope(JSCompartment *compartment) +IsContentXBLScope(JSCompartment *compartment) { // We always eagerly create compartment privates for XBL scopes. CompartmentPrivate *priv = GetCompartmentPrivate(compartment); if (!priv || !priv->scope) return false; - return priv->scope->IsXBLScope(); + return priv->scope->IsContentXBLScope(); } bool -IsInXBLScope(JSObject *obj) +IsInContentXBLScope(JSObject *obj) { - return IsXBLScope(js::GetObjectCompartment(obj)); + return IsContentXBLScope(js::GetObjectCompartment(obj)); } bool diff --git a/js/xpconnect/src/XPCWrappedNativeScope.cpp b/js/xpconnect/src/XPCWrappedNativeScope.cpp index 5b2964761900..c15cb442e474 100644 --- a/js/xpconnect/src/XPCWrappedNativeScope.cpp +++ b/js/xpconnect/src/XPCWrappedNativeScope.cpp @@ -73,7 +73,7 @@ XPCWrappedNativeScope::XPCWrappedNativeScope(JSContext *cx, mComponents(nullptr), mNext(nullptr), mGlobalJSObject(aGlobal), - mIsXBLScope(false) + mIsContentXBLScope(false) { // add ourselves to the scopes list { @@ -101,18 +101,18 @@ 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 = !RemoteXULForbidsXBLScope(principal, aGlobal); + mAllowContentXBLScope = !RemoteXULForbidsXBLScope(principal, aGlobal); // Determine whether to use an XBL scope. - mUseXBLScope = mAllowXBLScope; - if (mUseXBLScope) { + mUseContentXBLScope = mAllowContentXBLScope; + if (mUseContentXBLScope) { const js::Class *clasp = js::GetObjectClass(mGlobalJSObject); - mUseXBLScope = !strcmp(clasp->name, "Window") || - !strcmp(clasp->name, "ChromeWindow") || - !strcmp(clasp->name, "ModalContentWindow"); + mUseContentXBLScope = !strcmp(clasp->name, "Window") || + !strcmp(clasp->name, "ChromeWindow") || + !strcmp(clasp->name, "ModalContentWindow"); } - if (mUseXBLScope) { - mUseXBLScope = principal && !nsContentUtils::IsSystemPrincipal(principal); + if (mUseContentXBLScope) { + mUseContentXBLScope = principal && !nsContentUtils::IsSystemPrincipal(principal); } } @@ -186,20 +186,20 @@ XPCWrappedNativeScope::AttachComponentsObject(JSContext* aCx) } JSObject* -XPCWrappedNativeScope::EnsureXBLScope(JSContext *cx) +XPCWrappedNativeScope::EnsureContentXBLScope(JSContext *cx) { JS::RootedObject global(cx, GetGlobalJSObject()); MOZ_ASSERT(js::IsObjectInContextCompartment(global, cx)); - MOZ_ASSERT(!mIsXBLScope); + MOZ_ASSERT(!mIsContentXBLScope); MOZ_ASSERT(strcmp(js::GetObjectClass(global)->name, "nsXBLPrototypeScript compilation scope")); // If we already have a special XBL scope object, we know what to use. - if (mXBLScope) - return mXBLScope; + if (mContentXBLScope) + return mContentXBLScope; // If this scope doesn't need an XBL scope, just return the global. - if (!mUseXBLScope) + if (!mUseContentXBLScope) return global; // Set up the sandbox options. Note that we use the DOM global as the @@ -228,22 +228,22 @@ XPCWrappedNativeScope::EnsureXBLScope(JSContext *cx) RootedValue v(cx); nsresult rv = CreateSandboxObject(cx, &v, ep, options); NS_ENSURE_SUCCESS(rv, nullptr); - mXBLScope = &v.toObject(); + mContentXBLScope = &v.toObject(); // Tag it. - EnsureCompartmentPrivate(js::UncheckedUnwrap(mXBLScope))->scope->mIsXBLScope = true; + EnsureCompartmentPrivate(js::UncheckedUnwrap(mContentXBLScope))->scope->mIsContentXBLScope = true; // Good to go! - return mXBLScope; + return mContentXBLScope; } bool -XPCWrappedNativeScope::AllowXBLScope() +XPCWrappedNativeScope::AllowContentXBLScope() { // We only disallow XBL scopes in remote XUL situations. - MOZ_ASSERT_IF(!mAllowXBLScope, + MOZ_ASSERT_IF(!mAllowContentXBLScope, nsContentUtils::AllowXULXBLForPrincipal(GetPrincipal())); - return mAllowXBLScope; + return mAllowContentXBLScope; } namespace xpc { @@ -251,23 +251,25 @@ JSObject *GetXBLScope(JSContext *cx, JSObject *contentScopeArg) { JS::RootedObject contentScope(cx, contentScopeArg); JSAutoCompartment ac(cx, contentScope); - JSObject *scope = EnsureCompartmentPrivate(contentScope)->scope->EnsureXBLScope(cx); + JSObject *scope = EnsureCompartmentPrivate(contentScope)->scope->EnsureContentXBLScope(cx); NS_ENSURE_TRUE(scope, nullptr); // See bug 858642. scope = js::UncheckedUnwrap(scope); JS::ExposeObjectToActiveJS(scope); return scope; } -bool AllowXBLScope(JSCompartment *c) +bool +AllowContentXBLScope(JSCompartment *c) { XPCWrappedNativeScope *scope = EnsureCompartmentPrivate(c)->scope; - return scope && scope->AllowXBLScope(); + return scope && scope->AllowContentXBLScope(); } -bool UseXBLScope(JSCompartment *c) +bool +UseContentXBLScope(JSCompartment *c) { XPCWrappedNativeScope *scope = EnsureCompartmentPrivate(c)->scope; - return scope && scope->UseXBLScope(); + return scope && scope->UseContentXBLScope(); } } /* namespace xpc */ @@ -301,7 +303,7 @@ XPCWrappedNativeScope::~XPCWrappedNativeScope() mXrayExpandos.destroy(); JSRuntime *rt = XPCJSRuntime::Get()->Runtime(); - mXBLScope.finalize(rt); + mContentXBLScope.finalize(rt); mGlobalJSObject.finalize(rt); } diff --git a/js/xpconnect/src/nsXPConnect.cpp b/js/xpconnect/src/nsXPConnect.cpp index 02bbee92e008..d1fc40540866 100644 --- a/js/xpconnect/src/nsXPConnect.cpp +++ b/js/xpconnect/src/nsXPConnect.cpp @@ -1577,9 +1577,9 @@ IsChromeOrXBL(JSContext* cx, JSObject* /* unused */) // compat and not security for remote XUL, we just always claim to be XBL. // // Note that, for performance, we don't check AllowXULXBLForPrincipal here, - // and instead rely on the fact that AllowXBLScope() only returns false in + // and instead rely on the fact that AllowContentXBLScope() only returns false in // remote XUL situations. - return AccessCheck::isChrome(c) || IsXBLScope(c) || !AllowXBLScope(c); + return AccessCheck::isChrome(c) || IsContentXBLScope(c) || !AllowContentXBLScope(c); } } // namespace dom diff --git a/js/xpconnect/src/xpcprivate.h b/js/xpconnect/src/xpcprivate.h index 820abe513781..16bf1f7e32f5 100644 --- a/js/xpconnect/src/xpcprivate.h +++ b/js/xpconnect/src/xpcprivate.h @@ -1020,8 +1020,8 @@ public: void TraceSelf(JSTracer *trc) { MOZ_ASSERT(mGlobalJSObject); mGlobalJSObject.trace(trc, "XPCWrappedNativeScope::mGlobalJSObject"); - if (mXBLScope) - mXBLScope.trace(trc, "XPCWrappedNativeScope::mXBLScope"); + if (mContentXBLScope) + mContentXBLScope.trace(trc, "XPCWrappedNativeScope::mXBLScope"); if (mXrayExpandos.initialized()) mXrayExpandos.trace(trc); } @@ -1097,15 +1097,15 @@ public: // Gets the appropriate scope object for XBL in this scope. The context // must be same-compartment with the global upon entering, and the scope // object is wrapped into the compartment of the global. - JSObject *EnsureXBLScope(JSContext *cx); + JSObject *EnsureContentXBLScope(JSContext *cx); XPCWrappedNativeScope(JSContext *cx, JS::HandleObject aGlobal); nsAutoPtr mWaiverWrapperMap; - bool IsXBLScope() { return mIsXBLScope; } - bool AllowXBLScope(); - bool UseXBLScope() { return mUseXBLScope; } + bool IsContentXBLScope() { return mIsContentXBLScope; } + bool AllowContentXBLScope(); + bool UseContentXBLScope() { return mUseContentXBLScope; } protected: virtual ~XPCWrappedNativeScope(); @@ -1130,20 +1130,20 @@ private: JS::ObjectPtr mGlobalJSObject; // XBL Scope. This is is a lazily-created sandbox for non-system scopes. - // EnsureXBLScope() decides whether it needs to be created or not. + // EnsureContentXBLScope() decides whether it needs to be created or not. // This reference is wrapped into the compartment of mGlobalJSObject. - JS::ObjectPtr mXBLScope; + JS::ObjectPtr mContentXBLScope; nsAutoPtr mDOMExpandoSet; JS::WeakMapPtr mXrayExpandos; - bool mIsXBLScope; + bool mIsContentXBLScope; // For remote XUL domains, we run all XBL in the content scope for compat // reasons (though we sometimes pref this off for automation). We separately - // track the result of this decision (mAllowXBLScope), from the decision - // of whether to actually _use_ an XBL scope (mUseXBLScope), which depends + // track the result of this decision (mAllowContentXBLScope), from the decision + // of whether to actually _use_ an XBL scope (mUseContentXBLScope), which depends // on the type of global and whether the compartment is system principal // or not. // @@ -1151,8 +1151,8 @@ private: // have no way of distinguishing XBL script from content script for the // given scope. In these (unsupported) situations, we just always claim to // be XBL. - bool mAllowXBLScope; - bool mUseXBLScope; + bool mAllowContentXBLScope; + bool mUseContentXBLScope; }; /***************************************************************************/ diff --git a/js/xpconnect/src/xpcpublic.h b/js/xpconnect/src/xpcpublic.h index de55efc0405e..8e225d138655 100644 --- a/js/xpconnect/src/xpcpublic.h +++ b/js/xpconnect/src/xpcpublic.h @@ -70,8 +70,8 @@ private: JSObject * TransplantObject(JSContext *cx, JS::HandleObject origobj, JS::HandleObject target); -bool IsXBLScope(JSCompartment *compartment); -bool IsInXBLScope(JSObject *obj); +bool IsContentXBLScope(JSCompartment *compartment); +bool IsInContentXBLScope(JSObject *obj); // Return a raw XBL scope object corresponding to contentScope, which must // be an object whose global is a DOM window. @@ -90,23 +90,24 @@ JSObject * GetXBLScope(JSContext *cx, JSObject *contentScope); inline JSObject * -GetXBLScopeOrGlobal(JSContext *cx, JSObject *obj) { - if (IsInXBLScope(obj)) +GetXBLScopeOrGlobal(JSContext *cx, JSObject *obj) +{ + if (IsInContentXBLScope(obj)) return js::GetGlobalForObjectCrossCompartment(obj); return GetXBLScope(cx, obj); } // Returns whether XBL scopes have been explicitly disabled for code running -// in this compartment. See the comment around mAllowXBLScope. +// in this compartment. See the comment around mAllowContentXBLScope. bool -AllowXBLScope(JSCompartment *c); +AllowContentXBLScope(JSCompartment *c); // Returns whether we will use an XBL scope for this compartment. This is // semantically equivalent to comparing global != GetXBLScope(global), but it // does not have the side-effect of eagerly creating the XBL scope if it does // not already exist. bool -UseXBLScope(JSCompartment *c); +UseContentXBLScope(JSCompartment *c); bool IsSandboxPrototypeProxy(JSObject *obj); diff --git a/js/xpconnect/wrappers/WrapperFactory.cpp b/js/xpconnect/wrappers/WrapperFactory.cpp index b698f55ddbf0..1c85a07ce541 100644 --- a/js/xpconnect/wrappers/WrapperFactory.cpp +++ b/js/xpconnect/wrappers/WrapperFactory.cpp @@ -431,7 +431,7 @@ WrapperFactory::Rewrap(JSContext *cx, HandleObject existing, HandleObject obj, // See bug 843829. else if (targetSubsumesOrigin && !originSubsumesTarget && !waiveXrayFlag && xrayType == NotXray && - IsXBLScope(target)) + IsContentXBLScope(target)) { wrapper = &FilteringWrapper::singleton; } @@ -462,10 +462,10 @@ WrapperFactory::Rewrap(JSContext *cx, HandleObject existing, HandleObject obj, // We have slightly different behavior for the case when the object // being wrapped is in an XBL scope. - bool originIsXBLScope = IsXBLScope(origin); + bool originIsContentXBLScope = IsContentXBLScope(origin); wrapper = SelectWrapper(securityWrapper, wantXrays, xrayType, waiveXrays, - originIsXBLScope); + originIsContentXBLScope); } if (!targetSubsumesOrigin) { diff --git a/js/xpconnect/wrappers/XrayWrapper.cpp b/js/xpconnect/wrappers/XrayWrapper.cpp index fa0cc785107d..952bbca67e6a 100644 --- a/js/xpconnect/wrappers/XrayWrapper.cpp +++ b/js/xpconnect/wrappers/XrayWrapper.cpp @@ -1775,7 +1775,7 @@ DEBUG_CheckXBLCallable(JSContext *cx, JSObject *obj) // has been adopted into another compartment, those prototypes will now point // to a different XBL scope (which is ok). MOZ_ASSERT_IF(js::IsCrossCompartmentWrapper(obj), - xpc::IsXBLScope(js::GetObjectCompartment(js::UncheckedUnwrap(obj)))); + xpc::IsContentXBLScope(js::GetObjectCompartment(js::UncheckedUnwrap(obj)))); MOZ_ASSERT(JS_ObjectIsCallable(cx, obj)); } @@ -1930,7 +1930,7 @@ XrayWrapper::getPropertyDescriptor(JSContext *cx, HandleObject wra // Make sure to assert this. nsCOMPtr content; if (!desc.object() && - EnsureCompartmentPrivate(wrapper)->scope->IsXBLScope() && + EnsureCompartmentPrivate(wrapper)->scope->IsContentXBLScope() && (content = do_QueryInterfaceNative(cx, wrapper))) { if (!nsContentUtils::LookupBindingMember(cx, content, id, desc))