mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-13 03:24:26 +00:00
Bug 1017424 part 7. Remove code to handle XPConnect window wrappers from WindowNamedPropertiesHandler and XPCJSRuntime. r=peterv
This commit is contained in:
parent
586aabb26c
commit
7dd6d51191
@ -69,19 +69,6 @@ ShouldExposeChildWindow(nsString& aNameBeingResolved, nsIDOMWindow *aChild)
|
||||
aNameBeingResolved, eCaseMatters);
|
||||
}
|
||||
|
||||
static nsGlobalWindow*
|
||||
GetWindowFromGlobal(JSObject* aGlobal)
|
||||
{
|
||||
nsGlobalWindow* win;
|
||||
if (NS_SUCCEEDED(UNWRAP_OBJECT(Window, aGlobal, win))) {
|
||||
return win;
|
||||
}
|
||||
XPCWrappedNative* wrapper = XPCWrappedNative::Get(aGlobal);
|
||||
nsCOMPtr<nsPIDOMWindow> piWin = do_QueryWrappedNative(wrapper);
|
||||
MOZ_ASSERT(piWin);
|
||||
return static_cast<nsGlobalWindow*>(piWin.get());
|
||||
}
|
||||
|
||||
bool
|
||||
WindowNamedPropertiesHandler::getOwnPropDescriptor(JSContext* aCx,
|
||||
JS::Handle<JSObject*> aProxy,
|
||||
@ -106,7 +93,7 @@ WindowNamedPropertiesHandler::getOwnPropDescriptor(JSContext* aCx,
|
||||
}
|
||||
|
||||
// Grab the DOM window.
|
||||
nsGlobalWindow* win = GetWindowFromGlobal(global);
|
||||
nsGlobalWindow* win = xpc::WindowOrNull(global);
|
||||
if (win->Length() > 0) {
|
||||
nsCOMPtr<nsIDOMWindow> childWin = win->GetChildWindow(str);
|
||||
if (childWin && ShouldExposeChildWindow(str, childWin)) {
|
||||
@ -178,7 +165,7 @@ WindowNamedPropertiesHandler::ownPropNames(JSContext* aCx,
|
||||
JS::AutoIdVector& aProps) const
|
||||
{
|
||||
// Grab the DOM window.
|
||||
nsGlobalWindow* win = GetWindowFromGlobal(JS_GetGlobalForObject(aCx, aProxy));
|
||||
nsGlobalWindow* win = xpc::WindowOrNull(JS_GetGlobalForObject(aCx, aProxy));
|
||||
nsTArray<nsString> names;
|
||||
win->GetSupportedNames(names);
|
||||
// Filter out the ones we wouldn't expose from getOwnPropertyDescriptor.
|
||||
|
@ -13881,7 +13881,6 @@ nsGlobalModalWindow::SetReturnValue(nsIVariant *aRetVal)
|
||||
bool
|
||||
nsGlobalWindow::IsModalContentWindow(JSContext* aCx, JSObject* aGlobal)
|
||||
{
|
||||
// For now, have to deal with XPConnect objects here.
|
||||
return xpc::WindowOrNull(aGlobal)->IsModalContentWindow();
|
||||
}
|
||||
|
||||
|
@ -561,19 +561,9 @@ WindowOrNull(JSObject *aObj)
|
||||
MOZ_ASSERT(aObj);
|
||||
MOZ_ASSERT(!js::IsWrapper(aObj));
|
||||
|
||||
// This will always return null until we have Window on WebIDL bindings,
|
||||
// at which point it will do the right thing.
|
||||
if (!IS_WN_CLASS(js::GetObjectClass(aObj))) {
|
||||
nsGlobalWindow* win = nullptr;
|
||||
UNWRAP_OBJECT(Window, aObj, win);
|
||||
return win;
|
||||
}
|
||||
|
||||
nsISupports* supports = XPCWrappedNative::Get(aObj)->GetIdentityObject();
|
||||
nsCOMPtr<nsPIDOMWindow> piWin = do_QueryInterface(supports);
|
||||
if (!piWin)
|
||||
return nullptr;
|
||||
return static_cast<nsGlobalWindow*>(piWin.get());
|
||||
nsGlobalWindow* win = nullptr;
|
||||
UNWRAP_OBJECT(Window, aObj, win);
|
||||
return win;
|
||||
}
|
||||
|
||||
nsGlobalWindow*
|
||||
|
Loading…
x
Reference in New Issue
Block a user