From 446aa2a6f83f175be3918b2ec380db690dcdb1c4 Mon Sep 17 00:00:00 2001 From: Ed Morley Date: Mon, 7 Jan 2013 18:11:22 +0000 Subject: [PATCH] Backout e4550612487b & c3008e662841 (bug 827274) for mochitest-chrome crashes on a CLOSED TREE --- dom/workers/RuntimeService.cpp | 8 -------- dom/workers/WorkerPrivate.h | 16 ---------------- js/src/ctypes/CTypes.cpp | 14 +++++--------- js/src/jsfriendapi.cpp | 12 ------------ js/src/jsfriendapi.h | 27 +-------------------------- 5 files changed, 6 insertions(+), 71 deletions(-) diff --git a/dom/workers/RuntimeService.cpp b/dom/workers/RuntimeService.cpp index df52d48f403f..0fc13112554d 100644 --- a/dom/workers/RuntimeService.cpp +++ b/dom/workers/RuntimeService.cpp @@ -389,14 +389,6 @@ CTypesActivityCallback(JSContext* aCx, worker->EndCTypesCall(); break; - case js::CTYPES_CALLBACK_BEGIN: - worker->BeginCTypesCallback(); - break; - - case js::CTYPES_CALLBACK_END: - worker->EndCTypesCallback(); - break; - default: MOZ_NOT_REACHED("Unknown type flag!"); } diff --git a/dom/workers/WorkerPrivate.h b/dom/workers/WorkerPrivate.h index 1d7ef757ffe7..50a66bebbb2a 100644 --- a/dom/workers/WorkerPrivate.h +++ b/dom/workers/WorkerPrivate.h @@ -771,22 +771,6 @@ public: void EndCTypesCall(); - void - BeginCTypesCallback() - { - // If a callback is beginning then we need to do the exact same thing as - // when a ctypes call ends. - EndCTypesCall(); - } - - void - EndCTypesCallback() - { - // If a callback is ending then we need to do the exact same thing as - // when a ctypes call begins. - BeginCTypesCall(); - } - private: WorkerPrivate(JSContext* aCx, JSObject* aObject, WorkerPrivate* aParent, JSContext* aParentJSContext, const nsAString& aScriptURL, diff --git a/js/src/ctypes/CTypes.cpp b/js/src/ctypes/CTypes.cpp index b38d56062318..95560ae20f79 100644 --- a/js/src/ctypes/CTypes.cpp +++ b/js/src/ctypes/CTypes.cpp @@ -5790,7 +5790,9 @@ FunctionType::Call(JSContext* cx, } // Let the runtime callback know that we are about to call into C. - js::AutoCTypesActivityCallback autoCallback(cx, js::CTYPES_CALL_BEGIN, js::CTYPES_CALL_END); + js::CTypesActivityCallback activityCallback = cx->runtime->ctypesActivityCallback; + if (activityCallback) + activityCallback(cx, js::CTYPES_CALL_BEGIN); uintptr_t fn = *reinterpret_cast(CData::GetData(obj)); @@ -5819,8 +5821,8 @@ FunctionType::Call(JSContext* cx, errno = savedErrno; - // We're no longer calling into C. - autoCallback.DoEndCallback(); + if (activityCallback) + activityCallback(cx, js::CTYPES_CALL_END); // Store the error value for later consultation with |ctypes.getStatus| JSObject *objCTypes = CType::GetGlobalCTypes(cx, typeObj); @@ -6103,12 +6105,6 @@ CClosure::ClosureStub(ffi_cif* cif, void* result, void** args, void* userData) // Retrieve the essentials from our closure object. ClosureInfo* cinfo = static_cast(userData); JSContext* cx = cinfo->cx; - - // Let the runtime callback know that we are about to call into JS again. The end callback will - // fire automatically when we exit this function. - js::AutoCTypesActivityCallback autoCallback(cx, js::CTYPES_CALLBACK_BEGIN, - js::CTYPES_CALLBACK_END); - RootedObject typeObj(cx, cinfo->typeObj); RootedObject thisObj(cx, cinfo->thisObj); RootedObject jsfnObj(cx, cinfo->jsfnObj); diff --git a/js/src/jsfriendapi.cpp b/js/src/jsfriendapi.cpp index f813e2c8288b..353c3855a344 100644 --- a/js/src/jsfriendapi.cpp +++ b/js/src/jsfriendapi.cpp @@ -990,15 +990,3 @@ js::SetCTypesActivityCallback(JSRuntime *rt, CTypesActivityCallback cb) { rt->ctypesActivityCallback = cb; } - -js::AutoCTypesActivityCallback::AutoCTypesActivityCallback(JSContext *cx, - js::CTypesActivityType beginType, - js::CTypesActivityType endType - MOZ_GUARD_OBJECT_NOTIFIER_PARAM_IN_IMPL) - : cx(cx), callback(cx->runtime->ctypesActivityCallback), beginType(beginType), endType(endType) -{ - MOZ_GUARD_OBJECT_NOTIFIER_INIT; - - if (callback) - callback(cx, beginType); -} diff --git a/js/src/jsfriendapi.h b/js/src/jsfriendapi.h index 48583aa8059b..ca19ca53bbe7 100644 --- a/js/src/jsfriendapi.h +++ b/js/src/jsfriendapi.h @@ -1563,9 +1563,7 @@ IsTypedArrayThisCheck(JS::IsAcceptableThis test); enum CTypesActivityType { CTYPES_CALL_BEGIN, - CTYPES_CALL_END, - CTYPES_CALLBACK_BEGIN, - CTYPES_CALLBACK_END + CTYPES_CALL_END }; typedef void @@ -1578,29 +1576,6 @@ typedef void JS_FRIEND_API(void) SetCTypesActivityCallback(JSRuntime *rt, CTypesActivityCallback cb); -class JS_FRIEND_API(AutoCTypesActivityCallback) { - private: - JSContext *cx; - CTypesActivityCallback callback; - CTypesActivityType beginType; - CTypesActivityType endType; - MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER - - public: - AutoCTypesActivityCallback(JSContext *cx, CTypesActivityType beginType, - CTypesActivityType endType - MOZ_GUARD_OBJECT_NOTIFIER_PARAM); - ~AutoCTypesActivityCallback() { - DoEndCallback(); - } - void DoEndCallback() { - if (callback) { - callback(cx, endType); - callback = NULL; - } - } -}; - } /* namespace js */ #endif /* jsfriendapi_h___ */