diff --git a/binary/src/dactylUtils.cpp b/binary/src/dactylUtils.cpp index 88917f0c..23be0c1d 100644 --- a/binary/src/dactylUtils.cpp +++ b/binary/src/dactylUtils.cpp @@ -38,10 +38,20 @@ #include "dactylUtils.h" #include "jsdbgapi.h" -#include "jsobj.h" +// #include "jsobj.h" #include "nsStringAPI.h" +#if GECKO_MAJOR < 10 + static inline JSObject* + JS_GetGlobalForScopeChain(JSContext *cx) { + JSObject *callingScope = JS_GetScopeChain(cx); + if (!callingScope) + return nsnull; + return JS_GetGlobalForObject(cx, callingScope); + } +#endif + /* * Evil. Evil, evil, evil. */ @@ -244,9 +254,8 @@ dactylUtils::EvalInContext(const nsAString &aSource, { JSAutoRequest req(cx); - callingScope = JS_GetScopeChain(cx); + callingScope = JS_GetGlobalForScopeChain(cx); NS_ENSURE_TRUE(callingScope, NS_ERROR_FAILURE); - callingScope = JS_GetGlobalForObject(cx, callingScope); } { @@ -313,6 +322,10 @@ dactylUtils::CreateContents(nsIDOMElement *aElement) return NS_OK; } +namespace XPCWrapper { + extern JSObject *UnsafeUnwrapSecurityWrapper(JSObject *obj); +}; + NS_IMETHODIMP dactylUtils::GetGlobalForObject(const jsval &aObject, JSContext *cx, @@ -323,18 +336,16 @@ dactylUtils::GetGlobalForObject(const jsval &aObject, NS_ENSURE_FALSE(JSVAL_IS_PRIMITIVE(aObject), NS_ERROR_XPC_BAD_CONVERT_JS); - JSObject *obj = JSVAL_TO_OBJECT(aObject); -#ifndef WIN32 /* Why? No idea. */ - if (obj->isProxy()) -#endif - obj = obj->unwrap(); + JSObject *obj = XPCWrapper::UnsafeUnwrapSecurityWrapper(JSVAL_TO_OBJECT(aObject)); JSObject *global = JS_GetGlobalForObject(cx, obj); *rval = OBJECT_TO_JSVAL(global); + /* // Outerize if necessary. if (JSObjectOp outerize = global->getClass()->ext.outerObject) *rval = OBJECT_TO_JSVAL(outerize(cx, global)); + */ return NS_OK; } diff --git a/binary/src/subscriptLoader.cpp b/binary/src/subscriptLoader.cpp index 82769cba..1c7b5cce 100644 --- a/binary/src/subscriptLoader.cpp +++ b/binary/src/subscriptLoader.cpp @@ -79,6 +79,13 @@ inline PRBool EnsureStringLength(T& aStr, PRUint32 aLen) #include "jsdbgapi.h" #include "jsfriendapi.h" +#if GECKO_MAJOR < 10 + static inline JSVersion + JS_GetVersion(JSContext *cx) { + return cx->findVersion(); + } +#endif + #include "mozilla/FunctionTimer.h" #include "mozilla/scache/StartupCache.h" #include "mozilla/scache/StartupCacheUtils.h" @@ -519,7 +526,7 @@ dactylUtils::LoadSubScript (const PRUnichar * aURL bool writeScript = false; JSScriptType *scriptObj = nsnull; - JSVersion version = cx->findVersion(); + JSVersion version = JS_GetVersion(cx); nsCAutoString cachePath; cachePath.Append("jssubloader/"); diff --git a/common/modules/buffer.jsm b/common/modules/buffer.jsm index 90b5c976..49548dd2 100644 --- a/common/modules/buffer.jsm +++ b/common/modules/buffer.jsm @@ -877,7 +877,7 @@ var Buffer = Module("Buffer", { showElementInfo: function showElementInfo(elem) { let { dactyl } = this.modules; - dactyl.echo(<>Element:
{util.objectToString(elem, true)}, commandline.FORCE_MULTILINE); + dactyl.echo(<>Element:
{util.objectToString(elem, true)}); }, /**