mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 945416 part 4. Introduce a DoNewResolve method on nsGlobalWindow and call it from nsWindowSH::NewResolve. r=peterv
This commit is contained in:
parent
eb36ccef5e
commit
43c7d1c9d4
@ -3378,8 +3378,9 @@ nsWindowSH::NewResolve(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
|
||||
js::UncheckedUnwrap(obj, /* stopAtOuter = */ false));
|
||||
JSAutoCompartment ac(cx, global);
|
||||
JS::Rooted<JSPropertyDescriptor> desc(cx);
|
||||
nsresult rv = GlobalResolve(win, cx, global, id, &desc);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
if (!win->DoNewResolve(cx, global, id, &desc)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
// If we have an object here, that means we resolved the property.
|
||||
// But if the value is undefined, that means that GlobalResolve
|
||||
// also already defined it, so we don't have to.
|
||||
@ -3392,8 +3393,9 @@ nsWindowSH::NewResolve(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
|
||||
}
|
||||
|
||||
JS::Rooted<JSPropertyDescriptor> desc(cx);
|
||||
nsresult rv = GlobalResolve(win, cx, obj, id, &desc);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
if (!win->DoNewResolve(cx, obj, id, &desc)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
if (desc.object()) {
|
||||
// If we have an object here, that means we resolved the property.
|
||||
// But if the value is undefined, that means that GlobalResolve
|
||||
@ -3414,8 +3416,8 @@ nsWindowSH::NewResolve(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
|
||||
if (!(flags & JSRESOLVE_ASSIGNING) && sDocument_id == id) {
|
||||
nsCOMPtr<nsIDocument> document = win->GetDoc();
|
||||
JS::Rooted<JS::Value> v(cx);
|
||||
rv = WrapNative(cx, JS::CurrentGlobalOrNull(cx), document, document,
|
||||
&NS_GET_IID(nsIDOMDocument), &v, false);
|
||||
nsresult rv = WrapNative(cx, JS::CurrentGlobalOrNull(cx), document, document,
|
||||
&NS_GET_IID(nsIDOMDocument), &v, false);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// nsIDocument::WrapObject will handle defining the property.
|
||||
|
@ -258,6 +258,7 @@ protected:
|
||||
JS::Handle<JSObject*> obj, JS::Handle<jsid> id,
|
||||
JS::MutableHandle<JSPropertyDescriptor> desc);
|
||||
|
||||
friend class nsGlobalWindow;
|
||||
public:
|
||||
NS_IMETHOD PreCreate(nsISupports *nativeObj, JSContext *cx,
|
||||
JSObject *globalObj, JSObject **parentObj) MOZ_OVERRIDE;
|
||||
|
@ -4052,6 +4052,25 @@ nsGlobalWindow::GetSupportedNames(nsTArray<nsString>& aNames)
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
nsGlobalWindow::DoNewResolve(JSContext* aCx, JS::Handle<JSObject*> aObj,
|
||||
JS::Handle<jsid> aId,
|
||||
JS::MutableHandle<JSPropertyDescriptor> aDesc)
|
||||
{
|
||||
MOZ_ASSERT(IsInnerWindow());
|
||||
|
||||
if (!JSID_IS_STRING(aId)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
nsresult rv = nsWindowSH::GlobalResolve(this, aCx, aObj, aId, aDesc);
|
||||
if (NS_FAILED(rv)) {
|
||||
return Throw(aCx, rv);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
nsIDOMOfflineResourceList*
|
||||
nsGlobalWindow::GetApplicationCache(ErrorResult& aError)
|
||||
{
|
||||
|
@ -475,6 +475,10 @@ public:
|
||||
|
||||
void GetSupportedNames(nsTArray<nsString>& aNames);
|
||||
|
||||
bool DoNewResolve(JSContext* aCx, JS::Handle<JSObject*> aObj,
|
||||
JS::Handle<jsid> aId,
|
||||
JS::MutableHandle<JSPropertyDescriptor> aDesc);
|
||||
|
||||
// Object Management
|
||||
nsGlobalWindow(nsGlobalWindow *aOuterWindow);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user