import changes from wicknix/Arctic-Fox:

- Backport of Mozilla Bug 1267338. Remove dead codepath for the case when we opened a window even though popupState was openAbused, since we never open a window in that situation (4930e3bb7)
- slightly modernize code, use nsPIDOMWindow and prepare for next patch (37e709eca) (with missed win32 code plugged in)
- Backport of Mozilla Bug 1222516 part 1. Add a window API for opening a window with navigation and a given docshell loadinfo to use for the navigation. (d4c222d45)
- Backport of Mozilla Bug 1222516 part 2. Add a window API for opening a window passing through a boolean indicating that no opener should be set on the result. (c3259462b)
- first batch to transition nsIDOMWindow to nsPIDOMWindow at about TenFourFox level (dba07065a)
- update also GetOpener to nsPIDOMWindow (701c46ecb)
- Backport of Mozilla Bug 1207245 - part 1 - move RefCounted<T> to its own file (1acef0a1d)
- Bug 1207245 - part 2 followup - add more mozilla/RefCounted.h (31cad506d)
- Bug 1207245 - part 0 - fix why-did-we-allow-that tests in TestRefPtr.cpp (cad11cb06)
This commit is contained in:
2019-01-10 12:06:49 +08:00
parent fbf8f290b8
commit ba81dbdaa6
37 changed files with 560 additions and 578 deletions
+13 -17
View File
@@ -3194,7 +3194,7 @@ nsDocShell::GetSessionStorageForPrincipal(nsIPrincipal* aPrincipal,
return NS_ERROR_UNEXPECTED;
}
nsCOMPtr<nsIDOMWindow> domWin = do_GetInterface(GetAsSupports(this));
nsCOMPtr<nsPIDOMWindow> domWin = do_GetInterface(GetAsSupports(this));
if (aCreate) {
return manager->CreateStorage(domWin, aPrincipal, aDocumentURI,
@@ -3702,14 +3702,13 @@ nsDocShell::CanAccessItem(nsIDocShellTreeItem* aTargetItem,
return false;
}
nsCOMPtr<nsIDOMWindow> targetWindow = aTargetItem->GetWindow();
nsCOMPtr<nsPIDOMWindow> targetWindow = aTargetItem->GetWindow();
if (!targetWindow) {
NS_ERROR("This should not happen, really");
return false;
}
nsCOMPtr<nsIDOMWindow> targetOpener;
targetWindow->GetOpener(getter_AddRefs(targetOpener));
nsCOMPtr<nsIDOMWindow> targetOpener = targetWindow->GetOpener();
nsCOMPtr<nsIWebNavigation> openerWebNav(do_GetInterface(targetOpener));
nsCOMPtr<nsIDocShellTreeItem> openerItem(do_QueryInterface(openerWebNav));
@@ -3723,7 +3722,7 @@ nsDocShell::CanAccessItem(nsIDocShellTreeItem* aTargetItem,
static bool
ItemIsActive(nsIDocShellTreeItem* aItem)
{
nsCOMPtr<nsIDOMWindow> window = aItem->GetWindow();
nsCOMPtr<nsPIDOMWindow> window = aItem->GetWindow();
if (window) {
bool isClosed;
@@ -3983,7 +3982,7 @@ PrintDocTree(nsIDocShellTreeItem* aParentNode, int aLevel)
parentAsDocShell->GetPresContext(getter_AddRefs(presContext));
nsIDocument* doc = presShell->GetDocument();
nsCOMPtr<nsIDOMWindow> domwin(doc->GetWindow());
nsCOMPtr<nsPIDOMWindow> domwin(doc->GetWindow());
nsCOMPtr<nsIWidget> widget;
nsViewManager* vm = presShell->GetViewManager();
@@ -9982,7 +9981,7 @@ nsDocShell::InternalLoad2(nsIURI* aURI,
// So, the best we can do, is to tear down the new window
// that was just created!
//
nsCOMPtr<nsIDOMWindow> domWin = targetDocShell->GetWindow();
nsCOMPtr<nsPIDOMWindow> domWin = targetDocShell->GetWindow();
if (domWin) {
domWin->Close();
}
@@ -13256,10 +13255,11 @@ nsDocShell::GetAssociatedWindow(nsIDOMWindow** aWindow)
NS_IMETHODIMP
nsDocShell::GetTopWindow(nsIDOMWindow** aWindow)
{
nsCOMPtr<nsIDOMWindow> win = GetWindow();
nsCOMPtr<nsPIDOMWindow> win = GetWindow();
if (win) {
win->GetTop(aWindow);
win = win->GetTop();
}
win.forget(aWindow);
return NS_OK;
}
@@ -13267,23 +13267,19 @@ NS_IMETHODIMP
nsDocShell::GetTopFrameElement(nsIDOMElement** aElement)
{
*aElement = nullptr;
nsCOMPtr<nsIDOMWindow> win = GetWindow();
nsCOMPtr<nsPIDOMWindow> win = GetWindow();
if (!win) {
return NS_OK;
}
nsCOMPtr<nsIDOMWindow> top;
win->GetScriptableTop(getter_AddRefs(top));
nsCOMPtr<nsPIDOMWindow> top = win->GetScriptableTop();
NS_ENSURE_TRUE(top, NS_ERROR_FAILURE);
nsCOMPtr<nsPIDOMWindow> piTop = do_QueryInterface(top);
NS_ENSURE_TRUE(piTop, NS_ERROR_FAILURE);
// GetFrameElementInternal, /not/ GetScriptableFrameElement -- if |top| is
// inside <iframe mozbrowser>, we want to return the iframe, not null.
// And we want to cross the content/chrome boundary.
nsCOMPtr<nsIDOMElement> elt =
do_QueryInterface(piTop->GetFrameElementInternal());
do_QueryInterface(top->GetFrameElementInternal());
elt.forget(aElement);
return NS_OK;
}
@@ -13398,7 +13394,7 @@ nsDocShell::EnsureCommandHandler()
return NS_ERROR_OUT_OF_MEMORY;
}
nsCOMPtr<nsIDOMWindow> domWindow = GetWindow();
nsCOMPtr<nsPIDOMWindow> domWindow = GetWindow();
nsresult rv = commandUpdater->Init(domWindow);
if (NS_SUCCEEDED(rv)) {
mCommandManager = do_QueryInterface(commandUpdater);