mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 850517 - Factor out child window lookup into a helper. r=mrbkap
This commit is contained in:
parent
595f5e3955
commit
4a97aa3720
@ -5486,18 +5486,7 @@ nsWindowSH::NewResolve(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
|
||||
if (!ObjectIsNativeWrapper(cx, obj) ||
|
||||
xpc::WrapperFactory::XrayWrapperNotShadowing(obj, id)) {
|
||||
if (win->GetLength() > 0) {
|
||||
const jschar *chars = ::JS_GetInternedStringChars(JSID_TO_STRING(id));
|
||||
|
||||
nsCOMPtr<nsIDocShellTreeNode> dsn(do_QueryInterface(win->GetDocShell()));
|
||||
MOZ_ASSERT(dsn);
|
||||
|
||||
nsCOMPtr<nsIDocShellTreeItem> child;
|
||||
dsn->FindChildWithName(reinterpret_cast<const PRUnichar*>(chars),
|
||||
false, true, nullptr, nullptr,
|
||||
getter_AddRefs(child));
|
||||
|
||||
nsCOMPtr<nsIDOMWindow> child_win(do_GetInterface(child));
|
||||
|
||||
nsCOMPtr<nsIDOMWindow> child_win = win->GetChildWindow(id);
|
||||
if (child_win) {
|
||||
// We found a subframe of the right name, define the property
|
||||
// on the wrapper so that ::NewResolve() doesn't get called
|
||||
|
@ -4627,6 +4627,23 @@ nsGlobalWindow::GetLength(uint32_t* aLength)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
already_AddRefed<nsIDOMWindow>
|
||||
nsGlobalWindow::GetChildWindow(jsid aName)
|
||||
{
|
||||
const jschar *chars = JS_GetInternedStringChars(JSID_TO_STRING(aName));
|
||||
|
||||
nsCOMPtr<nsIDocShellTreeNode> dsn(do_QueryInterface(GetDocShell()));
|
||||
NS_ENSURE_TRUE(dsn, nullptr);
|
||||
|
||||
nsCOMPtr<nsIDocShellTreeItem> child;
|
||||
dsn->FindChildWithName(reinterpret_cast<const PRUnichar*>(chars),
|
||||
false, true, nullptr, nullptr,
|
||||
getter_AddRefs(child));
|
||||
|
||||
nsCOMPtr<nsIDOMWindow> child_win(do_GetInterface(child));
|
||||
return child_win.forget();
|
||||
}
|
||||
|
||||
bool
|
||||
nsGlobalWindow::DispatchCustomEvent(const char *aEventName)
|
||||
{
|
||||
|
@ -436,6 +436,8 @@ public:
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
already_AddRefed<nsIDOMWindow> GetChildWindow(jsid aName);
|
||||
|
||||
// Returns true if dialogs need to be prevented from appearings for this
|
||||
// window. beingAbused returns whether dialogs are being abused.
|
||||
bool DialogsAreBlocked(bool *aBeingAbused);
|
||||
|
Loading…
Reference in New Issue
Block a user