зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1359093 - Inline the ToWindowProxyIfWindow is-global check. r=evilpie
--HG-- extra : rebase_source : 5ea21a17fcb72114f6740f41343f2168ddede125
This commit is contained in:
Родитель
9a36b7a7b6
Коммит
1331eb4e54
|
@ -1436,10 +1436,10 @@ js::ToWindowIfWindowProxy(JSObject* obj)
|
|||
}
|
||||
|
||||
JS_FRIEND_API(JSObject*)
|
||||
js::ToWindowProxyIfWindow(JSObject* obj)
|
||||
js::detail::ToWindowProxyIfWindowSlow(JSObject* obj)
|
||||
{
|
||||
if (IsWindow(obj))
|
||||
return obj->as<GlobalObject>().windowProxy();
|
||||
if (JSObject* windowProxy = obj->as<GlobalObject>().maybeWindowProxy())
|
||||
return windowProxy;
|
||||
return obj;
|
||||
}
|
||||
|
||||
|
|
|
@ -2890,6 +2890,9 @@ namespace detail {
|
|||
JS_FRIEND_API(bool)
|
||||
IsWindowSlow(JSObject* obj);
|
||||
|
||||
JS_FRIEND_API(JSObject*)
|
||||
ToWindowProxyIfWindowSlow(JSObject* obj);
|
||||
|
||||
} // namespace detail
|
||||
|
||||
/**
|
||||
|
@ -2915,8 +2918,13 @@ IsWindowProxy(JSObject* obj);
|
|||
* wrapper if the page was navigated away from), else return `obj`. This
|
||||
* function is infallible and never returns nullptr.
|
||||
*/
|
||||
extern JS_FRIEND_API(JSObject*)
|
||||
ToWindowProxyIfWindow(JSObject* obj);
|
||||
MOZ_ALWAYS_INLINE JSObject*
|
||||
ToWindowProxyIfWindow(JSObject* obj)
|
||||
{
|
||||
if (GetObjectClass(obj)->flags & JSCLASS_IS_GLOBAL)
|
||||
return detail::ToWindowProxyIfWindowSlow(obj);
|
||||
return obj;
|
||||
}
|
||||
|
||||
/**
|
||||
* If `obj` is a WindowProxy, get its associated Window (the compartment's
|
||||
|
|
|
@ -299,7 +299,7 @@ js::ProxyHasOwn(JSContext* cx, HandleObject proxy, HandleValue idVal, MutableHan
|
|||
return true;
|
||||
}
|
||||
|
||||
static Value
|
||||
static MOZ_ALWAYS_INLINE Value
|
||||
ValueToWindowProxyIfWindow(const Value& v)
|
||||
{
|
||||
if (v.isObject())
|
||||
|
|
Загрузка…
Ссылка в новой задаче