mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 910937: Remove xpc_UnmarkGrayObject and use JSAPI directly. r=mccr8
This commit is contained in:
parent
fde62e307a
commit
a53f6f80b6
@ -89,7 +89,8 @@ NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_BEGIN(EventSource)
|
|||||||
tmp->mListenerManager->MarkForCC();
|
tmp->mListenerManager->MarkForCC();
|
||||||
}
|
}
|
||||||
if (!isBlack && tmp->PreservingWrapper()) {
|
if (!isBlack && tmp->PreservingWrapper()) {
|
||||||
xpc_UnmarkGrayObject(tmp->GetWrapperPreserveColor());
|
// This marks the wrapper black.
|
||||||
|
tmp->GetWrapper();
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -1221,7 +1221,9 @@ void
|
|||||||
FragmentOrElement::MarkNodeChildren(nsINode* aNode)
|
FragmentOrElement::MarkNodeChildren(nsINode* aNode)
|
||||||
{
|
{
|
||||||
JSObject* o = GetJSObjectChild(aNode);
|
JSObject* o = GetJSObjectChild(aNode);
|
||||||
xpc_UnmarkGrayObject(o);
|
if (o) {
|
||||||
|
JS::ExposeObjectToActiveJS(o);
|
||||||
|
}
|
||||||
|
|
||||||
nsEventListenerManager* elm = aNode->GetListenerManager(false);
|
nsEventListenerManager* elm = aNode->GetListenerManager(false);
|
||||||
if (elm) {
|
if (elm) {
|
||||||
|
@ -581,7 +581,8 @@ NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_BEGIN(WebSocket)
|
|||||||
tmp->mListenerManager->MarkForCC();
|
tmp->mListenerManager->MarkForCC();
|
||||||
}
|
}
|
||||||
if (!isBlack && tmp->PreservingWrapper()) {
|
if (!isBlack && tmp->PreservingWrapper()) {
|
||||||
xpc_UnmarkGrayObject(tmp->GetWrapperPreserveColor());
|
// This marks the wrapper black.
|
||||||
|
tmp->GetWrapper();
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -446,7 +446,8 @@ NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_BEGIN(nsXMLHttpRequest)
|
|||||||
tmp->mListenerManager->MarkForCC();
|
tmp->mListenerManager->MarkForCC();
|
||||||
}
|
}
|
||||||
if (!isBlack && tmp->PreservingWrapper()) {
|
if (!isBlack && tmp->PreservingWrapper()) {
|
||||||
xpc_UnmarkGrayObject(tmp->GetWrapperPreserveColor());
|
// This marks the wrapper black.
|
||||||
|
tmp->GetWrapper();
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
#include "nsCycleCollectionParticipant.h"
|
#include "nsCycleCollectionParticipant.h"
|
||||||
#include "nsTraceRefcnt.h"
|
#include "nsTraceRefcnt.h"
|
||||||
#include "xpcpublic.h"
|
#include "js/GCAPI.h"
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
namespace dom {
|
namespace dom {
|
||||||
@ -54,7 +54,7 @@ public:
|
|||||||
}
|
}
|
||||||
JSObject* GetDataObject() const
|
JSObject* GetDataObject() const
|
||||||
{
|
{
|
||||||
xpc_UnmarkGrayObject(mData);
|
JS::ExposeObjectToActiveJS(mData);
|
||||||
return mData;
|
return mData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1330,9 +1330,11 @@ nsEventListenerManager::MarkForCC()
|
|||||||
nsIJSEventListener* jsl = ls.GetJSListener();
|
nsIJSEventListener* jsl = ls.GetJSListener();
|
||||||
if (jsl) {
|
if (jsl) {
|
||||||
if (jsl->GetHandler().HasEventHandler()) {
|
if (jsl->GetHandler().HasEventHandler()) {
|
||||||
xpc_UnmarkGrayObject(jsl->GetHandler().Ptr()->Callable());
|
JS::ExposeObjectToActiveJS(jsl->GetHandler().Ptr()->Callable());
|
||||||
|
}
|
||||||
|
if (JSObject* scope = jsl->GetEventScope()) {
|
||||||
|
JS::ExposeObjectToActiveJS(scope);
|
||||||
}
|
}
|
||||||
xpc_UnmarkGrayObject(jsl->GetEventScope());
|
|
||||||
} else if (ls.mListenerType == eWrappedJSListener) {
|
} else if (ls.mListenerType == eWrappedJSListener) {
|
||||||
xpc_TryUnmarkWrappedGrayObject(ls.mListener.GetXPCOMCallback());
|
xpc_TryUnmarkWrappedGrayObject(ls.mListener.GetXPCOMCallback());
|
||||||
} else if (ls.mListenerType == eWebIDLListener) {
|
} else if (ls.mListenerType == eWebIDLListener) {
|
||||||
|
@ -67,7 +67,8 @@ HTMLAllCollection::GetObject(JSContext* aCx, ErrorResult& aRv)
|
|||||||
NS_ADDREF(mDocument);
|
NS_ADDREF(mDocument);
|
||||||
}
|
}
|
||||||
|
|
||||||
return xpc_UnmarkGrayObject(mObject);
|
JS::ExposeObjectToActiveJS(mObject);
|
||||||
|
return mObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace dom
|
} // namespace dom
|
||||||
|
@ -213,7 +213,9 @@ nsXBLDocGlobalObject::ClearGlobalObjectOwner()
|
|||||||
void
|
void
|
||||||
nsXBLDocGlobalObject::UnmarkCompilationGlobal()
|
nsXBLDocGlobalObject::UnmarkCompilationGlobal()
|
||||||
{
|
{
|
||||||
xpc_UnmarkGrayObject(mJSObject);
|
if (mJSObject) {
|
||||||
|
JS::ExposeObjectToActiveJS(mJSObject);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
JSObject *
|
JSObject *
|
||||||
@ -357,7 +359,7 @@ NS_IMPL_CYCLE_COLLECTION_TRACE_END
|
|||||||
static void
|
static void
|
||||||
UnmarkXBLJSObject(void* aP, const char* aName, void* aClosure)
|
UnmarkXBLJSObject(void* aP, const char* aName, void* aClosure)
|
||||||
{
|
{
|
||||||
xpc_UnmarkGrayObject(static_cast<JSObject*>(aP));
|
JS::ExposeObjectToActiveJS(static_cast<JSObject*>(aP));
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
|
@ -356,7 +356,7 @@ nsXBLPrototypeHandler::EnsureEventHandler(nsIScriptGlobalObject* aGlobal,
|
|||||||
if (pWindow) {
|
if (pWindow) {
|
||||||
JS::Rooted<JSObject*> cachedHandler(cx, pWindow->GetCachedXBLPrototypeHandler(this));
|
JS::Rooted<JSObject*> cachedHandler(cx, pWindow->GetCachedXBLPrototypeHandler(this));
|
||||||
if (cachedHandler) {
|
if (cachedHandler) {
|
||||||
xpc_UnmarkGrayObject(cachedHandler);
|
JS::ExposeObjectToActiveJS(cachedHandler);
|
||||||
aHandler.set(cachedHandler);
|
aHandler.set(cachedHandler);
|
||||||
NS_ENSURE_TRUE(aHandler, NS_ERROR_FAILURE);
|
NS_ENSURE_TRUE(aHandler, NS_ERROR_FAILURE);
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
@ -2638,7 +2638,9 @@ nsXULPrototypeScript::Compile(const PRUnichar* aText,
|
|||||||
options.setSourcePolicy(mOutOfLine ? JS::CompileOptions::LAZY_SOURCE
|
options.setSourcePolicy(mOutOfLine ? JS::CompileOptions::LAZY_SOURCE
|
||||||
: JS::CompileOptions::SAVE_SOURCE);
|
: JS::CompileOptions::SAVE_SOURCE);
|
||||||
JS::RootedObject scope(cx, JS::CurrentGlobalOrNull(cx));
|
JS::RootedObject scope(cx, JS::CurrentGlobalOrNull(cx));
|
||||||
xpc_UnmarkGrayObject(scope);
|
if (scope) {
|
||||||
|
JS::ExposeObjectToActiveJS(scope);
|
||||||
|
}
|
||||||
|
|
||||||
if (aOffThreadReceiver && JS::CanCompileOffThread(cx, options)) {
|
if (aOffThreadReceiver && JS::CanCompileOffThread(cx, options)) {
|
||||||
if (!JS::CompileOffThread(cx, scope, options,
|
if (!JS::CompileOffThread(cx, scope, options,
|
||||||
|
@ -3668,7 +3668,10 @@ XULDocument::ExecuteScript(nsIScriptContext * aContext,
|
|||||||
JSContext *cx = aContext->GetNativeContext();
|
JSContext *cx = aContext->GetNativeContext();
|
||||||
AutoCxPusher pusher(cx);
|
AutoCxPusher pusher(cx);
|
||||||
JS::Rooted<JSObject*> global(cx, mScriptGlobalObject->GetGlobalJSObject());
|
JS::Rooted<JSObject*> global(cx, mScriptGlobalObject->GetGlobalJSObject());
|
||||||
xpc_UnmarkGrayObject(global);
|
// XXXkhuey can this ever be null?
|
||||||
|
if (global) {
|
||||||
|
JS::ExposeObjectToActiveJS(global);
|
||||||
|
}
|
||||||
xpc_UnmarkGrayScript(aScriptObject);
|
xpc_UnmarkGrayScript(aScriptObject);
|
||||||
JSAutoCompartment ac(cx, global);
|
JSAutoCompartment ac(cx, global);
|
||||||
JS::Rooted<JS::Value> unused(cx);
|
JS::Rooted<JS::Value> unused(cx);
|
||||||
|
@ -52,7 +52,12 @@ public:
|
|||||||
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(nsXULPDGlobalObject)
|
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(nsXULPDGlobalObject)
|
||||||
|
|
||||||
JSObject* GetCompilationGlobal();
|
JSObject* GetCompilationGlobal();
|
||||||
void UnmarkCompilationGlobal() { xpc_UnmarkGrayObject(mJSObject); }
|
void UnmarkCompilationGlobal()
|
||||||
|
{
|
||||||
|
if (mJSObject) {
|
||||||
|
JS::ExposeObjectToActiveJS(mJSObject);
|
||||||
|
}
|
||||||
|
}
|
||||||
void Destroy();
|
void Destroy();
|
||||||
nsIPrincipal* GetPrincipal();
|
nsIPrincipal* GetPrincipal();
|
||||||
void ClearGlobalObjectOwner();
|
void ClearGlobalObjectOwner();
|
||||||
@ -730,9 +735,14 @@ NS_IMPL_CYCLE_COLLECTING_RELEASE(nsXULPDGlobalObject)
|
|||||||
JSObject *
|
JSObject *
|
||||||
nsXULPDGlobalObject::GetCompilationGlobal()
|
nsXULPDGlobalObject::GetCompilationGlobal()
|
||||||
{
|
{
|
||||||
if (mJSObject || mDestroyed) {
|
if (mJSObject) {
|
||||||
// We've been initialized before. This is what we get.
|
// We've been initialized before. This is what we get.
|
||||||
return xpc_UnmarkGrayObject(mJSObject);
|
JS::ExposeObjectToActiveJS(mJSObject);
|
||||||
|
return mJSObject;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mDestroyed) {
|
||||||
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
AutoSafeJSContext cx;
|
AutoSafeJSContext cx;
|
||||||
|
@ -1559,7 +1559,7 @@ NS_IMPL_CYCLE_COLLECTING_RELEASE(nsGlobalWindow)
|
|||||||
static PLDHashOperator
|
static PLDHashOperator
|
||||||
MarkXBLHandlers(nsXBLPrototypeHandler* aKey, JS::Heap<JSObject*>& aData, void* aClosure)
|
MarkXBLHandlers(nsXBLPrototypeHandler* aKey, JS::Heap<JSObject*>& aData, void* aClosure)
|
||||||
{
|
{
|
||||||
xpc_UnmarkGrayObject(aData);
|
JS::ExposeObjectToActiveJS(aData);
|
||||||
return PL_DHASH_NEXT;
|
return PL_DHASH_NEXT;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2248,13 +2248,13 @@ nsGlobalWindow::SetNewDocument(nsIDocument* aDocument,
|
|||||||
|
|
||||||
if (aDocument != oldDoc) {
|
if (aDocument != oldDoc) {
|
||||||
JS::Rooted<JSObject*> obj(cx, currentInner->mJSObject);
|
JS::Rooted<JSObject*> obj(cx, currentInner->mJSObject);
|
||||||
xpc_UnmarkGrayObject(obj);
|
JS::ExposeObjectToActiveJS(obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
// We're reusing the inner window, but this still counts as a navigation,
|
// We're reusing the inner window, but this still counts as a navigation,
|
||||||
// so all expandos and such defined on the outer window should go away. Force
|
// so all expandos and such defined on the outer window should go away. Force
|
||||||
// all Xray wrappers to be recomputed.
|
// all Xray wrappers to be recomputed.
|
||||||
xpc_UnmarkGrayObject(mJSObject);
|
JS::ExposeObjectToActiveJS(mJSObject);
|
||||||
if (!JS_RefreshCrossCompartmentWrappers(cx, mJSObject)) {
|
if (!JS_RefreshCrossCompartmentWrappers(cx, mJSObject)) {
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
@ -2359,8 +2359,8 @@ nsGlobalWindow::SetNewDocument(nsIDocument* aDocument,
|
|||||||
mJSObject = mContext->GetWindowProxy();
|
mJSObject = mContext->GetWindowProxy();
|
||||||
SetWrapper(mJSObject);
|
SetWrapper(mJSObject);
|
||||||
} else {
|
} else {
|
||||||
JS::Rooted<JSObject*> global(cx,
|
JS::ExposeObjectToActiveJS(newInnerWindow->mJSObject);
|
||||||
xpc_UnmarkGrayObject(newInnerWindow->mJSObject));
|
JS::Rooted<JSObject*> global(cx, newInnerWindow->mJSObject);
|
||||||
JS::Rooted<JSObject*> outerObject(cx,
|
JS::Rooted<JSObject*> outerObject(cx,
|
||||||
NewOuterWindowProxy(cx, global, thisChrome));
|
NewOuterWindowProxy(cx, global, thisChrome));
|
||||||
if (!outerObject) {
|
if (!outerObject) {
|
||||||
|
@ -201,7 +201,12 @@ public:
|
|||||||
// Can return null if we already have a handler.
|
// Can return null if we already have a handler.
|
||||||
JSObject* GetEventScope() const
|
JSObject* GetEventScope() const
|
||||||
{
|
{
|
||||||
return xpc_UnmarkGrayObject(mScopeObject);
|
if (!mScopeObject) {
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
JS::ExposeObjectToActiveJS(mScopeObject);
|
||||||
|
return mScopeObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
const nsEventHandler& GetHandler() const
|
const nsEventHandler& GetHandler() const
|
||||||
|
@ -1044,12 +1044,15 @@ nsJSContext::JSObjectFromInterface(nsISupports* aTarget,
|
|||||||
NS_ASSERTION(native == targetSupp, "Native should be the target!");
|
NS_ASSERTION(native == targetSupp, "Native should be the target!");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
*aRet = xpc_UnmarkGrayObject(JSVAL_TO_OBJECT(v));
|
JSObject* obj = v.toObjectOrNull();
|
||||||
|
if (obj) {
|
||||||
|
JS::ExposeObjectToActiveJS(obj);
|
||||||
|
}
|
||||||
|
|
||||||
|
*aRet = obj;
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
nsJSContext::BindCompiledEventHandler(nsISupports* aTarget,
|
nsJSContext::BindCompiledEventHandler(nsISupports* aTarget,
|
||||||
JS::Handle<JSObject*> aScope,
|
JS::Handle<JSObject*> aScope,
|
||||||
@ -1060,8 +1063,10 @@ nsJSContext::BindCompiledEventHandler(nsISupports* aTarget,
|
|||||||
NS_ENSURE_TRUE(mIsInitialized, NS_ERROR_NOT_INITIALIZED);
|
NS_ENSURE_TRUE(mIsInitialized, NS_ERROR_NOT_INITIALIZED);
|
||||||
NS_PRECONDITION(!aBoundHandler, "Shouldn't already have a bound handler!");
|
NS_PRECONDITION(!aBoundHandler, "Shouldn't already have a bound handler!");
|
||||||
|
|
||||||
xpc_UnmarkGrayObject(aScope);
|
if (aScope) {
|
||||||
xpc_UnmarkGrayObject(aHandler);
|
JS::ExposeObjectToActiveJS(aScope);
|
||||||
|
}
|
||||||
|
JS::ExposeObjectToActiveJS(aHandler);
|
||||||
AutoPushJSContext cx(mContext);
|
AutoPushJSContext cx(mContext);
|
||||||
|
|
||||||
// Get the jsobject associated with this target
|
// Get the jsobject associated with this target
|
||||||
@ -2602,7 +2607,12 @@ nsJSContext::SetWindowProxy(JS::Handle<JSObject*> aWindowProxy)
|
|||||||
JSObject*
|
JSObject*
|
||||||
nsJSContext::GetWindowProxy()
|
nsJSContext::GetWindowProxy()
|
||||||
{
|
{
|
||||||
return xpc_UnmarkGrayObject(GetWindowProxyPreserveColor());
|
JSObject* windowProxy = GetWindowProxyPreserveColor();
|
||||||
|
if (windowProxy) {
|
||||||
|
JS::ExposeObjectToActiveJS(windowProxy);
|
||||||
|
}
|
||||||
|
|
||||||
|
return windowProxy;
|
||||||
}
|
}
|
||||||
|
|
||||||
JSObject*
|
JSObject*
|
||||||
|
@ -177,7 +177,9 @@ nsJSUtils::CompileFunction(JSContext* aCx,
|
|||||||
aOptions.setPrincipals(p);
|
aOptions.setPrincipals(p);
|
||||||
|
|
||||||
// Do the junk Gecko is supposed to do before calling into JSAPI.
|
// Do the junk Gecko is supposed to do before calling into JSAPI.
|
||||||
xpc_UnmarkGrayObject(aTarget);
|
if (aTarget) {
|
||||||
|
JS::ExposeObjectToActiveJS(aTarget);
|
||||||
|
}
|
||||||
|
|
||||||
// Compile.
|
// Compile.
|
||||||
JSFunction* fun = JS::CompileFunction(aCx, aTarget, aOptions,
|
JSFunction* fun = JS::CompileFunction(aCx, aTarget, aOptions,
|
||||||
@ -238,7 +240,7 @@ nsJSUtils::EvaluateString(JSContext* aCx,
|
|||||||
*aRetValue = JSVAL_VOID;
|
*aRetValue = JSVAL_VOID;
|
||||||
}
|
}
|
||||||
|
|
||||||
xpc_UnmarkGrayObject(aScopeObject);
|
JS::ExposeObjectToActiveJS(aScopeObject);
|
||||||
nsAutoMicroTask mt;
|
nsAutoMicroTask mt;
|
||||||
|
|
||||||
JSPrincipals* p = JS_GetCompartmentPrincipals(js::GetObjectCompartment(aScopeObject));
|
JSPrincipals* p = JS_GetCompartmentPrincipals(js::GetObjectCompartment(aScopeObject));
|
||||||
|
@ -7,13 +7,16 @@
|
|||||||
#define nsWrapperCacheInline_h___
|
#define nsWrapperCacheInline_h___
|
||||||
|
|
||||||
#include "nsWrapperCache.h"
|
#include "nsWrapperCache.h"
|
||||||
#include "xpcpublic.h"
|
#include "js/GCAPI.h"
|
||||||
|
#include "jsapi.h"
|
||||||
|
|
||||||
inline JSObject*
|
inline JSObject*
|
||||||
nsWrapperCache::GetWrapper() const
|
nsWrapperCache::GetWrapper() const
|
||||||
{
|
{
|
||||||
JSObject* obj = GetWrapperPreserveColor();
|
JSObject* obj = GetWrapperPreserveColor();
|
||||||
xpc_UnmarkGrayObject(obj);
|
if (obj) {
|
||||||
|
JS::ExposeObjectToActiveJS(obj);
|
||||||
|
}
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -21,14 +24,14 @@ inline bool
|
|||||||
nsWrapperCache::IsBlack()
|
nsWrapperCache::IsBlack()
|
||||||
{
|
{
|
||||||
JSObject* o = GetWrapperPreserveColor();
|
JSObject* o = GetWrapperPreserveColor();
|
||||||
return o && !xpc_IsGrayGCThing(o);
|
return o && !JS::GCThingIsMarkedGray(o);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
SearchGray(void* aGCThing, const char* aName, void* aClosure)
|
SearchGray(void* aGCThing, const char* aName, void* aClosure)
|
||||||
{
|
{
|
||||||
bool* hasGrayObjects = static_cast<bool*>(aClosure);
|
bool* hasGrayObjects = static_cast<bool*>(aClosure);
|
||||||
if (!*hasGrayObjects && aGCThing && xpc_IsGrayGCThing(aGCThing)) {
|
if (!*hasGrayObjects && aGCThing && JS::GCThingIsMarkedGray(aGCThing)) {
|
||||||
*hasGrayObjects = true;
|
*hasGrayObjects = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -652,7 +652,7 @@ WrapNewBindingObject(JSContext* cx, JS::Handle<JSObject*> scope, T* value,
|
|||||||
JSObject* obj = value->GetWrapperPreserveColor();
|
JSObject* obj = value->GetWrapperPreserveColor();
|
||||||
bool couldBeDOMBinding = CouldBeDOMBinding(value);
|
bool couldBeDOMBinding = CouldBeDOMBinding(value);
|
||||||
if (obj) {
|
if (obj) {
|
||||||
xpc_UnmarkNonNullGrayObject(obj);
|
JS::ExposeObjectToActiveJS(obj);
|
||||||
} else {
|
} else {
|
||||||
// Inline this here while we have non-dom objects in wrapper caches.
|
// Inline this here while we have non-dom objects in wrapper caches.
|
||||||
if (!couldBeDOMBinding) {
|
if (!couldBeDOMBinding) {
|
||||||
|
@ -106,7 +106,7 @@ CallbackObject::CallSetup::CallSetup(JS::Handle<JSObject*> aCallback,
|
|||||||
//
|
//
|
||||||
// We can do this even though we're not in the right compartment yet, because
|
// We can do this even though we're not in the right compartment yet, because
|
||||||
// Rooted<> does not care about compartments.
|
// Rooted<> does not care about compartments.
|
||||||
xpc_UnmarkGrayObject(aCallback);
|
JS::ExposeObjectToActiveJS(aCallback);
|
||||||
mRootedCallable.construct(cx, aCallback);
|
mRootedCallable.construct(cx, aCallback);
|
||||||
|
|
||||||
// Check that it's ok to run this callback at all.
|
// Check that it's ok to run this callback at all.
|
||||||
|
@ -58,7 +58,7 @@ public:
|
|||||||
|
|
||||||
JS::Handle<JSObject*> Callback() const
|
JS::Handle<JSObject*> Callback() const
|
||||||
{
|
{
|
||||||
xpc_UnmarkGrayObject(mCallback);
|
JS::ExposeObjectToActiveJS(mCallback);
|
||||||
return CallbackPreserveColor();
|
return CallbackPreserveColor();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -421,7 +421,8 @@ BluetoothAdapter::GetDevices(JSContext* aContext, ErrorResult& aRv)
|
|||||||
return JS::NullValue();
|
return JS::NullValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
return JS::ObjectValue(*xpc_UnmarkGrayObject(mJsDeviceAddresses));
|
JS::ExposeObjectToActiveJS(mJsDeviceAddresses);
|
||||||
|
return JS::ObjectValue(*mJsDeviceAddresses);
|
||||||
}
|
}
|
||||||
|
|
||||||
JS::Value
|
JS::Value
|
||||||
@ -433,7 +434,8 @@ BluetoothAdapter::GetUuids(JSContext* aContext, ErrorResult& aRv)
|
|||||||
return JS::NullValue();
|
return JS::NullValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
return JS::ObjectValue(*xpc_UnmarkGrayObject(mJsUuids));
|
JS::ExposeObjectToActiveJS(mJsUuids);
|
||||||
|
return JS::ObjectValue(*mJsUuids);
|
||||||
}
|
}
|
||||||
|
|
||||||
already_AddRefed<DOMRequest>
|
already_AddRefed<DOMRequest>
|
||||||
|
@ -206,7 +206,8 @@ BluetoothDevice::GetUuids(JSContext* aCx, ErrorResult& aRv)
|
|||||||
return JS::NullValue();
|
return JS::NullValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
return JS::ObjectValue(*xpc_UnmarkGrayObject(mJsUuids));
|
JS::ExposeObjectToActiveJS(mJsUuids);
|
||||||
|
return JS::ObjectValue(*mJsUuids);
|
||||||
}
|
}
|
||||||
|
|
||||||
JS::Value
|
JS::Value
|
||||||
@ -218,7 +219,8 @@ BluetoothDevice::GetServices(JSContext* aCx, ErrorResult& aRv)
|
|||||||
return JS::Value(JSVAL_NULL);
|
return JS::Value(JSVAL_NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
return JS::ObjectValue(*xpc_UnmarkGrayObject(mJsServices));
|
JS::ExposeObjectToActiveJS(mJsServices);
|
||||||
|
return JS::ObjectValue(*mJsServices);
|
||||||
}
|
}
|
||||||
|
|
||||||
JSObject*
|
JSObject*
|
||||||
|
@ -290,6 +290,12 @@ ExposeValueToActiveJS(const Value &v)
|
|||||||
ExposeGCThingToActiveJS(v.toGCThing(), v.gcKind());
|
ExposeGCThingToActiveJS(v.toGCThing(), v.gcKind());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static JS_ALWAYS_INLINE void
|
||||||
|
ExposeObjectToActiveJS(JSObject *obj)
|
||||||
|
{
|
||||||
|
ExposeGCThingToActiveJS(obj, JSTRACE_OBJECT);
|
||||||
|
}
|
||||||
|
|
||||||
} /* namespace JS */
|
} /* namespace JS */
|
||||||
|
|
||||||
#endif /* js_GCAPI_h */
|
#endif /* js_GCAPI_h */
|
||||||
|
@ -488,7 +488,9 @@ inline
|
|||||||
JSObject* XPCWrappedNativeTearOff::GetJSObject()
|
JSObject* XPCWrappedNativeTearOff::GetJSObject()
|
||||||
{
|
{
|
||||||
JSObject *obj = GetJSObjectPreserveColor();
|
JSObject *obj = GetJSObjectPreserveColor();
|
||||||
xpc_UnmarkGrayObject(obj);
|
if (obj) {
|
||||||
|
JS::ExposeObjectToActiveJS(obj);
|
||||||
|
}
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -246,7 +246,8 @@ nsXPCWrappedJS::GetWeakReference(nsIWeakReference** aInstancePtr)
|
|||||||
JSObject*
|
JSObject*
|
||||||
nsXPCWrappedJS::GetJSObject()
|
nsXPCWrappedJS::GetJSObject()
|
||||||
{
|
{
|
||||||
return xpc_UnmarkGrayObject(mJSObj);
|
JS::ExposeObjectToActiveJS(mJSObj);
|
||||||
|
return mJSObj;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
|
@ -291,7 +291,7 @@ JSObject *GetXBLScope(JSContext *cx, JSObject *contentScopeArg)
|
|||||||
JSObject *scope = EnsureCompartmentPrivate(contentScope)->scope->EnsureXBLScope(cx);
|
JSObject *scope = EnsureCompartmentPrivate(contentScope)->scope->EnsureXBLScope(cx);
|
||||||
NS_ENSURE_TRUE(scope, nullptr); // See bug 858642.
|
NS_ENSURE_TRUE(scope, nullptr); // See bug 858642.
|
||||||
scope = js::UncheckedUnwrap(scope);
|
scope = js::UncheckedUnwrap(scope);
|
||||||
xpc_UnmarkGrayObject(scope);
|
JS::ExposeObjectToActiveJS(scope);
|
||||||
return scope;
|
return scope;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1300,8 +1300,10 @@ public:
|
|||||||
GetComponentsJSObject();
|
GetComponentsJSObject();
|
||||||
|
|
||||||
JSObject*
|
JSObject*
|
||||||
GetGlobalJSObject() const
|
GetGlobalJSObject() const {
|
||||||
{return xpc_UnmarkGrayObject(mGlobalJSObject);}
|
JS::ExposeObjectToActiveJS(mGlobalJSObject);
|
||||||
|
return mGlobalJSObject;
|
||||||
|
}
|
||||||
|
|
||||||
JSObject*
|
JSObject*
|
||||||
GetGlobalJSObjectPreserveColor() const {return mGlobalJSObject;}
|
GetGlobalJSObjectPreserveColor() const {return mGlobalJSObject;}
|
||||||
@ -2029,7 +2031,10 @@ public:
|
|||||||
GetRuntime() const {return mScope->GetRuntime();}
|
GetRuntime() const {return mScope->GetRuntime();}
|
||||||
|
|
||||||
JSObject*
|
JSObject*
|
||||||
GetJSProtoObject() const {return xpc_UnmarkGrayObject(mJSProtoObject);}
|
GetJSProtoObject() const {
|
||||||
|
JS::ExposeObjectToActiveJS(mJSProtoObject);
|
||||||
|
return mJSProtoObject;
|
||||||
|
}
|
||||||
|
|
||||||
nsIClassInfo*
|
nsIClassInfo*
|
||||||
GetClassInfo() const {return mClassInfo;}
|
GetClassInfo() const {return mClassInfo;}
|
||||||
@ -2295,8 +2300,10 @@ public:
|
|||||||
*/
|
*/
|
||||||
JSObject*
|
JSObject*
|
||||||
GetFlatJSObject() const
|
GetFlatJSObject() const
|
||||||
{xpc_UnmarkGrayObject(mFlatJSObject);
|
{
|
||||||
return mFlatJSObject;}
|
JS::ExposeObjectToActiveJS(mFlatJSObject);
|
||||||
|
return mFlatJSObject;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This getter does not change the color of the JSObject meaning that the
|
* This getter does not change the color of the JSObject meaning that the
|
||||||
@ -2485,7 +2492,7 @@ public:
|
|||||||
{
|
{
|
||||||
JSObject* wrapper = GetWrapperPreserveColor();
|
JSObject* wrapper = GetWrapperPreserveColor();
|
||||||
if (wrapper) {
|
if (wrapper) {
|
||||||
xpc_UnmarkGrayObject(wrapper);
|
JS::ExposeObjectToActiveJS(wrapper);
|
||||||
// Call this to unmark mFlatJSObject.
|
// Call this to unmark mFlatJSObject.
|
||||||
GetFlatJSObject();
|
GetFlatJSObject();
|
||||||
}
|
}
|
||||||
@ -3571,10 +3578,11 @@ public:
|
|||||||
* represents a JSObject. That means that the object is guaranteed to be
|
* represents a JSObject. That means that the object is guaranteed to be
|
||||||
* kept alive past the next CC.
|
* kept alive past the next CC.
|
||||||
*/
|
*/
|
||||||
jsval GetJSVal() const
|
jsval GetJSVal() const {
|
||||||
{if (!JSVAL_IS_PRIMITIVE(mJSVal))
|
if (!JSVAL_IS_PRIMITIVE(mJSVal))
|
||||||
xpc_UnmarkGrayObject(JSVAL_TO_OBJECT(mJSVal));
|
JS::ExposeObjectToActiveJS(&mJSVal.toObject());
|
||||||
return mJSVal;}
|
return mJSVal;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This getter does not change the color of the jsval (if it represents a
|
* This getter does not change the color of the jsval (if it represents a
|
||||||
|
@ -137,23 +137,6 @@ xpc_IsGrayGCThing(void *thing)
|
|||||||
extern bool
|
extern bool
|
||||||
xpc_GCThingIsGrayCCThing(void *thing);
|
xpc_GCThingIsGrayCCThing(void *thing);
|
||||||
|
|
||||||
// Unmark gray for known-nonnull cases
|
|
||||||
MOZ_ALWAYS_INLINE void
|
|
||||||
xpc_UnmarkNonNullGrayObject(JSObject *obj)
|
|
||||||
{
|
|
||||||
JS::ExposeGCThingToActiveJS(obj, JSTRACE_OBJECT);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Remove the gray color from the given JSObject and any other objects that can
|
|
||||||
// be reached through it.
|
|
||||||
MOZ_ALWAYS_INLINE JSObject *
|
|
||||||
xpc_UnmarkGrayObject(JSObject *obj)
|
|
||||||
{
|
|
||||||
if (obj)
|
|
||||||
xpc_UnmarkNonNullGrayObject(obj);
|
|
||||||
return obj;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline JSScript *
|
inline JSScript *
|
||||||
xpc_UnmarkGrayScript(JSScript *script)
|
xpc_UnmarkGrayScript(JSScript *script)
|
||||||
{
|
{
|
||||||
|
@ -59,7 +59,12 @@ WrapperFactory::GetXrayWaiver(JSObject *obj)
|
|||||||
|
|
||||||
if (!scope->mWaiverWrapperMap)
|
if (!scope->mWaiverWrapperMap)
|
||||||
return NULL;
|
return NULL;
|
||||||
return xpc_UnmarkGrayObject(scope->mWaiverWrapperMap->Find(obj));
|
|
||||||
|
JSObject* xrayWaiver = scope->mWaiverWrapperMap->Find(obj);
|
||||||
|
if (xrayWaiver)
|
||||||
|
JS::ExposeObjectToActiveJS(xrayWaiver);
|
||||||
|
|
||||||
|
return xrayWaiver;
|
||||||
}
|
}
|
||||||
|
|
||||||
JSObject *
|
JSObject *
|
||||||
|
@ -43,10 +43,8 @@ NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE_1(nsDOMCSSAttributeDeclaration, mElement)
|
|||||||
NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_BEGIN(nsDOMCSSAttributeDeclaration)
|
NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_BEGIN(nsDOMCSSAttributeDeclaration)
|
||||||
if (tmp->mElement && Element::CanSkip(tmp->mElement, true)) {
|
if (tmp->mElement && Element::CanSkip(tmp->mElement, true)) {
|
||||||
if (tmp->PreservingWrapper()) {
|
if (tmp->PreservingWrapper()) {
|
||||||
// Not relying on GetWrapper to unmark us gray because the
|
// This marks the wrapper black.
|
||||||
// side-effect thing is pretty weird.
|
tmp->GetWrapper();
|
||||||
JSObject* o = tmp->GetWrapperPreserveColor();
|
|
||||||
xpc_UnmarkGrayObject(o);
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -51,6 +51,7 @@
|
|||||||
#include "nsIDOMCryptoDialogs.h"
|
#include "nsIDOMCryptoDialogs.h"
|
||||||
#include "nsIFormSigningDialog.h"
|
#include "nsIFormSigningDialog.h"
|
||||||
#include "nsIContentSecurityPolicy.h"
|
#include "nsIContentSecurityPolicy.h"
|
||||||
|
#include "nsIURI.h"
|
||||||
#include "jsapi.h"
|
#include "jsapi.h"
|
||||||
#include "js/OldDebugAPI.h"
|
#include "js/OldDebugAPI.h"
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
Loading…
Reference in New Issue
Block a user