зеркало из https://github.com/mozilla/gecko-dev.git
Bug 779048 part 0.5. Don't require a JSContext argument for nsJSUtils::GetStaticScriptGlobal. r=bholley
This commit is contained in:
Родитель
e09214c973
Коммит
63fb55a443
|
@ -1734,7 +1734,7 @@ nsContentUtils::GetDocumentFromCaller()
|
|||
JSAutoCompartment ac(cx, obj);
|
||||
|
||||
nsCOMPtr<nsPIDOMWindow> win =
|
||||
do_QueryInterface(nsJSUtils::GetStaticScriptGlobal(cx, obj));
|
||||
do_QueryInterface(nsJSUtils::GetStaticScriptGlobal(obj));
|
||||
if (!win) {
|
||||
return nullptr;
|
||||
}
|
||||
|
|
|
@ -1172,7 +1172,7 @@ nsEventListenerManager::SetEventHandlerToJsval(nsIAtom* aEventName,
|
|||
|
||||
// We might not have a script context, e.g. if we're setting a listener
|
||||
// on a dead Window.
|
||||
nsIScriptContext *context = nsJSUtils::GetStaticScriptContext(cx, aScope);
|
||||
nsIScriptContext *context = nsJSUtils::GetStaticScriptContext(aScope);
|
||||
NS_ENSURE_TRUE(context || !aExpectScriptContext, NS_ERROR_FAILURE);
|
||||
|
||||
JSObject *scope = ::JS_GetGlobalForObject(cx, aScope);
|
||||
|
|
|
@ -45,7 +45,7 @@ nsJSUtils::GetCallingLocation(JSContext* aContext, const char* *aFilename,
|
|||
}
|
||||
|
||||
nsIScriptGlobalObject *
|
||||
nsJSUtils::GetStaticScriptGlobal(JSContext* aContext, JSObject* aObj)
|
||||
nsJSUtils::GetStaticScriptGlobal(JSObject* aObj)
|
||||
{
|
||||
JSClass* clazz;
|
||||
JSObject* glob = aObj; // starting point for search
|
||||
|
@ -53,7 +53,7 @@ nsJSUtils::GetStaticScriptGlobal(JSContext* aContext, JSObject* aObj)
|
|||
if (!glob)
|
||||
return nullptr;
|
||||
|
||||
glob = JS_GetGlobalForObject(aContext, glob);
|
||||
glob = js::GetGlobalForObjectCrossCompartment(glob);
|
||||
NS_ABORT_IF_FALSE(glob, "Infallible returns null");
|
||||
|
||||
clazz = JS_GetClass(glob);
|
||||
|
@ -88,9 +88,9 @@ nsJSUtils::GetStaticScriptGlobal(JSContext* aContext, JSObject* aObj)
|
|||
}
|
||||
|
||||
nsIScriptContext *
|
||||
nsJSUtils::GetStaticScriptContext(JSContext* aContext, JSObject* aObj)
|
||||
nsJSUtils::GetStaticScriptContext(JSObject* aObj)
|
||||
{
|
||||
nsIScriptGlobalObject *nativeGlobal = GetStaticScriptGlobal(aContext, aObj);
|
||||
nsIScriptGlobalObject *nativeGlobal = GetStaticScriptGlobal(aObj);
|
||||
if (!nativeGlobal)
|
||||
return nullptr;
|
||||
|
||||
|
@ -122,8 +122,7 @@ nsJSUtils::GetCurrentlyRunningCodeInnerWindowID(JSContext *aContext)
|
|||
|
||||
JSObject *jsGlobal = JS_GetGlobalForScopeChain(aContext);
|
||||
if (jsGlobal) {
|
||||
nsIScriptGlobalObject *scriptGlobal = GetStaticScriptGlobal(aContext,
|
||||
jsGlobal);
|
||||
nsIScriptGlobalObject *scriptGlobal = GetStaticScriptGlobal(jsGlobal);
|
||||
if (scriptGlobal) {
|
||||
nsCOMPtr<nsPIDOMWindow> win = do_QueryInterface(scriptGlobal);
|
||||
if (win)
|
||||
|
|
|
@ -30,11 +30,9 @@ public:
|
|||
static JSBool GetCallingLocation(JSContext* aContext, const char* *aFilename,
|
||||
uint32_t* aLineno);
|
||||
|
||||
static nsIScriptGlobalObject *GetStaticScriptGlobal(JSContext* aContext,
|
||||
JSObject* aObj);
|
||||
static nsIScriptGlobalObject *GetStaticScriptGlobal(JSObject* aObj);
|
||||
|
||||
static nsIScriptContext *GetStaticScriptContext(JSContext* aContext,
|
||||
JSObject* aObj);
|
||||
static nsIScriptContext *GetStaticScriptContext(JSObject* aObj);
|
||||
|
||||
static nsIScriptGlobalObject *GetDynamicScriptGlobal(JSContext *aContext);
|
||||
|
||||
|
|
|
@ -1027,7 +1027,7 @@ public:
|
|||
nsIScriptGlobalObject* sgo;
|
||||
|
||||
if (aWorkerPrivate ||
|
||||
!(sgo = nsJSUtils::GetStaticScriptGlobal(aCx, aTarget))) {
|
||||
!(sgo = nsJSUtils::GetStaticScriptGlobal(aTarget))) {
|
||||
// Fire a normal ErrorEvent if we're running on a worker thread.
|
||||
JSObject* event =
|
||||
CreateErrorEvent(aCx, message, filename, aLineNumber, false);
|
||||
|
@ -2536,7 +2536,7 @@ WorkerPrivate::Create(JSContext* aCx, JSObject* aObj, WorkerPrivate* aParent,
|
|||
|
||||
// See if we're being called from a window or from somewhere else.
|
||||
nsCOMPtr<nsIScriptGlobalObject> scriptGlobal =
|
||||
nsJSUtils::GetStaticScriptGlobal(aCx, JS_GetGlobalForScopeChain(aCx));
|
||||
nsJSUtils::GetStaticScriptGlobal(JS_GetGlobalForScopeChain(aCx));
|
||||
if (scriptGlobal) {
|
||||
// Window!
|
||||
nsCOMPtr<nsPIDOMWindow> globalWindow = do_QueryInterface(scriptGlobal);
|
||||
|
|
|
@ -4786,7 +4786,7 @@ ContentComponentsGetterOp(JSContext *cx, JSHandleObject obj, JSHandleId id,
|
|||
// Warn once.
|
||||
JSAutoCompartment ac(cx, obj);
|
||||
nsCOMPtr<nsPIDOMWindow> win =
|
||||
do_QueryInterface(nsJSUtils::GetStaticScriptGlobal(cx, obj));
|
||||
do_QueryInterface(nsJSUtils::GetStaticScriptGlobal(obj));
|
||||
if (win) {
|
||||
nsCOMPtr<nsIDocument> doc =
|
||||
do_QueryInterface(win->GetExtantDocument());
|
||||
|
|
|
@ -379,7 +379,7 @@ ExposedPropertiesOnly::check(JSContext *cx, JSObject *wrapper, jsid id, Wrapper:
|
|||
{
|
||||
// This little loop hole will go away soon! See bug 553102.
|
||||
nsCOMPtr<nsPIDOMWindow> win =
|
||||
do_QueryInterface(nsJSUtils::GetStaticScriptGlobal(cx, wrapper));
|
||||
do_QueryInterface(nsJSUtils::GetStaticScriptGlobal(wrapper));
|
||||
if (win) {
|
||||
nsCOMPtr<nsIDocument> doc =
|
||||
do_QueryInterface(win->GetExtantDocument());
|
||||
|
|
Загрузка…
Ссылка в новой задаче