author | Kyle Huey <khuey@kylehuey.com> |
Sat, 30 Jan 2016 09:05:36 -0800 | |
changeset 282426 | e22b3043887ed36bf2c634c2924a7c8d39d226b1 |
parent 282425 | 7a5baf370ad97f1e76c66f6f0c7a6c1806173bfc |
child 282427 | 998d61de14ee09ad3d63c9d3922269f9b996b791 |
push id | 29959 |
push user | philringnalda@gmail.com |
push date | Sun, 31 Jan 2016 01:09:00 +0000 |
treeherder | mozilla-central@b2a3dc4b161f [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | mrbkap, smaug |
bugs | 1241764 |
milestone | 47.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/accessible/base/DocManager.cpp +++ b/accessible/base/DocManager.cpp @@ -21,17 +21,16 @@ #endif #include "mozilla/EventListenerManager.h" #include "mozilla/dom/Event.h" // for nsIDOMEvent::InternalDOMEvent() #include "nsCURILoader.h" #include "nsDocShellLoadTypes.h" #include "nsIChannel.h" #include "nsIDOMDocument.h" -#include "nsIDOMWindow.h" #include "nsIInterfaceRequestorUtils.h" #include "nsIWebNavigation.h" #include "nsServiceManagerUtils.h" #include "nsIWebProgress.h" #include "nsCoreUtils.h" #include "nsXULAppAPI.h" #include "mozilla/dom/TabChild.h" @@ -213,21 +212,21 @@ DocManager::OnStateChange(nsIWebProgress nsresult aStatus) { NS_ASSERTION(aStateFlags & STATE_IS_DOCUMENT, "Other notifications excluded"); if (nsAccessibilityService::IsShutdown() || !aWebProgress || (aStateFlags & (STATE_START | STATE_STOP)) == 0) return NS_OK; - nsCOMPtr<nsIDOMWindow> DOMWindow; + nsCOMPtr<mozIDOMWindowProxy> DOMWindow; aWebProgress->GetDOMWindow(getter_AddRefs(DOMWindow)); NS_ENSURE_STATE(DOMWindow); - nsCOMPtr<nsPIDOMWindow> piWindow = do_QueryInterface(DOMWindow); + nsPIDOMWindowOuter* piWindow = nsPIDOMWindowOuter::From(DOMWindow); MOZ_ASSERT(piWindow); nsCOMPtr<nsIDocument> document = piWindow->GetDoc(); NS_ENSURE_STATE(document); // Document was loaded. if (aStateFlags & STATE_STOP) { #ifdef A11Y_LOG @@ -398,17 +397,17 @@ DocManager::HandleDOMDocumentLoad(nsIDoc docAcc->NotifyOfLoad(aLoadEventType); } void DocManager::AddListeners(nsIDocument* aDocument, bool aAddDOMContentLoadedListener) { - nsPIDOMWindow* window = aDocument->GetWindow(); + nsPIDOMWindowOuter* window = aDocument->GetWindow(); EventTarget* target = window->GetChromeEventHandler(); EventListenerManager* elm = target->GetOrCreateListenerManager(); elm->AddEventListenerByType(this, NS_LITERAL_STRING("pagehide"), TrustedEventsAtCapture()); #ifdef A11Y_LOG if (logging::IsEnabled(logging::eDocCreate)) logging::Text("added 'pagehide' listener"); @@ -422,17 +421,17 @@ DocManager::AddListeners(nsIDocument* aD logging::Text("added 'DOMContentLoaded' listener"); #endif } } void DocManager::RemoveListeners(nsIDocument* aDocument) { - nsPIDOMWindow* window = aDocument->GetWindow(); + nsPIDOMWindowOuter* window = aDocument->GetWindow(); if (!window) return; EventTarget* target = window->GetChromeEventHandler(); if (!target) return; EventListenerManager* elm = target->GetOrCreateListenerManager();
--- a/accessible/base/FocusManager.cpp +++ b/accessible/base/FocusManager.cpp @@ -384,17 +384,17 @@ FocusManager::FocusedDOMNode() const if (focusedElm) { if (EventStateManager::IsRemoteTarget(focusedElm)) { return nullptr; } return focusedElm; } // Otherwise the focus can be on DOM document. - nsPIDOMWindow* focusedWnd = DOMFocusManager->GetFocusedWindow(); + nsPIDOMWindowOuter* focusedWnd = DOMFocusManager->GetFocusedWindow(); return focusedWnd ? focusedWnd->GetExtantDoc() : nullptr; } nsIDocument* FocusManager::FocusedDOMDocument() const { nsINode* focusedNode = FocusedDOMNode(); return focusedNode ? focusedNode->OwnerDoc() : nullptr;
--- a/accessible/base/Logging.cpp +++ b/accessible/base/Logging.cpp @@ -387,19 +387,19 @@ static const char* sDocEventTitle = "DOC static const char* sFocusTitle = "FOCUS"; void logging::DocLoad(const char* aMsg, nsIWebProgress* aWebProgress, nsIRequest* aRequest, uint32_t aStateFlags) { MsgBegin(sDocLoadTitle, aMsg); - nsCOMPtr<nsIDOMWindow> DOMWindow; + nsCOMPtr<mozIDOMWindowProxy> DOMWindow; aWebProgress->GetDOMWindow(getter_AddRefs(DOMWindow)); - nsCOMPtr<nsPIDOMWindow> window = do_QueryInterface(DOMWindow); + nsPIDOMWindowOuter* window = nsPIDOMWindowOuter::From(DOMWindow); if (!window) { MsgEnd(); return; } nsCOMPtr<nsIDocument> documentNode = window->GetDoc(); if (!documentNode) { MsgEnd();
--- a/accessible/generic/ApplicationAccessible.cpp +++ b/accessible/generic/ApplicationAccessible.cpp @@ -10,17 +10,16 @@ #include "nsAccessibilityService.h" #include "nsAccUtils.h" #include "Relation.h" #include "Role.h" #include "States.h" #include "nsIComponentManager.h" #include "nsIDOMDocument.h" -#include "nsIDOMWindow.h" #include "nsIWindowMediator.h" #include "nsServiceManagerUtils.h" #include "mozilla/Services.h" #include "nsIStringBundle.h" using namespace mozilla::a11y; ApplicationAccessible::ApplicationAccessible() : @@ -188,17 +187,17 @@ ApplicationAccessible::CacheChildren() if (NS_FAILED(rv)) return; bool hasMore = false; windowEnumerator->HasMoreElements(&hasMore); while (hasMore) { nsCOMPtr<nsISupports> window; windowEnumerator->GetNext(getter_AddRefs(window)); - nsCOMPtr<nsPIDOMWindow> DOMWindow = do_QueryInterface(window); + nsCOMPtr<nsPIDOMWindowOuter> DOMWindow = do_QueryInterface(window); if (DOMWindow) { nsCOMPtr<nsIDocument> docNode = DOMWindow->GetDoc(); if (docNode) { GetAccService()->GetDocAccessible(docNode); // ensure creation } } windowEnumerator->HasMoreElements(&hasMore); }
--- a/accessible/generic/HyperTextAccessible.cpp +++ b/accessible/generic/HyperTextAccessible.cpp @@ -1355,17 +1355,17 @@ HyperTextAccessible::SetSelectionRange(i if (isFocusable) return NS_OK; nsFocusManager* DOMFocusManager = nsFocusManager::GetFocusManager(); if (DOMFocusManager) { NS_ENSURE_TRUE(mDoc, NS_ERROR_FAILURE); nsIDocument* docNode = mDoc->DocumentNode(); NS_ENSURE_TRUE(docNode, NS_ERROR_FAILURE); - nsCOMPtr<nsPIDOMWindow> window = docNode->GetWindow(); + nsCOMPtr<nsPIDOMWindowOuter> window = docNode->GetWindow(); nsCOMPtr<nsIDOMElement> result; DOMFocusManager->MoveFocus(window, nullptr, nsIFocusManager::MOVEFOCUS_CARET, nsIFocusManager::FLAG_BYMOVEFOCUS, getter_AddRefs(result)); } return NS_OK; }
--- a/accessible/generic/ImageAccessible.cpp +++ b/accessible/generic/ImageAccessible.cpp @@ -127,21 +127,21 @@ ImageAccessible::DoAction(uint8_t aIndex if (!uri) return false; nsAutoCString utf8spec; uri->GetSpec(utf8spec); NS_ConvertUTF8toUTF16 spec(utf8spec); nsIDocument* document = mContent->OwnerDoc(); - nsCOMPtr<nsPIDOMWindow> piWindow = document->GetWindow(); + nsCOMPtr<nsPIDOMWindowOuter> piWindow = document->GetWindow(); if (!piWindow) return false; - nsCOMPtr<nsPIDOMWindow> tmp; + nsCOMPtr<nsPIDOMWindowOuter> tmp; return NS_SUCCEEDED(piWindow->Open(spec, EmptyString(), EmptyString(), getter_AddRefs(tmp))); } //////////////////////////////////////////////////////////////////////////////// // ImageAccessible nsIntPoint
--- a/accessible/generic/RootAccessible.cpp +++ b/accessible/generic/RootAccessible.cpp @@ -480,22 +480,20 @@ RootAccessible::Shutdown() } Relation RootAccessible::RelationByType(RelationType aType) { if (!mDocumentNode || aType != RelationType::EMBEDS) return DocAccessibleWrap::RelationByType(aType); - nsPIDOMWindow* rootWindow = mDocumentNode->GetWindow(); - if (rootWindow) { - nsCOMPtr<nsIDOMWindow> contentWindow = nsGlobalWindow::Cast(rootWindow)->GetContent(); - nsCOMPtr<nsPIDOMWindow> piWindow = do_QueryInterface(contentWindow); - if (piWindow) { - nsCOMPtr<nsIDocument> contentDocumentNode = piWindow->GetDoc(); + if (nsPIDOMWindowOuter* rootWindow = mDocumentNode->GetWindow()) { + nsCOMPtr<nsPIDOMWindowOuter> contentWindow = nsGlobalWindow::Cast(rootWindow)->GetContent(); + if (contentWindow) { + nsCOMPtr<nsIDocument> contentDocumentNode = contentWindow->GetDoc(); if (contentDocumentNode) { DocAccessible* contentDocument = GetAccService()->GetDocAccessible(contentDocumentNode); if (contentDocument) return Relation(contentDocument); } } }
--- a/accessible/interfaces/nsIAccessibleDocument.idl +++ b/accessible/interfaces/nsIAccessibleDocument.idl @@ -2,29 +2,29 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "nsISupports.idl" interface nsIAccessiblePivot; interface nsIDOMDocument; -interface nsIDOMWindow; +interface mozIDOMWindowProxy; /** * An interface for in-process accessibility clients * that wish to retrieve information about a document. * When accessibility is turned on in Gecko, * there is an nsIAccessibleDocument for each document * whether it is XUL, HTML or whatever. * You can QueryInterface to nsIAccessibleDocument from the nsIAccessible for * the root node of a document or you can get one from * nsIAccessible::GetDocument(). */ -[scriptable, uuid(2be938df-0210-4609-9ece-26b197a517e5)] +[scriptable, uuid(5cad5f91-fcce-40e7-913e-4671701d19b4)] interface nsIAccessibleDocument : nsISupports { /** * The URL of the document */ readonly attribute AString URL; /** @@ -45,17 +45,17 @@ interface nsIAccessibleDocument : nsISup /** * The nsIDOMDocument interface associated with this document. */ readonly attribute nsIDOMDocument DOMDocument; /** * The nsIDOMWindow that the document resides in. */ - readonly attribute nsIDOMWindow window; + readonly attribute mozIDOMWindowProxy window; /** * Return the parent document accessible. */ readonly attribute nsIAccessibleDocument parentDocument; /** * Return the count of child document accessibles.
--- a/accessible/interfaces/nsIAccessibleRetrieval.idl +++ b/accessible/interfaces/nsIAccessibleRetrieval.idl @@ -4,17 +4,16 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "nsISupports.idl" interface nsIDOMNode; interface nsIAccessible; interface nsIWeakReference; interface nsIPresShell; -interface nsIDOMWindow; interface nsIAccessiblePivot; /** * An interface for in-process accessibility clients wishing to get an * nsIAccessible for a given DOM node. More documentation at: * http://www.mozilla.org/projects/ui/accessibility */ [scriptable, uuid(17f86615-1a3d-4021-b227-3a2ef5cbffd8)]
--- a/accessible/windows/msaa/nsWinUtils.cpp +++ b/accessible/windows/msaa/nsWinUtils.cpp @@ -40,18 +40,17 @@ nsRefPtrHashtable<nsPtrHashKey<void>, Do already_AddRefed<nsIDOMCSSStyleDeclaration> nsWinUtils::GetComputedStyleDeclaration(nsIContent* aContent) { nsIContent* elm = nsCoreUtils::GetDOMElementFor(aContent); if (!elm) return nullptr; // Returns number of items in style declaration - nsCOMPtr<nsPIDOMWindow> window = - do_QueryInterface(elm->OwnerDoc()->GetInnerWindow()); + nsCOMPtr<nsPIDOMWindowInner> window = elm->OwnerDoc()->GetInnerWindow(); if (!window) return nullptr; ErrorResult dummy; nsCOMPtr<nsICSSDeclaration> cssDecl; nsCOMPtr<Element> domElement(do_QueryInterface(elm)); cssDecl = window->GetComputedStyle(*domElement, EmptyString(), dummy); nsCOMPtr<nsIDOMCSSStyleDeclaration> domDecl = do_QueryInterface(cssDecl);
--- a/accessible/xpcom/xpcAccessibleDocument.cpp +++ b/accessible/xpcom/xpcAccessibleDocument.cpp @@ -94,17 +94,17 @@ xpcAccessibleDocument::GetDOMDocument(ns if (Intl()->DocumentNode()) CallQueryInterface(Intl()->DocumentNode(), aDOMDocument); return NS_OK; } NS_IMETHODIMP -xpcAccessibleDocument::GetWindow(nsIDOMWindow** aDOMWindow) +xpcAccessibleDocument::GetWindow(mozIDOMWindowProxy** aDOMWindow) { NS_ENSURE_ARG_POINTER(aDOMWindow); *aDOMWindow = nullptr; if (!Intl()) return NS_ERROR_FAILURE; NS_IF_ADDREF(*aDOMWindow = Intl()->DocumentNode()->GetWindow());
--- a/accessible/xpcom/xpcAccessibleDocument.h +++ b/accessible/xpcom/xpcAccessibleDocument.h @@ -36,17 +36,17 @@ public: xpcAccessibleGeneric) // nsIAccessibleDocument NS_IMETHOD GetURL(nsAString& aURL) final override; NS_IMETHOD GetTitle(nsAString& aTitle) final override; NS_IMETHOD GetMimeType(nsAString& aType) final override; NS_IMETHOD GetDocType(nsAString& aType) final override; NS_IMETHOD GetDOMDocument(nsIDOMDocument** aDOMDocument) final override; - NS_IMETHOD GetWindow(nsIDOMWindow** aDOMWindow) final override; + NS_IMETHOD GetWindow(mozIDOMWindowProxy** aDOMWindow) final override; NS_IMETHOD GetParentDocument(nsIAccessibleDocument** aDocument) final override; NS_IMETHOD GetChildDocumentCount(uint32_t* aCount) final override; NS_IMETHOD GetChildDocumentAt(uint32_t aIndex, nsIAccessibleDocument** aDocument) final override; NS_IMETHOD GetVirtualCursor(nsIAccessiblePivot** aVirtualCursor) final override;
--- a/chrome/nsChromeRegistry.cpp +++ b/chrome/nsChromeRegistry.cpp @@ -308,17 +308,17 @@ nsChromeRegistry::ConvertChromeURL(nsIUR return NS_NewURI(aResult, path, nullptr, baseURI); } //////////////////////////////////////////////////////////////////////// // theme stuff -static void FlushSkinBindingsForWindow(nsPIDOMWindow* aWindow) +static void FlushSkinBindingsForWindow(nsPIDOMWindowOuter* aWindow) { // Get the document. nsCOMPtr<nsIDocument> document = aWindow->GetDoc(); if (!document) return; // Annihilate all XBL bindings. document->FlushSkinBindings(); @@ -335,32 +335,32 @@ NS_IMETHODIMP nsChromeRegistry::RefreshS nsCOMPtr<nsISimpleEnumerator> windowEnumerator; windowMediator->GetEnumerator(nullptr, getter_AddRefs(windowEnumerator)); bool more; windowEnumerator->HasMoreElements(&more); while (more) { nsCOMPtr<nsISupports> protoWindow; windowEnumerator->GetNext(getter_AddRefs(protoWindow)); if (protoWindow) { - nsCOMPtr<nsPIDOMWindow> domWindow = do_QueryInterface(protoWindow); + nsCOMPtr<nsPIDOMWindowOuter> domWindow = do_QueryInterface(protoWindow); if (domWindow) FlushSkinBindingsForWindow(domWindow); } windowEnumerator->HasMoreElements(&more); } FlushSkinCaches(); windowMediator->GetEnumerator(nullptr, getter_AddRefs(windowEnumerator)); windowEnumerator->HasMoreElements(&more); while (more) { nsCOMPtr<nsISupports> protoWindow; windowEnumerator->GetNext(getter_AddRefs(protoWindow)); if (protoWindow) { - nsCOMPtr<nsPIDOMWindow> domWindow = do_QueryInterface(protoWindow); + nsCOMPtr<nsPIDOMWindowOuter> domWindow = do_QueryInterface(protoWindow); if (domWindow) RefreshWindow(domWindow); } windowEnumerator->HasMoreElements(&more); } return NS_OK; } @@ -372,27 +372,27 @@ nsChromeRegistry::FlushSkinCaches() mozilla::services::GetObserverService(); NS_ASSERTION(obsSvc, "Couldn't get observer service."); obsSvc->NotifyObservers(static_cast<nsIChromeRegistry*>(this), NS_CHROME_FLUSH_SKINS_TOPIC, nullptr); } // XXXbsmedberg: move this to windowmediator -nsresult nsChromeRegistry::RefreshWindow(nsPIDOMWindow* aWindow) +nsresult nsChromeRegistry::RefreshWindow(nsPIDOMWindowOuter* aWindow) { // Deal with our subframes first. nsCOMPtr<nsIDOMWindowCollection> frames = aWindow->GetFrames(); uint32_t length; frames->GetLength(&length); uint32_t j; for (j = 0; j < length; j++) { - nsCOMPtr<nsIDOMWindow> childWin; + nsCOMPtr<mozIDOMWindowProxy> childWin; frames->Item(j, getter_AddRefs(childWin)); - nsCOMPtr<nsPIDOMWindow> piWindow = do_QueryInterface(childWin); + nsCOMPtr<nsPIDOMWindowOuter> piWindow = nsPIDOMWindowOuter::From(childWin); RefreshWindow(piWindow); } nsresult rv; // Get the document. nsCOMPtr<nsIDocument> document = aWindow->GetDoc(); if (!document) return NS_OK; @@ -498,17 +498,17 @@ nsChromeRegistry::ReloadChrome() // Get each dom window bool more; rv = windowEnumerator->HasMoreElements(&more); if (NS_FAILED(rv)) return rv; while (more) { nsCOMPtr<nsISupports> protoWindow; rv = windowEnumerator->GetNext(getter_AddRefs(protoWindow)); if (NS_SUCCEEDED(rv)) { - nsCOMPtr<nsPIDOMWindow> domWindow = do_QueryInterface(protoWindow); + nsCOMPtr<nsPIDOMWindowOuter> domWindow = do_QueryInterface(protoWindow); if (domWindow) { nsIDOMLocation* location = domWindow->GetLocation(); if (location) { rv = location->Reload(false); if (NS_FAILED(rv)) return rv; } } }
--- a/chrome/nsChromeRegistry.h +++ b/chrome/nsChromeRegistry.h @@ -17,17 +17,17 @@ #include "nsString.h" #include "nsURIHashKey.h" #include "nsInterfaceHashtable.h" #include "nsXULAppAPI.h" #include "nsIXPConnect.h" #include "mozilla/FileLocation.h" -class nsPIDOMWindow; +class nsPIDOMWindowOuter; class nsIPrefBranch; class nsIURL; // The chrome registry is actually split between nsChromeRegistryChrome and // nsChromeRegistryContent. The work/data that is common to both resides in // the shared nsChromeRegistry implementation, with operations that only make // sense for one side erroring out in the other. @@ -90,17 +90,17 @@ protected: virtual nsIURI* GetBaseURIFromPackage(const nsCString& aPackage, const nsCString& aProvider, const nsCString& aPath) = 0; virtual nsresult GetFlagsFromPackage(const nsCString& aPackage, uint32_t* aFlags) = 0; nsresult SelectLocaleFromPref(nsIPrefBranch* prefs); - static nsresult RefreshWindow(nsPIDOMWindow* aWindow); + static nsresult RefreshWindow(nsPIDOMWindowOuter* aWindow); static nsresult GetProviderAndPath(nsIURL* aChromeURL, nsACString& aProvider, nsACString& aPath); bool GetDirectionForLocale(const nsACString& aLocale); public: static already_AddRefed<nsChromeRegistry> GetSingleton();
--- a/docshell/base/LoadContext.cpp +++ b/docshell/base/LoadContext.cpp @@ -64,26 +64,26 @@ LoadContext::LoadContext(nsIPrincipal* a NS_SUCCEEDED(aOptionalBase->GetUseRemoteTabs(&mUseRemoteTabs))); } //----------------------------------------------------------------------------- // LoadContext::nsILoadContext //----------------------------------------------------------------------------- NS_IMETHODIMP -LoadContext::GetAssociatedWindow(nsIDOMWindow**) +LoadContext::GetAssociatedWindow(mozIDOMWindowProxy**) { MOZ_ASSERT(mIsNotNull); // can't support this in the parent process return NS_ERROR_UNEXPECTED; } NS_IMETHODIMP -LoadContext::GetTopWindow(nsIDOMWindow**) +LoadContext::GetTopWindow(mozIDOMWindowProxy**) { MOZ_ASSERT(mIsNotNull); // can't support this in the parent process return NS_ERROR_UNEXPECTED; } NS_IMETHODIMP
--- a/docshell/base/nsDSURIContentListener.cpp +++ b/docshell/base/nsDSURIContentListener.cpp @@ -143,18 +143,18 @@ nsDSURIContentListener::DoContent(const if (NS_FAILED(rv)) { // we don't know how to handle the content *aContentHandler = nullptr; return rv; } if (loadFlags & nsIChannel::LOAD_RETARGETED_DOCUMENT_URI) { - nsCOMPtr<nsPIDOMWindow> domWindow = do_QueryInterface( - mDocShell ? mDocShell->GetWindow() : nullptr); + nsCOMPtr<nsPIDOMWindowOuter> domWindow = + mDocShell ? mDocShell->GetWindow() : nullptr; NS_ENSURE_TRUE(domWindow, NS_ERROR_FAILURE); domWindow->Focus(); } return NS_OK; } NS_IMETHODIMP @@ -289,25 +289,25 @@ nsDSURIContentListener::CheckOneFrameOpt if (!mDocShell) { return true; } // We need to check the location of this window and the location of the top // window, if we're not the top. X-F-O: SAMEORIGIN requires that the // document must be same-origin with top window. X-F-O: DENY requires that // the document must never be framed. - nsCOMPtr<nsPIDOMWindow> thisWindow = mDocShell->GetWindow(); + nsCOMPtr<nsPIDOMWindowOuter> thisWindow = mDocShell->GetWindow(); // If we don't have DOMWindow there is no risk of clickjacking if (!thisWindow) { return true; } // GetScriptableTop, not GetTop, because we want this to respect // <iframe mozbrowser> boundaries. - nsCOMPtr<nsPIDOMWindow> topWindow = thisWindow->GetScriptableTop(); + nsCOMPtr<nsPIDOMWindowOuter> topWindow = thisWindow->GetScriptableTop(); // if the document is in the top window, it's not in a frame. if (thisWindow == topWindow) { return true; } // Find the top docshell in our parent chain that doesn't have the system // principal and use it for the principal comparison. Finding the top @@ -462,23 +462,22 @@ nsDSURIContentListener::CheckFrameOption void nsDSURIContentListener::ReportXFOViolation(nsIDocShellTreeItem* aTopDocShellItem, nsIURI* aThisURI, XFOHeader aHeader) { MOZ_ASSERT(aTopDocShellItem, "Need a top docshell"); - nsCOMPtr<nsPIDOMWindow> topOuterWindow = aTopDocShellItem->GetWindow(); + nsCOMPtr<nsPIDOMWindowOuter> topOuterWindow = aTopDocShellItem->GetWindow(); if (!topOuterWindow) { return; } - NS_ASSERTION(topOuterWindow->IsOuterWindow(), "Huh?"); - nsPIDOMWindow* topInnerWindow = topOuterWindow->GetCurrentInnerWindow(); + nsPIDOMWindowInner* topInnerWindow = topOuterWindow->GetCurrentInnerWindow(); if (!topInnerWindow) { return; } nsCOMPtr<nsIURI> topURI; nsCOMPtr<nsIDocument> document = aTopDocShellItem->GetDocument(); nsresult rv = document->NodePrincipal()->GetURI(getter_AddRefs(topURI));
--- a/docshell/base/nsDocShell.cpp +++ b/docshell/base/nsDocShell.cpp @@ -959,17 +959,18 @@ nsDocShell::GetInterface(const nsIID& aI if (aIID.Equals(NS_GET_IID(nsICommandManager))) { NS_ENSURE_SUCCESS(EnsureCommandHandler(), NS_ERROR_FAILURE); *aSink = mCommandManager; } else if (aIID.Equals(NS_GET_IID(nsIURIContentListener))) { *aSink = mContentListener; } else if ((aIID.Equals(NS_GET_IID(nsIScriptGlobalObject)) || aIID.Equals(NS_GET_IID(nsIGlobalObject)) || - aIID.Equals(NS_GET_IID(nsPIDOMWindow)) || + aIID.Equals(NS_GET_IID(nsPIDOMWindowOuter)) || + aIID.Equals(NS_GET_IID(mozIDOMWindowProxy)) || aIID.Equals(NS_GET_IID(nsIDOMWindow)) || aIID.Equals(NS_GET_IID(nsIDOMWindowInternal))) && NS_SUCCEEDED(EnsureScriptEnvironment())) { return mScriptGlobal->QueryInterface(aIID, aSink); } else if (aIID.Equals(NS_GET_IID(nsIDOMDocument)) && NS_SUCCEEDED(EnsureContentViewer())) { mContentViewer->GetDOMDocument((nsIDOMDocument**)aSink); return *aSink ? NS_OK : NS_NOINTERFACE; @@ -1007,17 +1008,17 @@ nsDocShell::GetInterface(const nsIID& aI nsresult rv; nsCOMPtr<nsIWindowWatcher> wwatch = do_GetService(NS_WINDOWWATCHER_CONTRACTID, &rv); NS_ENSURE_SUCCESS(rv, rv); // Get the an auth prompter for our window so that the parenting // of the dialogs works as it should when using tabs. nsIPrompt* prompt; - rv = wwatch->GetNewPrompter(mScriptGlobal, &prompt); + rv = wwatch->GetNewPrompter(mScriptGlobal->AsOuter(), &prompt); NS_ENSURE_SUCCESS(rv, rv); *aSink = prompt; return NS_OK; } else if (aIID.Equals(NS_GET_IID(nsIAuthPrompt)) || aIID.Equals(NS_GET_IID(nsIAuthPrompt2))) { return NS_SUCCEEDED(GetAuthPrompt(PROMPT_NORMAL, aIID, aSink)) ? NS_OK : NS_NOINTERFACE; @@ -1075,18 +1076,17 @@ nsDocShell::GetInterface(const nsIID& aI } } else if (aIID.Equals(NS_GET_IID(nsIContentFrameMessageManager))) { nsCOMPtr<nsITabChild> tabChild = do_GetInterface(static_cast<nsIDocShell*>(this)); nsCOMPtr<nsIContentFrameMessageManager> mm; if (tabChild) { tabChild->GetMessageManager(getter_AddRefs(mm)); } else { - nsCOMPtr<nsPIDOMWindow> win = GetWindow(); - if (win) { + if (nsPIDOMWindowOuter* win = GetWindow()) { mm = do_QueryInterface(win->GetParentTarget()); } } *aSink = mm.get(); } else { return nsDocLoader::GetInterface(aIID, aSink); } @@ -1712,17 +1712,18 @@ nsDocShell::FirePageHideNotification(boo void nsDocShell::MaybeInitTiming() { if (mTiming && !mBlankTiming) { return; } if (mScriptGlobal && mBlankTiming) { - nsPIDOMWindow* innerWin = mScriptGlobal->GetCurrentInnerWindow(); + nsPIDOMWindowInner* innerWin = + mScriptGlobal->AsOuter()->GetCurrentInnerWindow(); if (innerWin && innerWin->GetPerformance()) { mTiming = innerWin->GetPerformance()->GetDOMTiming(); mBlankTiming = false; } } if (!mTiming) { mTiming = new nsDOMNavigationTiming(); @@ -2425,18 +2426,18 @@ nsDocShell::GetAllowMedia(bool* aAllowMe NS_IMETHODIMP nsDocShell::SetAllowMedia(bool aAllowMedia) { mAllowMedia = aAllowMedia; // Mute or unmute audio contexts attached to the inner window. if (mScriptGlobal) { - nsPIDOMWindow* innerWin = mScriptGlobal->GetCurrentInnerWindow(); - if (innerWin) { + if (nsPIDOMWindowInner* innerWin = + mScriptGlobal->AsOuter()->GetCurrentInnerWindow()) { if (aAllowMedia) { innerWin->UnmuteAudioContexts(); } else { innerWin->MuteAudioContexts(); } } } @@ -2512,17 +2513,17 @@ nsDocShell::GetFullscreenAllowed(bool* a if (mFullscreenAllowed != CHECK_ATTRIBUTES) { *aFullscreenAllowed = (mFullscreenAllowed == PARENT_ALLOWS); return NS_OK; } // Assume false until we determine otherwise... *aFullscreenAllowed = false; - nsCOMPtr<nsPIDOMWindow> win = GetWindow(); + nsCOMPtr<nsPIDOMWindowOuter> win = GetWindow(); if (!win) { return NS_OK; } nsCOMPtr<Element> frameElement = win->GetFrameElementInternal(); if (frameElement && !frameElement->IsXULElement()) { // We do not allow document inside any containing element other // than iframe to enter fullscreen. if (!frameElement->IsHTMLElement(nsGkAtoms::iframe)) { @@ -2967,24 +2968,25 @@ nsDocShell::GetSessionStorageForPrincipa bool aCreate, nsIDOMStorage** aStorage) { nsCOMPtr<nsIDOMStorageManager> manager = TopSessionStorageManager(); if (!manager) { return NS_ERROR_UNEXPECTED; } - nsCOMPtr<nsIDOMWindow> domWin = do_GetInterface(GetAsSupports(this)); + nsCOMPtr<nsPIDOMWindowOuter> domWin = do_GetInterface(GetAsSupports(this)); if (aCreate) { - return manager->CreateStorage(domWin, aPrincipal, aDocumentURI, - mInPrivateBrowsing, aStorage); - } - - return manager->GetStorage(domWin, aPrincipal, mInPrivateBrowsing, aStorage); + return manager->CreateStorage(domWin->GetCurrentInnerWindow(), aPrincipal, + aDocumentURI, mInPrivateBrowsing, aStorage); + } + + return manager->GetStorage(domWin->GetCurrentInnerWindow(), aPrincipal, + mInPrivateBrowsing, aStorage); } nsresult nsDocShell::AddSessionStorage(nsIPrincipal* aPrincipal, nsIDOMStorage* aStorage) { RefPtr<DOMStorage> storage = static_cast<DOMStorage*>(aStorage); if (!storage) { return NS_ERROR_UNEXPECTED; @@ -3540,38 +3542,38 @@ nsDocShell::CanAccessItem(nsIDocShellTre return false; } if (!aConsiderOpener) { // All done here return false; } - nsCOMPtr<nsPIDOMWindow> targetWindow = aTargetItem->GetWindow(); + nsCOMPtr<nsPIDOMWindowOuter> targetWindow = aTargetItem->GetWindow(); if (!targetWindow) { NS_ERROR("This should not happen, really"); return false; } - nsCOMPtr<nsIDOMWindow> targetOpener = targetWindow->GetOpener(); + nsCOMPtr<mozIDOMWindowProxy> targetOpener = targetWindow->GetOpener(); nsCOMPtr<nsIWebNavigation> openerWebNav(do_GetInterface(targetOpener)); nsCOMPtr<nsIDocShellTreeItem> openerItem(do_QueryInterface(openerWebNav)); if (!openerItem) { return false; } return CanAccessItem(openerItem, aAccessingItem, false); } static bool ItemIsActive(nsIDocShellTreeItem* aItem) { - if (nsCOMPtr<nsIDOMWindow> window = aItem->GetWindow()) { - auto* win = static_cast<nsGlobalWindow*>(window.get()); + if (nsCOMPtr<nsPIDOMWindowOuter> window = aItem->GetWindow()) { + auto* win = nsGlobalWindow::Cast(window); MOZ_ASSERT(win->IsOuterWindow()); if (!win->GetClosedOuter()) { return true; } } return false; } @@ -3818,17 +3820,17 @@ PrintDocTree(nsIDocShellTreeItem* aParen aParentNode->GetChildCount(&childWebshellCount); nsCOMPtr<nsIDocShell> parentAsDocShell(do_QueryInterface(aParentNode)); int32_t type = aParentNode->ItemType(); nsCOMPtr<nsIPresShell> presShell = parentAsDocShell->GetPresShell(); RefPtr<nsPresContext> presContext; parentAsDocShell->GetPresContext(getter_AddRefs(presContext)); nsIDocument* doc = presShell->GetDocument(); - nsCOMPtr<nsIDOMWindow> domwin(doc->GetWindow()); + nsCOMPtr<nsPIDOMWindowOuter> domwin(doc->GetWindow()); nsCOMPtr<nsIWidget> widget; nsViewManager* vm = presShell->GetViewManager(); if (vm) { vm->GetWidget(getter_AddRefs(widget)); } dom::Element* rootElement = doc->GetRootElement(); @@ -4437,23 +4439,23 @@ nsDocShell::GetScriptGlobalObject() nsIDocument* nsDocShell::GetDocument() { NS_ENSURE_SUCCESS(EnsureContentViewer(), nullptr); return mContentViewer->GetDocument(); } -nsPIDOMWindow* +nsPIDOMWindowOuter* nsDocShell::GetWindow() { if (NS_FAILED(EnsureScriptEnvironment())) { return nullptr; } - return mScriptGlobal; + return mScriptGlobal->AsOuter(); } NS_IMETHODIMP nsDocShell::SetDeviceSizeIsPageSize(bool aValue) { if (mDeviceSizeIsPageSize != aValue) { mDeviceSizeIsPageSize = aValue; RefPtr<nsPresContext> presContext; @@ -7570,17 +7572,17 @@ nsDocShell::EndPageLoad(nsIWebProgress* // Handle iframe document not loading error because source was // a tracking URL. We make a note of this iframe node by including // it in a dedicated array of blocked tracking nodes under its parent // document. (document of parent window of blocked document) if (isTopFrame == false && aStatus == NS_ERROR_TRACKING_URI) { // frameElement is our nsIContent to be annotated nsCOMPtr<nsIDOMElement> frameElement; - nsPIDOMWindow* thisWindow = GetWindow(); + nsPIDOMWindowOuter* thisWindow = GetWindow(); if (!thisWindow) { return NS_OK; } frameElement = thisWindow->GetFrameElement(); if (!frameElement) { return NS_OK; } @@ -7809,18 +7811,17 @@ nsDocShell::EnsureContentViewer() return NS_ERROR_FAILURE; } nsCOMPtr<nsIURI> baseURI; nsIPrincipal* principal = GetInheritedPrincipal(false); nsCOMPtr<nsIDocShellTreeItem> parentItem; GetSameTypeParent(getter_AddRefs(parentItem)); if (parentItem) { - nsCOMPtr<nsPIDOMWindow> domWin = GetWindow(); - if (domWin) { + if (nsCOMPtr<nsPIDOMWindowOuter> domWin = GetWindow()) { nsCOMPtr<Element> parentElement = domWin->GetFrameElementInternal(); if (parentElement) { baseURI = parentElement->GetBaseURI(); } } } nsresult rv = CreateAboutBlankContentViewer(principal, baseURI); @@ -8663,18 +8664,17 @@ nsDocShell::RestoreFromHistory() } // Ick, it'd be nicer to not rewalk all of the subdocs here. if (d->AnimationsPaused()) { document->SuppressEventHandling(nsIDocument::eAnimationsOnly, d->AnimationsPaused()); } - nsCOMPtr<nsPIDOMWindow> parentWindow = d->GetWindow(); - if (parentWindow) { + if (nsCOMPtr<nsPIDOMWindowOuter> parentWindow = d->GetWindow()) { parentSuspendCount = parentWindow->TimeoutSuspendCount(); } } } // Use the uri from the mLSHE we had when we entered this function // (which need not match the document's URI if anchors are involved), // since that's the history entry we're loading. Note that if we use @@ -8683,17 +8683,17 @@ nsDocShell::RestoreFromHistory() nsCOMPtr<nsIURI> uri; origLSHE->GetURI(getter_AddRefs(uri)); SetCurrentURI(uri, document->GetChannel(), true, 0); } // This is the end of our CreateContentViewer() replacement. // Now we simulate a load. First, we restore the state of the javascript // window object. - nsCOMPtr<nsPIDOMWindow> privWin = GetWindow(); + nsCOMPtr<nsPIDOMWindowOuter> privWin = GetWindow(); NS_ASSERTION(privWin, "could not get nsPIDOMWindow interface"); rv = privWin->RestoreWindowState(windowState); NS_ENSURE_SUCCESS(rv, rv); // Now, dispatch a title change event which would happen as the // <head> is parsed. document->NotifyPossibleTitleChange(false); @@ -9603,17 +9603,17 @@ nsDocShell::InternalLoad(nsIURI* aURI, // // First, notify any nsIContentPolicy listeners about the document load. // Only abort the load if a content policy listener explicitly vetos it! // nsCOMPtr<Element> requestingElement; // Use nsPIDOMWindow since we _want_ to cross the chrome boundary if needed if (mScriptGlobal) { - requestingElement = mScriptGlobal->GetFrameElementInternal(); + requestingElement = mScriptGlobal->AsOuter()->GetFrameElementInternal(); } RefPtr<nsGlobalWindow> MMADeathGrip = mScriptGlobal; int16_t shouldLoad = nsIContentPolicy::ACCEPT; uint32_t contentType; bool isNewDocShell = false; bool isTargetTopLevelDocShell = false; @@ -9757,34 +9757,34 @@ nsDocShell::InternalLoad(nsIURI* aURI, if (doc) { sandboxFlags = doc->GetSandboxFlags(); if (sandboxFlags & SANDBOXED_AUXILIARY_NAVIGATION) { return NS_ERROR_DOM_INVALID_ACCESS_ERR; } } - nsCOMPtr<nsPIDOMWindow> win = GetWindow(); + nsCOMPtr<nsPIDOMWindowOuter> win = GetWindow(); NS_ENSURE_TRUE(win, NS_ERROR_NOT_AVAILABLE); nsDependentString name(aWindowTarget); - nsCOMPtr<nsIDOMWindow> newWin; + nsCOMPtr<nsPIDOMWindowOuter> newWin; nsAutoCString spec; if (aURI) { aURI->GetSpec(spec); } rv = win->OpenNoNavigate(NS_ConvertUTF8toUTF16(spec), name, // window name EmptyString(), // Features getter_AddRefs(newWin)); // In some cases the Open call doesn't actually result in a new // window being opened. We can detect these cases by examining the // document in |newWin|, if any. - nsCOMPtr<nsPIDOMWindow> piNewWin = do_QueryInterface(newWin); + nsCOMPtr<nsPIDOMWindowOuter> piNewWin = do_QueryInterface(newWin); if (piNewWin) { nsCOMPtr<nsIDocument> newDoc = piNewWin->GetExtantDoc(); if (!newDoc || newDoc->IsInitialDocument()) { isNewWindow = true; aFlags |= INTERNAL_LOAD_FLAGS_FIRST_LOAD; // set opener object to null for noreferrer if (aFlags & INTERNAL_LOAD_FLAGS_NO_OPENER) { @@ -9827,17 +9827,17 @@ nsDocShell::InternalLoad(nsIURI* aURI, if (isNewWindow) { // // At this point, a new window has been created, but the // URI did not have any data associated with it... // // So, the best we can do, is to tear down the new window // that was just created! // - if (nsCOMPtr<nsPIDOMWindow> domWin = targetDocShell->GetWindow()) { + if (nsCOMPtr<nsPIDOMWindowOuter> domWin = targetDocShell->GetWindow()) { domWin->Close(); } } // // NS_ERROR_NO_CONTENT should not be returned to the // caller... This is an internal error code indicating that // the URI had no data associated with it - probably a // helper-app style protocol (ie. mailto://) @@ -10182,17 +10182,17 @@ nsDocShell::InternalLoad(nsIURI* aURI, if (win) { // Fire a hashchange event URIs differ, and only in their hashes. bool doHashchange = sameExceptHashes && !curHash.Equals(newHash); if (historyNavBetweenSameDoc || doHashchange) { win->DispatchSyncPopState(); } - if (needsScrollPosUpdate && win->HasActiveDocument()) { + if (needsScrollPosUpdate && win->AsInner()->HasActiveDocument()) { SetCurScrollPosEx(bx, by); } if (doHashchange) { // Note that currentURI hasn't changed because it's on the // stack, so we can just use it directly as the old URI. win->DispatchAsyncHashchange(currentURI, aURI); } @@ -10525,17 +10525,17 @@ nsDocShell::DoURILoad(nsIURI* aURI, // page. To avoid recursion, we skip this check if aURI's scheme is "about". // The goal is to prevent leaking sensitive information of an invalid page of // an app, so allowing about:blank would not be conflict to the goal. bool isAbout = false; rv = aURI->SchemeIs("about", &isAbout); if (NS_SUCCEEDED(rv) && !isAbout && nsIDocShell::GetIsApp()) { - nsCOMPtr<Element> frameElement = mScriptGlobal->GetFrameElementInternal(); + nsCOMPtr<Element> frameElement = mScriptGlobal->AsOuter()->GetFrameElementInternal(); if (frameElement) { nsCOMPtr<nsIMozBrowserFrame> browserFrame = do_QueryInterface(frameElement); // |GetReallyIsApp| indicates the browser frame is a valid app or widget. // Here we prevent navigating to an app or widget which loses its validity // by loading invalid page or other way. if (browserFrame && !browserFrame->GetReallyIsApp()) { nsCOMPtr<nsIObserverService> serv = services::GetObserverService(); if (serv) { @@ -10549,17 +10549,17 @@ nsDocShell::DoURILoad(nsIURI* aURI, // open a channel for the url nsCOMPtr<nsIChannel> channel; bool isSrcdoc = !aSrcdoc.IsVoid(); nsCOMPtr<nsINode> requestingNode; if (mScriptGlobal) { - requestingNode = mScriptGlobal->GetFrameElementInternal(); + requestingNode = mScriptGlobal->AsOuter()->GetFrameElementInternal(); if (!requestingNode) { requestingNode = mScriptGlobal->GetExtantDoc(); } } bool isSandBoxed = mSandboxFlags & SANDBOXED_ORIGIN; // only inherit if we have a triggeringPrincipal bool inherit = false; @@ -12959,18 +12959,18 @@ nsDocShell::EnsureFind() // we promise that the nsIWebBrowserFind that we return has been set // up to point to the focused, or content window, so we have to // set that up each time. nsIScriptGlobalObject* scriptGO = GetScriptGlobalObject(); NS_ENSURE_TRUE(scriptGO, NS_ERROR_UNEXPECTED); // default to our window - nsCOMPtr<nsPIDOMWindow> ourWindow = do_QueryInterface(scriptGO); - nsCOMPtr<nsPIDOMWindow> windowToSearch; + nsCOMPtr<nsPIDOMWindowOuter> ourWindow = do_QueryInterface(scriptGO); + nsCOMPtr<nsPIDOMWindowOuter> windowToSearch; nsFocusManager::GetFocusedDescendant(ourWindow, true, getter_AddRefs(windowToSearch)); nsCOMPtr<nsIWebBrowserFindInFrames> findInFrames = do_QueryInterface(mFind); if (!findInFrames) { return NS_ERROR_NO_INTERFACE; } @@ -13133,52 +13133,52 @@ nsDocShell::GetAuthPrompt(uint32_t aProm NS_ENSURE_SUCCESS(rv, rv); rv = EnsureScriptEnvironment(); NS_ENSURE_SUCCESS(rv, rv); // Get the an auth prompter for our window so that the parenting // of the dialogs works as it should when using tabs. - return wwatch->GetPrompt(mScriptGlobal, aIID, + return wwatch->GetPrompt(mScriptGlobal->AsOuter(), aIID, reinterpret_cast<void**>(aResult)); } //***************************************************************************** // nsDocShell::nsILoadContext //***************************************************************************** NS_IMETHODIMP -nsDocShell::GetAssociatedWindow(nsIDOMWindow** aWindow) +nsDocShell::GetAssociatedWindow(mozIDOMWindowProxy** aWindow) { CallGetInterface(this, aWindow); return NS_OK; } NS_IMETHODIMP -nsDocShell::GetTopWindow(nsIDOMWindow** aWindow) -{ - nsCOMPtr<nsPIDOMWindow> win = GetWindow(); +nsDocShell::GetTopWindow(mozIDOMWindowProxy** aWindow) +{ + nsCOMPtr<nsPIDOMWindowOuter> win = GetWindow(); if (win) { win = win->GetTop(); } win.forget(aWindow); return NS_OK; } NS_IMETHODIMP nsDocShell::GetTopFrameElement(nsIDOMElement** aElement) { *aElement = nullptr; - nsCOMPtr<nsPIDOMWindow> win = GetWindow(); + nsCOMPtr<nsPIDOMWindowOuter> win = GetWindow(); if (!win) { return NS_OK; } - nsCOMPtr<nsPIDOMWindow> top = win->GetScriptableTop(); + nsCOMPtr<nsPIDOMWindowOuter> top = win->GetScriptableTop(); NS_ENSURE_TRUE(top, 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(top->GetFrameElementInternal()); elt.forget(aElement); @@ -13290,17 +13290,17 @@ nsDocShell::EnsureCommandHandler() { if (!mCommandManager) { nsCOMPtr<nsPICommandUpdater> commandUpdater = do_CreateInstance("@mozilla.org/embedcomp/command-manager;1"); if (!commandUpdater) { return NS_ERROR_OUT_OF_MEMORY; } - nsCOMPtr<nsIDOMWindow> domWindow = GetWindow(); + nsCOMPtr<nsPIDOMWindowOuter> domWindow = GetWindow(); nsresult rv = commandUpdater->Init(domWindow); if (NS_SUCCEEDED(rv)) { mCommandManager = do_QueryInterface(commandUpdater); } } return mCommandManager ? NS_OK : NS_ERROR_FAILURE; } @@ -13579,20 +13579,20 @@ nsDocShell::OnLinkClickSync(nsIContent* // referer, since the current URI in this docshell may be a // new document that we're in the process of loading. nsCOMPtr<nsIDocument> refererDoc = aContent->OwnerDoc(); NS_ENSURE_TRUE(refererDoc, NS_ERROR_UNEXPECTED); // Now check that the refererDoc's inner window is the current inner // window for mScriptGlobal. If it's not, then we don't want to // follow this link. - nsPIDOMWindow* refererInner = refererDoc->GetInnerWindow(); + nsPIDOMWindowInner* refererInner = refererDoc->GetInnerWindow(); NS_ENSURE_TRUE(refererInner, NS_ERROR_UNEXPECTED); if (!mScriptGlobal || - mScriptGlobal->GetCurrentInnerWindow() != refererInner) { + mScriptGlobal->AsOuter()->GetCurrentInnerWindow() != refererInner) { // We're no longer the current inner window return NS_OK; } nsCOMPtr<nsIURI> referer = refererDoc->GetDocumentURI(); uint32_t refererPolicy = refererDoc->GetReferrerPolicy(); // get referrer attribute from clicked link and parse it
--- a/docshell/base/nsDocShell.h +++ b/docshell/base/nsDocShell.h @@ -215,18 +215,18 @@ public: NS_IMETHOD OnLeaveLink() override; nsDocShellInfoLoadType ConvertLoadTypeToDocShellLoadInfo(uint32_t aLoadType); uint32_t ConvertDocShellLoadInfoToLoadType( nsDocShellInfoLoadType aDocShellLoadType); // Don't use NS_DECL_NSILOADCONTEXT because some of nsILoadContext's methods // are shared with nsIDocShell (appID, etc.) and can't be declared twice. - NS_IMETHOD GetAssociatedWindow(nsIDOMWindow**) override; - NS_IMETHOD GetTopWindow(nsIDOMWindow**) override; + NS_IMETHOD GetAssociatedWindow(mozIDOMWindowProxy**) override; + NS_IMETHOD GetTopWindow(mozIDOMWindowProxy**) override; NS_IMETHOD GetTopFrameElement(nsIDOMElement**) override; NS_IMETHOD GetNestedFrameId(uint64_t*) override; NS_IMETHOD IsAppOfType(uint32_t, bool*) override; NS_IMETHOD GetIsContent(bool*) override; NS_IMETHOD GetUsePrivateBrowsing(bool*) override; NS_IMETHOD SetUsePrivateBrowsing(bool) override; NS_IMETHOD SetPrivateBrowsing(bool) override; NS_IMETHOD GetUseRemoteTabs(bool*) override;
--- a/docshell/base/nsDocShellEditorData.cpp +++ b/docshell/base/nsDocShellEditorData.cpp @@ -71,17 +71,17 @@ nsresult nsDocShellEditorData::CreateEditor() { nsCOMPtr<nsIEditingSession> editingSession; nsresult rv = GetEditingSession(getter_AddRefs(editingSession)); if (NS_FAILED(rv)) { return rv; } - nsCOMPtr<nsIDOMWindow> domWindow = + nsCOMPtr<nsPIDOMWindowOuter> domWindow = mDocShell ? mDocShell->GetWindow() : nullptr; rv = editingSession->SetupEditorOnWindow(domWindow); if (NS_FAILED(rv)) { return rv; } return NS_OK; } @@ -144,51 +144,49 @@ nsDocShellEditorData::EnsureEditingSessi } nsresult nsDocShellEditorData::DetachFromWindow() { NS_ASSERTION(mEditingSession, "Can't detach when we don't have a session to detach!"); - nsCOMPtr<nsIDOMWindow> domWindow = + nsCOMPtr<nsPIDOMWindowOuter> domWindow = mDocShell ? mDocShell->GetWindow() : nullptr; nsresult rv = mEditingSession->DetachFromWindow(domWindow); NS_ENSURE_SUCCESS(rv, rv); mIsDetached = true; mDetachedMakeEditable = mMakeEditable; mMakeEditable = false; - nsCOMPtr<nsPIDOMWindow> window = do_QueryInterface(domWindow); - nsCOMPtr<nsIDocument> doc = window->GetDoc(); + nsCOMPtr<nsIDocument> doc = domWindow->GetDoc(); nsCOMPtr<nsIHTMLDocument> htmlDoc = do_QueryInterface(doc); if (htmlDoc) { mDetachedEditingState = htmlDoc->GetEditingState(); } mDocShell = nullptr; return NS_OK; } nsresult nsDocShellEditorData::ReattachToWindow(nsIDocShell* aDocShell) { mDocShell = aDocShell; - nsCOMPtr<nsIDOMWindow> domWindow = + nsCOMPtr<nsPIDOMWindowOuter> domWindow = mDocShell ? mDocShell->GetWindow() : nullptr; nsresult rv = mEditingSession->ReattachToWindow(domWindow); NS_ENSURE_SUCCESS(rv, rv); mIsDetached = false; mMakeEditable = mDetachedMakeEditable; - nsCOMPtr<nsPIDOMWindow> window = do_QueryInterface(domWindow); - nsCOMPtr<nsIDocument> doc = window->GetDoc(); + nsCOMPtr<nsIDocument> doc = domWindow->GetDoc(); nsCOMPtr<nsIHTMLDocument> htmlDoc = do_QueryInterface(doc); if (htmlDoc) { htmlDoc->SetEditingState(mDetachedEditingState); } return NS_OK; }
--- a/docshell/base/nsIDocShell.idl +++ b/docshell/base/nsIDocShell.idl @@ -38,17 +38,17 @@ interface nsIPrincipal; interface nsIWebBrowserPrint; interface nsIPrivacyTransitionObserver; interface nsIReflowObserver; interface nsIScrollObserver; interface nsITabParent; typedef unsigned long nsLoadFlags; -[scriptable, builtinclass, uuid(98358234-3936-4b95-b051-fcda4e55b52d)] +[scriptable, builtinclass, uuid(049234fe-da10-478b-bc5d-bc6f9a1ba63d)] interface nsIDocShell : nsIDocShellTreeItem { /** * Loads a given URI. This will give priority to loading the requested URI * in the object implementing this interface. If it can't be loaded here * however, the URL dispatcher will go through its normal process of content * loading. *
--- a/docshell/base/nsIDocShellTreeItem.idl +++ b/docshell/base/nsIDocShellTreeItem.idl @@ -3,26 +3,26 @@ * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "nsISupports.idl" interface nsIDocShellTreeOwner; interface nsIDocument; -interface nsPIDOMWindow; +interface nsPIDOMWindowOuter; /** * The nsIDocShellTreeItem supplies the methods that are required of any item * that wishes to be able to live within the docshell tree either as a middle * node or a leaf. */ -[scriptable, uuid(edb99640-8378-4106-8673-e701a086eb1c)] +[scriptable, uuid(9b7c586f-9214-480c-a2c4-49b526fff1a6)] interface nsIDocShellTreeItem : nsISupports { /* name of the DocShellTreeItem */ attribute AString name; /** @@ -174,11 +174,11 @@ interface nsIDocShellTreeItem : nsISuppo */ nsIDocShellTreeItem findChildWithName(in wstring aName, in boolean aRecurse, in boolean aSameType, in nsIDocShellTreeItem aRequestor, in nsIDocShellTreeItem aOriginalRequestor); [noscript,nostdcall,notxpcom] nsIDocument getDocument(); - [noscript,nostdcall,notxpcom] nsPIDOMWindow getWindow(); + [noscript,nostdcall,notxpcom] nsPIDOMWindowOuter getWindow(); };
--- a/docshell/base/nsILoadContext.idl +++ b/docshell/base/nsILoadContext.idl @@ -1,49 +1,49 @@ /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- * vim: ft=cpp tw=78 sw=2 et ts=2 sts=2 cin * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "nsISupports.idl" -interface nsIDOMWindow; +interface mozIDOMWindowProxy; interface nsIDOMElement; %{C++ #ifdef MOZILLA_INTERNAL_API #include "mozilla/BasePrincipal.h" // for DocShellOriginAttributes #endif %} /** * An nsILoadContext represents the context of a load. This interface * can be queried for various information about where the load is * happening. */ -[scriptable, uuid(c71ef717-8fb9-425e-98ef-aef5894890f8)] +[scriptable, uuid(2813a7a3-d084-4d00-acd0-f76620315c02)] interface nsILoadContext : nsISupports { /** * associatedWindow is the window with which the load is associated, if any. * Note that the load may be triggered by a document which is different from * the document in associatedWindow, and in fact the source of the load need * not be same-origin with the document in associatedWindow. This attribute * may be null if there is no associated window. */ - readonly attribute nsIDOMWindow associatedWindow; + readonly attribute mozIDOMWindowProxy associatedWindow; /** * topWindow is the top window which is of same type as associatedWindow. * This is equivalent to associatedWindow.top, but is provided here as a * convenience. All the same caveats as associatedWindow of apply, of * course. This attribute may be null if there is no associated window. */ - readonly attribute nsIDOMWindow topWindow; + readonly attribute mozIDOMWindowProxy topWindow; /** * topFrameElement is the <iframe>, <frame>, or <browser> element which * contains the topWindow with which the load is associated. * * Note that we may have a topFrameElement even when we don't have an * associatedWindow, if the topFrameElement's content lives out of process. * topFrameElement is available in single-process and multiprocess contexts.
--- a/dom/activities/Activity.cpp +++ b/dom/activities/Activity.cpp @@ -29,17 +29,17 @@ NS_IMPL_CYCLE_COLLECTION_TRACE_END /* virtual */ JSObject* Activity::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) { return MozActivityBinding::Wrap(aCx, this, aGivenProto); } nsresult -Activity::Initialize(nsPIDOMWindow* aWindow, +Activity::Initialize(nsPIDOMWindowInner* aWindow, JSContext* aCx, const ActivityOptions& aOptions) { MOZ_ASSERT(aWindow); nsCOMPtr<nsIDocument> document = aWindow->GetExtantDoc(); bool isActive; @@ -92,13 +92,13 @@ Activity::Initialize(nsPIDOMWindow* aWin Activity::~Activity() { if (mProxy) { mProxy->Cleanup(); } } -Activity::Activity(nsPIDOMWindow* aWindow) +Activity::Activity(nsPIDOMWindowInner* aWindow) : DOMRequest(aWindow) { }
--- a/dom/activities/Activity.h +++ b/dom/activities/Activity.h @@ -25,31 +25,31 @@ public: virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override; static already_AddRefed<Activity> Constructor(const GlobalObject& aOwner, const ActivityOptions& aOptions, ErrorResult& aRv) { - nsCOMPtr<nsPIDOMWindow> window = do_QueryInterface(aOwner.GetAsSupports()); + nsCOMPtr<nsPIDOMWindowInner> window = do_QueryInterface(aOwner.GetAsSupports()); if (!window) { aRv.Throw(NS_ERROR_UNEXPECTED); return nullptr; } RefPtr<Activity> activity = new Activity(window); aRv = activity->Initialize(window, aOwner.Context(), aOptions); return activity.forget(); } - explicit Activity(nsPIDOMWindow* aWindow); + explicit Activity(nsPIDOMWindowInner* aWindow); protected: - nsresult Initialize(nsPIDOMWindow* aWindow, + nsresult Initialize(nsPIDOMWindowInner* aWindow, JSContext* aCx, const ActivityOptions& aOptions); nsCOMPtr<nsIActivityProxy> mProxy; ~Activity(); };
--- a/dom/activities/interfaces/nsIActivityProxy.idl +++ b/dom/activities/interfaces/nsIActivityProxy.idl @@ -1,20 +1,20 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this file, * You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "nsISupports.idl" -interface nsIDOMWindow; +interface mozIDOMWindow; /** * Implemented by @mozilla.org/dom/activities/proxy;1 */ -[scriptable, uuid(e04c0bbc-ab7d-41ba-b801-1068dd58660b)] +[scriptable, uuid(87653623-d864-4b03-8874-96808b8cdb81)] interface nsIActivityProxy : nsISupports { void startActivity(in nsISupports /* MozActivity */ activity, in jsval options, - in nsIDOMWindow window, + in mozIDOMWindow window, in unsigned long long childID); void cleanup(); };
--- a/dom/archivereader/ArchiveReader.cpp +++ b/dom/archivereader/ArchiveReader.cpp @@ -23,17 +23,17 @@ using namespace mozilla::dom; USING_ARCHIVEREADER_NAMESPACE /* static */ already_AddRefed<ArchiveReader> ArchiveReader::Constructor(const GlobalObject& aGlobal, Blob& aBlob, const ArchiveReaderOptions& aOptions, ErrorResult& aError) { - nsCOMPtr<nsPIDOMWindow> window = do_QueryInterface(aGlobal.GetAsSupports()); + nsCOMPtr<nsPIDOMWindowInner> window = do_QueryInterface(aGlobal.GetAsSupports()); if (!window) { aError.Throw(NS_ERROR_UNEXPECTED); return nullptr; } nsAutoCString encoding; if (!EncodingUtils::FindEncodingForLabelNoReplacement(aOptions.mEncoding, encoding)) { @@ -41,17 +41,17 @@ ArchiveReader::Constructor(const GlobalO return nullptr; } RefPtr<ArchiveReader> reader = new ArchiveReader(aBlob, window, encoding); return reader.forget(); } -ArchiveReader::ArchiveReader(Blob& aBlob, nsPIDOMWindow* aWindow, +ArchiveReader::ArchiveReader(Blob& aBlob, nsPIDOMWindowInner* aWindow, const nsACString& aEncoding) : mBlobImpl(aBlob.Impl()) , mWindow(aWindow) , mStatus(NOT_STARTED) , mEncoding(aEncoding) { MOZ_ASSERT(aWindow); }
--- a/dom/archivereader/ArchiveReader.h +++ b/dom/archivereader/ArchiveReader.h @@ -38,20 +38,20 @@ class ArchiveReader final : public nsISu public: NS_DECL_CYCLE_COLLECTING_ISUPPORTS NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(ArchiveReader) static already_AddRefed<ArchiveReader> Constructor(const GlobalObject& aGlobal, Blob& aBlob, const ArchiveReaderOptions& aOptions, ErrorResult& aError); - ArchiveReader(Blob& aBlob, nsPIDOMWindow* aWindow, + ArchiveReader(Blob& aBlob, nsPIDOMWindowInner* aWindow, const nsACString& aEncoding); - nsIDOMWindow* GetParentObject() const + nsPIDOMWindowInner* GetParentObject() const { return mWindow; } virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override; already_AddRefed<ArchiveRequest> GetFilenames(); already_AddRefed<ArchiveRequest> GetFile(const nsAString& filename); @@ -80,17 +80,17 @@ private: void RequestReady(ArchiveRequest* aRequest); protected: // The archive blob/file RefPtr<BlobImpl> mBlobImpl; // The window is needed by the requests - nsCOMPtr<nsPIDOMWindow> mWindow; + nsCOMPtr<nsPIDOMWindowInner> mWindow; // Are we ready to return data? enum { NOT_STARTED = 0, WORKING, READY } mStatus;
--- a/dom/archivereader/ArchiveRequest.cpp +++ b/dom/archivereader/ArchiveRequest.cpp @@ -44,17 +44,17 @@ ArchiveRequestEvent::Run() { MOZ_ASSERT(mRequest, "the request is not longer valid"); mRequest->Run(); return NS_OK; } // ArchiveRequest -ArchiveRequest::ArchiveRequest(nsPIDOMWindow* aWindow, +ArchiveRequest::ArchiveRequest(nsPIDOMWindowInner* aWindow, ArchiveReader* aReader) : DOMRequest(aWindow), mArchiveReader(aReader) { MOZ_ASSERT(aReader); MOZ_COUNT_CTOR(ArchiveRequest); @@ -252,17 +252,17 @@ ArchiveRequest::GetFilesResult(JSContext } aValue.setObject(*array); return NS_OK; } // static already_AddRefed<ArchiveRequest> -ArchiveRequest::Create(nsPIDOMWindow* aOwner, +ArchiveRequest::Create(nsPIDOMWindowInner* aOwner, ArchiveReader* aReader) { NS_ASSERTION(NS_IsMainThread(), "Wrong thread!"); RefPtr<ArchiveRequest> request = new ArchiveRequest(aOwner, aReader); return request.forget(); }
--- a/dom/archivereader/ArchiveRequest.h +++ b/dom/archivereader/ArchiveRequest.h @@ -29,17 +29,17 @@ public: virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override; ArchiveReader* Reader() const; NS_DECL_ISUPPORTS_INHERITED NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(ArchiveRequest, DOMRequest) - ArchiveRequest(nsPIDOMWindow* aWindow, + ArchiveRequest(nsPIDOMWindowInner* aWindow, ArchiveReader* aReader); // nsIDOMEventTarget virtual nsresult PreHandleEvent(EventChainPreVisitor& aVisitor) override; public: // This is called by the DOMArchiveRequestEvent void Run(); @@ -47,17 +47,17 @@ public: // Set the types for this request void OpGetFilenames(); void OpGetFile(const nsAString& aFilename); void OpGetFiles(); nsresult ReaderReady(nsTArray<RefPtr<File>>& aFileList, nsresult aStatus); public: // static - static already_AddRefed<ArchiveRequest> Create(nsPIDOMWindow* aOwner, + static already_AddRefed<ArchiveRequest> Create(nsPIDOMWindowInner* aOwner, ArchiveReader* aReader); private: ~ArchiveRequest(); nsresult GetFilenamesResult(JSContext* aCx, JS::Value* aValue, nsTArray<RefPtr<File>>& aFileList);
--- a/dom/audiochannel/AudioChannelAgent.cpp +++ b/dom/audiochannel/AudioChannelAgent.cpp @@ -59,66 +59,60 @@ AudioChannelAgent::Shutdown() NS_IMETHODIMP AudioChannelAgent::GetAudioChannelType(int32_t *aAudioChannelType) { *aAudioChannelType = mAudioChannelType; return NS_OK; } NS_IMETHODIMP -AudioChannelAgent::Init(nsIDOMWindow* aWindow, int32_t aChannelType, +AudioChannelAgent::Init(mozIDOMWindow* aWindow, int32_t aChannelType, nsIAudioChannelAgentCallback *aCallback) { - return InitInternal(aWindow, aChannelType, aCallback, - /* useWeakRef = */ false); + return InitInternal(nsPIDOMWindowInner::From(aWindow), aChannelType, + aCallback, /* useWeakRef = */ false); } NS_IMETHODIMP -AudioChannelAgent::InitWithWeakCallback(nsIDOMWindow* aWindow, +AudioChannelAgent::InitWithWeakCallback(mozIDOMWindow* aWindow, int32_t aChannelType, nsIAudioChannelAgentCallback *aCallback) { - return InitInternal(aWindow, aChannelType, aCallback, - /* useWeakRef = */ true); + return InitInternal(nsPIDOMWindowInner::From(aWindow), aChannelType, + aCallback, /* useWeakRef = */ true); } nsresult -AudioChannelAgent::FindCorrectWindow(nsIDOMWindow* aWindow) +AudioChannelAgent::FindCorrectWindow(nsPIDOMWindowInner* aWindow) { - nsCOMPtr<nsPIDOMWindow> window = do_QueryInterface(aWindow); - MOZ_ASSERT(window->IsInnerWindow()); + MOZ_ASSERT(aWindow->IsInnerWindow()); - mWindow = window->GetScriptableTop(); + mWindow = aWindow->GetScriptableTop(); if (NS_WARN_IF(!mWindow)) { return NS_OK; } - mWindow = mWindow->GetOuterWindow(); - if (NS_WARN_IF(!mWindow)) { - return NS_ERROR_FAILURE; - } - // From here we do an hack for nested iframes. // The system app doesn't have access to the nested iframe objects so it // cannot control the volume of the agents running in nested apps. What we do // here is to assign those Agents to the top scriptable window of the parent // iframe (what is controlled by the system app). // For doing this we go recursively back into the chain of windows until we // find apps that are not the system one. - window = mWindow->GetParent(); - if (!window || window == mWindow) { + nsCOMPtr<nsPIDOMWindowOuter> outerParent = mWindow->GetParent(); + if (!outerParent || outerParent == mWindow) { return NS_OK; } - window = window->GetCurrentInnerWindow(); - if (!window) { + nsCOMPtr<nsPIDOMWindowInner> parent = outerParent->GetCurrentInnerWindow(); + if (!parent) { return NS_OK; } - nsCOMPtr<nsIDocument> doc = window->GetExtantDoc(); + nsCOMPtr<nsIDocument> doc = parent->GetExtantDoc(); if (!doc) { return NS_OK; } nsCOMPtr<nsIPrincipal> principal = doc->NodePrincipal(); uint32_t appId; nsresult rv = principal->GetAppId(&appId); @@ -147,21 +141,22 @@ AudioChannelAgent::FindCorrectWindow(nsI if (NS_WARN_IF(NS_FAILED(rv))) { return rv; } if (systemAppId == appId) { return NS_OK; } - return FindCorrectWindow(window); + return FindCorrectWindow(parent); } nsresult -AudioChannelAgent::InitInternal(nsIDOMWindow* aWindow, int32_t aChannelType, +AudioChannelAgent::InitInternal(nsPIDOMWindowInner* aWindow, + int32_t aChannelType, nsIAudioChannelAgentCallback *aCallback, bool aUseWeakRef) { // We syncd the enum of channel type between nsIAudioChannelAgent.idl and // AudioChannelBinding.h the same. MOZ_ASSERT(int(AUDIO_AGENT_CHANNEL_NORMAL) == int(AudioChannel::Normal) && int(AUDIO_AGENT_CHANNEL_CONTENT) == int(AudioChannel::Content) && int(AUDIO_AGENT_CHANNEL_NOTIFICATION) == int(AudioChannel::Notification) && @@ -177,19 +172,18 @@ AudioChannelAgent::InitInternal(nsIDOMWi aChannelType < AUDIO_AGENT_CHANNEL_NORMAL) { return NS_ERROR_FAILURE; } if (NS_WARN_IF(!aWindow)) { return NS_OK; } - nsCOMPtr<nsPIDOMWindow> pInnerWindow = do_QueryInterface(aWindow); - MOZ_ASSERT(pInnerWindow->IsInnerWindow()); - mInnerWindowID = pInnerWindow->WindowID(); + MOZ_ASSERT(aWindow->IsInnerWindow()); + mInnerWindowID = aWindow->WindowID(); nsresult rv = FindCorrectWindow(aWindow); if (NS_WARN_IF(NS_FAILED(rv))) { return rv; } mAudioChannelType = aChannelType;
--- a/dom/audiochannel/AudioChannelAgent.h +++ b/dom/audiochannel/AudioChannelAgent.h @@ -12,17 +12,18 @@ #include "nsCOMPtr.h" #include "nsWeakPtr.h" #define NS_AUDIOCHANNELAGENT_CONTRACTID "@mozilla.org/audiochannelagent;1" // f27688e2-3dd7-11e2-904e-10bf48d64bd4 #define NS_AUDIOCHANNELAGENT_CID {0xf27688e2, 0x3dd7, 0x11e2, \ {0x90, 0x4e, 0x10, 0xbf, 0x48, 0xd6, 0x4b, 0xd4}} -class nsPIDOMWindow; +class nsPIDOMWindowInner; +class nsPIDOMWindowOuter; namespace mozilla { namespace dom { /* Header file */ class AudioChannelAgent : public nsIAudioChannelAgent { public: @@ -31,40 +32,40 @@ public: NS_DECL_CYCLE_COLLECTION_CLASS(AudioChannelAgent) AudioChannelAgent(); void WindowVolumeChanged(); void WindowAudioCaptureChanged(uint64_t aInnerWindowID, bool aCapture); - nsPIDOMWindow* Window() const + nsPIDOMWindowOuter* Window() const { return mWindow; } uint64_t WindowID() const; uint64_t InnerWindowID() const; private: virtual ~AudioChannelAgent(); // Returns mCallback if that's non-null, or otherwise tries to get an // nsIAudioChannelAgentCallback out of mWeakCallback. already_AddRefed<nsIAudioChannelAgentCallback> GetCallback(); - nsresult InitInternal(nsIDOMWindow* aWindow, int32_t aAudioAgentType, + nsresult InitInternal(nsPIDOMWindowInner* aWindow, int32_t aAudioAgentType, nsIAudioChannelAgentCallback* aCallback, bool aUseWeakRef); void Shutdown(); - nsresult FindCorrectWindow(nsIDOMWindow* aWindow); + nsresult FindCorrectWindow(nsPIDOMWindowInner* aWindow); - nsCOMPtr<nsPIDOMWindow> mWindow; + nsCOMPtr<nsPIDOMWindowOuter> mWindow; nsCOMPtr<nsIAudioChannelAgentCallback> mCallback; nsWeakPtr mWeakCallback; int32_t mAudioChannelType; uint64_t mInnerWindowID; bool mIsRegToService; };
--- a/dom/audiochannel/AudioChannelService.cpp +++ b/dom/audiochannel/AudioChannelService.cpp @@ -98,39 +98,26 @@ void NotifyChannelActive(uint64_t aWindowID, AudioChannel aAudioChannel, bool aActive) { RefPtr<nsRunnable> runnable = new NotifyChannelActiveRunnable(aWindowID, aAudioChannel, aActive); NS_DispatchToCurrentThread(runnable); } -already_AddRefed<nsPIDOMWindow> -GetTopWindow(nsPIDOMWindow* aWindow) -{ - MOZ_ASSERT(aWindow); - - nsCOMPtr<nsPIDOMWindow> topWindow = aWindow->GetScriptableTop(); - MOZ_ASSERT(topWindow); - - topWindow = topWindow->GetOuterWindow(); - - return topWindow.forget(); -} - bool IsParentProcess() { return XRE_GetProcessType() == GeckoProcessType_Default; } class MediaPlaybackRunnable : public nsRunnable { public: - MediaPlaybackRunnable(nsIDOMWindow* aWindow, bool aActive) + MediaPlaybackRunnable(nsPIDOMWindowOuter* aWindow, bool aActive) : mWindow(aWindow) , mActive(aActive) {} NS_IMETHOD Run() { nsCOMPtr<nsIObserverService> observerService = services::GetObserverService(); @@ -141,17 +128,17 @@ public: mActive ? MOZ_UTF16("active") : MOZ_UTF16("inactive")); } return NS_OK; } private: - nsCOMPtr<nsIDOMWindow> mWindow; + nsCOMPtr<nsPIDOMWindowOuter> mWindow; bool mActive; }; } // anonymous namespace StaticRefPtr<AudioChannelService> gAudioChannelService; // Mappings from 'mozaudiochannel' attribute strings to an enumeration. @@ -362,17 +349,17 @@ AudioChannelService::RegisterTabParent(T void AudioChannelService::UnregisterTabParent(TabParent* aTabParent) { MOZ_ASSERT(aTabParent); mTabParents.RemoveElement(aTabParent); } void -AudioChannelService::GetState(nsPIDOMWindow* aWindow, uint32_t aAudioChannel, +AudioChannelService::GetState(nsPIDOMWindowOuter* aWindow, uint32_t aAudioChannel, float* aVolume, bool* aMuted) { MOZ_ASSERT(!aWindow || aWindow->IsOuterWindow()); MOZ_ASSERT(aVolume && aMuted); MOZ_ASSERT(aAudioChannel < NUMBER_OF_AUDIO_CHANNELS); if (!aWindow || !aWindow->IsOuterWindow()) { @@ -380,31 +367,31 @@ AudioChannelService::GetState(nsPIDOMWin *aMuted = true; return; } *aVolume = 1.0; *aMuted = false; AudioChannelWindow* winData = nullptr; - nsCOMPtr<nsPIDOMWindow> window = aWindow; + nsCOMPtr<nsPIDOMWindowOuter> window = aWindow; // The volume must be calculated based on the window hierarchy. Here we go up // to the top window and we calculate the volume and the muted flag. do { winData = GetWindowData(window->WindowID()); if (winData) { *aVolume *= winData->mChannels[aAudioChannel].mVolume; *aMuted = *aMuted || winData->mChannels[aAudioChannel].mMuted; } *aVolume *= window->GetAudioVolume(); *aMuted = *aMuted || window->GetAudioMuted(); - nsCOMPtr<nsPIDOMWindow> win = window->GetScriptableParent(); + nsCOMPtr<nsPIDOMWindowOuter> win = window->GetScriptableParent(); if (window == win) { break; } window = do_QueryInterface(win); // If there is no parent, or we are the toplevel we don't continue. } while (window && window != aWindow); @@ -582,22 +569,22 @@ AudioChannelService::Observe(nsISupports RemoveChildStatus(childID); } return NS_OK; } void AudioChannelService::RefreshAgentsVolumeAndPropagate(AudioChannel aAudioChannel, - nsPIDOMWindow* aWindow) + nsPIDOMWindowOuter* aWindow) { MOZ_ASSERT(aWindow); MOZ_ASSERT(aWindow->IsOuterWindow()); - nsCOMPtr<nsPIDOMWindow> topWindow = aWindow->GetScriptableTop(); + nsCOMPtr<nsPIDOMWindowOuter> topWindow = aWindow->GetScriptableTop(); if (!topWindow) { return; } AudioChannelWindow* winData = GetWindowData(topWindow->WindowID()); if (!winData) { return; } @@ -607,22 +594,22 @@ AudioChannelService::RefreshAgentsVolume winData->mChannels[(uint32_t)aAudioChannel].mVolume, winData->mChannels[(uint32_t)aAudioChannel].mMuted); } RefreshAgentsVolume(aWindow); } void -AudioChannelService::RefreshAgentsVolume(nsPIDOMWindow* aWindow) +AudioChannelService::RefreshAgentsVolume(nsPIDOMWindowOuter* aWindow) { MOZ_ASSERT(aWindow); MOZ_ASSERT(aWindow->IsOuterWindow()); - nsCOMPtr<nsPIDOMWindow> topWindow = aWindow->GetScriptableTop(); + nsCOMPtr<nsPIDOMWindowOuter> topWindow = aWindow->GetScriptableTop(); if (!topWindow) { return; } AudioChannelWindow* winData = GetWindowData(topWindow->WindowID()); if (!winData) { return; } @@ -630,29 +617,29 @@ AudioChannelService::RefreshAgentsVolume nsTObserverArray<AudioChannelAgent*>::ForwardIterator iter(winData->mAgents); while (iter.HasMore()) { iter.GetNext()->WindowVolumeChanged(); } } void -AudioChannelService::SetWindowAudioCaptured(nsPIDOMWindow* aWindow, +AudioChannelService::SetWindowAudioCaptured(nsPIDOMWindowOuter* aWindow, uint64_t aInnerWindowID, bool aCapture) { MOZ_ASSERT(NS_IsMainThread()); MOZ_ASSERT(aWindow); MOZ_ASSERT(aWindow->IsOuterWindow()); MOZ_LOG(GetAudioChannelLog(), LogLevel::Debug, ("AudioChannelService, SetWindowAudioCaptured, window = %p, " "aCapture = %d\n", aWindow, aCapture)); - nsCOMPtr<nsPIDOMWindow> topWindow = aWindow->GetScriptableTop(); + nsCOMPtr<nsPIDOMWindowOuter> topWindow = aWindow->GetScriptableTop(); if (!topWindow) { return; } AudioChannelWindow* winData = GetWindowData(topWindow->WindowID()); // This can happen, but only during shutdown, because the the outer window // changes ScriptableTop, so that its ID is different. @@ -735,17 +722,17 @@ AudioChannelService::GetDefaultAudioChan aString = audioChannel; break; } } } } AudioChannelService::AudioChannelWindow* -AudioChannelService::GetOrCreateWindowData(nsPIDOMWindow* aWindow) +AudioChannelService::GetOrCreateWindowData(nsPIDOMWindowOuter* aWindow) { MOZ_ASSERT(NS_IsMainThread()); MOZ_ASSERT(aWindow); MOZ_ASSERT(aWindow->IsOuterWindow()); AudioChannelWindow* winData = GetWindowData(aWindow->WindowID()); if (!winData) { winData = new AudioChannelWindow(aWindow->WindowID()); @@ -766,43 +753,41 @@ AudioChannelService::GetWindowData(uint6 return next; } } return nullptr; } float -AudioChannelService::GetAudioChannelVolume(nsPIDOMWindow* aWindow, +AudioChannelService::GetAudioChannelVolume(nsPIDOMWindowOuter* aWindow, AudioChannel aAudioChannel) { MOZ_ASSERT(NS_IsMainThread()); MOZ_ASSERT(aWindow); MOZ_ASSERT(aWindow->IsOuterWindow()); AudioChannelWindow* winData = GetOrCreateWindowData(aWindow); return winData->mChannels[(uint32_t)aAudioChannel].mVolume; } NS_IMETHODIMP -AudioChannelService::GetAudioChannelVolume(nsIDOMWindow* aWindow, +AudioChannelService::GetAudioChannelVolume(mozIDOMWindowProxy* aWindow, unsigned short aAudioChannel, float* aVolume) { MOZ_ASSERT(NS_IsMainThread()); - nsCOMPtr<nsPIDOMWindow> piWindow = do_QueryInterface(aWindow); - nsCOMPtr<nsPIDOMWindow> window = GetTopWindow(piWindow); - MOZ_ASSERT(window->IsOuterWindow()); + auto* window = nsPIDOMWindowOuter::From(aWindow)->GetScriptableTop(); *aVolume = GetAudioChannelVolume(window, (AudioChannel)aAudioChannel); return NS_OK; } void -AudioChannelService::SetAudioChannelVolume(nsPIDOMWindow* aWindow, +AudioChannelService::SetAudioChannelVolume(nsPIDOMWindowOuter* aWindow, AudioChannel aAudioChannel, float aVolume) { MOZ_ASSERT(NS_IsMainThread()); MOZ_ASSERT(aWindow); MOZ_ASSERT(aWindow->IsOuterWindow()); MOZ_LOG(GetAudioChannelLog(), LogLevel::Debug, @@ -810,57 +795,53 @@ AudioChannelService::SetAudioChannelVolu "volume = %f\n", aWindow, aAudioChannel, aVolume)); AudioChannelWindow* winData = GetOrCreateWindowData(aWindow); winData->mChannels[(uint32_t)aAudioChannel].mVolume = aVolume; RefreshAgentsVolumeAndPropagate(aAudioChannel, aWindow); } NS_IMETHODIMP -AudioChannelService::SetAudioChannelVolume(nsIDOMWindow* aWindow, +AudioChannelService::SetAudioChannelVolume(mozIDOMWindowProxy* aWindow, unsigned short aAudioChannel, float aVolume) { MOZ_ASSERT(NS_IsMainThread()); - nsCOMPtr<nsPIDOMWindow> piWindow = do_QueryInterface(aWindow); - nsCOMPtr<nsPIDOMWindow> window = GetTopWindow(piWindow); - MOZ_ASSERT(window->IsOuterWindow()); + auto* window = nsPIDOMWindowOuter::From(aWindow)->GetScriptableTop(); SetAudioChannelVolume(window, (AudioChannel)aAudioChannel, aVolume); return NS_OK; } bool -AudioChannelService::GetAudioChannelMuted(nsPIDOMWindow* aWindow, +AudioChannelService::GetAudioChannelMuted(nsPIDOMWindowOuter* aWindow, AudioChannel aAudioChannel) { MOZ_ASSERT(NS_IsMainThread()); MOZ_ASSERT(aWindow); MOZ_ASSERT(aWindow->IsOuterWindow()); AudioChannelWindow* winData = GetOrCreateWindowData(aWindow); return winData->mChannels[(uint32_t)aAudioChannel].mMuted; } NS_IMETHODIMP -AudioChannelService::GetAudioChannelMuted(nsIDOMWindow* aWindow, +AudioChannelService::GetAudioChannelMuted(mozIDOMWindowProxy* aWindow, unsigned short aAudioChannel, bool* aMuted) { MOZ_ASSERT(NS_IsMainThread()); - nsCOMPtr<nsPIDOMWindow> piWindow = do_QueryInterface(aWindow); - nsCOMPtr<nsPIDOMWindow> window = GetTopWindow(piWindow); - MOZ_ASSERT(window->IsOuterWindow()); + auto* window = nsPIDOMWindowOuter::From(aWindow)->GetScriptableTop(); *aMuted = GetAudioChannelMuted(window, (AudioChannel)aAudioChannel); return NS_OK; } void -AudioChannelService::SetAudioChannelMuted(nsPIDOMWindow* aWindow, +AudioChannelService::SetAudioChannelMuted(nsPIDOMWindowOuter* aWindow, AudioChannel aAudioChannel, bool aMuted) { MOZ_ASSERT(NS_IsMainThread()); MOZ_ASSERT(aWindow); MOZ_ASSERT(aWindow->IsOuterWindow()); MOZ_LOG(GetAudioChannelLog(), LogLevel::Debug, @@ -873,51 +854,47 @@ AudioChannelService::SetAudioChannelMute } AudioChannelWindow* winData = GetOrCreateWindowData(aWindow); winData->mChannels[(uint32_t)aAudioChannel].mMuted = aMuted; RefreshAgentsVolumeAndPropagate(aAudioChannel, aWindow); } NS_IMETHODIMP -AudioChannelService::SetAudioChannelMuted(nsIDOMWindow* aWindow, +AudioChannelService::SetAudioChannelMuted(mozIDOMWindowProxy* aWindow, unsigned short aAudioChannel, bool aMuted) { MOZ_ASSERT(NS_IsMainThread()); - nsCOMPtr<nsPIDOMWindow> piWindow = do_QueryInterface(aWindow); - nsCOMPtr<nsPIDOMWindow> window = GetTopWindow(piWindow); - MOZ_ASSERT(window->IsOuterWindow()); + auto* window = nsPIDOMWindowOuter::From(aWindow)->GetScriptableTop(); SetAudioChannelMuted(window, (AudioChannel)aAudioChannel, aMuted); return NS_OK; } bool -AudioChannelService::IsAudioChannelActive(nsPIDOMWindow* aWindow, +AudioChannelService::IsAudioChannelActive(nsPIDOMWindowOuter* aWindow, AudioChannel aAudioChannel) { MOZ_ASSERT(NS_IsMainThread()); MOZ_ASSERT(aWindow); MOZ_ASSERT(aWindow->IsOuterWindow()); AudioChannelWindow* winData = GetOrCreateWindowData(aWindow); return !!winData->mChannels[(uint32_t)aAudioChannel].mNumberOfAgents; } NS_IMETHODIMP -AudioChannelService::IsAudioChannelActive(nsIDOMWindow* aWindow, +AudioChannelService::IsAudioChannelActive(mozIDOMWindowProxy* aWindow, unsigned short aAudioChannel, bool* aActive) { MOZ_ASSERT(NS_IsMainThread()); - nsCOMPtr<nsPIDOMWindow> piWindow = do_QueryInterface(aWindow); - nsCOMPtr<nsPIDOMWindow> window = GetTopWindow(piWindow); - MOZ_ASSERT(window->IsOuterWindow()); + auto* window = nsPIDOMWindowOuter::From(aWindow)->GetScriptableTop(); *aActive = IsAudioChannelActive(window, (AudioChannel)aAudioChannel); return NS_OK; } void AudioChannelService::SetDefaultVolumeControlChannel(int32_t aChannel, bool aVisible) { SetDefaultVolumeControlChannelInternal(aChannel, aVisible,
--- a/dom/audiochannel/AudioChannelService.h +++ b/dom/audiochannel/AudioChannelService.h @@ -13,17 +13,17 @@ #include "nsTObserverArray.h" #include "nsTArray.h" #include "AudioChannelAgent.h" #include "nsAttrValue.h" #include "mozilla/dom/AudioChannelBinding.h" class nsIRunnable; -class nsPIDOMWindow; +class nsPIDOMWindowOuter; struct PRLogModuleInfo; namespace mozilla { namespace dom { #ifdef MOZ_WIDGET_GONK class SpeakerManagerService; #endif @@ -69,31 +69,31 @@ public: */ void RegisterTabParent(TabParent* aTabParent); void UnregisterTabParent(TabParent* aTabParent); /** * Return the state to indicate this audioChannel for his window should keep * playing/muted. */ - void GetState(nsPIDOMWindow* aWindow, uint32_t aChannel, + void GetState(nsPIDOMWindowOuter* aWindow, uint32_t aChannel, float* aVolume, bool* aMuted); /* Methods for the BrowserElementAudioChannel */ - float GetAudioChannelVolume(nsPIDOMWindow* aWindow, AudioChannel aChannel); + float GetAudioChannelVolume(nsPIDOMWindowOuter* aWindow, AudioChannel aChannel); - void SetAudioChannelVolume(nsPIDOMWindow* aWindow, AudioChannel aChannel, + void SetAudioChannelVolume(nsPIDOMWindowOuter* aWindow, AudioChannel aChannel, float aVolume); - bool GetAudioChannelMuted(nsPIDOMWindow* aWindow, AudioChannel aChannel); + bool GetAudioChannelMuted(nsPIDOMWindowOuter* aWindow, AudioChannel aChannel); - void SetAudioChannelMuted(nsPIDOMWindow* aWindow, AudioChannel aChannel, + void SetAudioChannelMuted(nsPIDOMWindowOuter* aWindow, AudioChannel aChannel, bool aMuted); - bool IsAudioChannelActive(nsPIDOMWindow* aWindow, AudioChannel aChannel); + bool IsAudioChannelActive(nsPIDOMWindowOuter* aWindow, AudioChannel aChannel); /** * Return true if there is a telephony channel active in this process * or one of its subprocesses. */ bool TelephonyChannelIsActive(); /** @@ -108,30 +108,29 @@ public: * the default audio channel will be used. Otherwise aChannel is casted to * AudioChannel enum. */ virtual void SetDefaultVolumeControlChannel(int32_t aChannel, bool aVisible); bool AnyAudioChannelIsActive(); - void RefreshAgentsVolume(nsPIDOMWindow* aWindow); + void RefreshAgentsVolume(nsPIDOMWindowOuter* aWindow); void RefreshAgentsVolumeAndPropagate(AudioChannel aAudioChannel, - nsPIDOMWindow* aWindow); + nsPIDOMWindowOuter* aWindow); // This method needs to know the inner window that wants to capture audio. We // group agents per top outer window, but we can have multiple innerWindow per // top outerWindow (subiframes, etc.) and we have to identify all the agents // just for a particular innerWindow. - void SetWindowAudioCaptured(nsPIDOMWindow* aWindow, + void SetWindowAudioCaptured(nsPIDOMWindowOuter* aWindow, uint64_t aInnerWindowID, bool aCapture); - #ifdef MOZ_WIDGET_GONK void RegisterSpeakerManager(SpeakerManagerService* aSpeakerManager) { if (!mSpeakerManager.Contains(aSpeakerManager)) { mSpeakerManager.AppendElement(aSpeakerManager); } } @@ -199,17 +198,17 @@ private: bool mIsAudioCaptured; AudioChannelConfig mChannels[NUMBER_OF_AUDIO_CHANNELS]; // Raw pointer because the AudioChannelAgent must unregister itself. nsTObserverArray<AudioChannelAgent*> mAgents; }; AudioChannelWindow* - GetOrCreateWindowData(nsPIDOMWindow* aWindow); + GetOrCreateWindowData(nsPIDOMWindowOuter* aWindow); AudioChannelWindow* GetWindowData(uint64_t aWindowID) const; struct AudioChannelChildStatus final { explicit AudioChannelChildStatus(uint64_t aChildID) : mChildID(aChildID)
--- a/dom/audiochannel/nsIAudioChannelAgent.idl +++ b/dom/audiochannel/nsIAudioChannelAgent.idl @@ -1,17 +1,17 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this file, * You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "nsISupports.idl" -interface nsIDOMWindow; +interface mozIDOMWindow; -[uuid(0a451ee0-972e-11e5-a837-0800200c9a66)] +[uuid(15c05894-408e-4798-b527-a8c32d9c5f8c)] interface nsIAudioChannelAgentCallback : nsISupports { /** * Notified when the window volume/mute is changed */ void windowVolumeChanged(in float aVolume, in bool aMuted); /** @@ -75,27 +75,27 @@ interface nsIAudioChannelAgent : nsISupp * @param callback * 1. Once the playable status changes, agent uses this callback function * to notify Gecko component. * 2. The callback is allowed to be null. Ex: telephony doesn't need to * listen change of the playable status. * 3. The AudioChannelAgent keeps a strong reference to the callback * object. */ - void init(in nsIDOMWindow window, in long channelType, + void init(in mozIDOMWindow window, in long channelType, in nsIAudioChannelAgentCallback callback); /** * This method is just like init(), except the audio channel agent keeps a * weak reference to the callback object. * * In order for this to work, |callback| must implement * nsISupportsWeakReference. */ - void initWithWeakCallback(in nsIDOMWindow window, in long channelType, + void initWithWeakCallback(in mozIDOMWindow window, in long channelType, in nsIAudioChannelAgentCallback callback); /** * Notify the agent that we want to start playing. * Note: Gecko component SHOULD call this function first then start to * play audio stream only when return value is true. * * @return
--- a/dom/audiochannel/nsIAudioChannelService.idl +++ b/dom/audiochannel/nsIAudioChannelService.idl @@ -1,29 +1,29 @@ /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "nsISupports.idl" -interface nsIDOMWindow; +interface mozIDOMWindowProxy; -[scriptable, builtinclass, uuid(323e5472-b8f4-4288-b1b9-53c7c54bbbe8)] +[scriptable, builtinclass, uuid(5cb24dbc-36c7-46a4-9966-ac73141dc795)] interface nsIAudioChannelService : nsISupports { - float getAudioChannelVolume(in nsIDOMWindow window, + float getAudioChannelVolume(in mozIDOMWindowProxy window, in unsigned short audioChannel); - void setAudioChannelVolume(in nsIDOMWindow window, + void setAudioChannelVolume(in mozIDOMWindowProxy window, in unsigned short audioChannel, in float volume); - boolean getAudioChannelMuted(in nsIDOMWindow window, + boolean getAudioChannelMuted(in mozIDOMWindowProxy window, in unsigned short audioChannel); - void setAudioChannelMuted(in nsIDOMWindow window, + void setAudioChannelMuted(in mozIDOMWindowProxy window, in unsigned short audioChannel, in boolean muted); - boolean isAudioChannelActive(in nsIDOMWindow window, + boolean isAudioChannelActive(in mozIDOMWindowProxy window, in unsigned short audioChannel); };
--- a/dom/base/BarProps.cpp +++ b/dom/base/BarProps.cpp @@ -23,20 +23,20 @@ BarProp::BarProp(nsGlobalWindow* aWindow { MOZ_ASSERT(aWindow->IsInnerWindow()); } BarProp::~BarProp() { } -nsPIDOMWindow* +nsPIDOMWindowInner* BarProp::GetParentObject() const { - return mDOMWindow; + return mDOMWindow->AsInner(); } JSObject* BarProp::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) { return BarPropBinding::Wrap(aCx, this, aGivenProto); }
--- a/dom/base/BarProps.h +++ b/dom/base/BarProps.h @@ -33,17 +33,17 @@ class BarProp : public nsISupports, public nsWrapperCache { public: explicit BarProp(nsGlobalWindow *aWindow); NS_DECL_CYCLE_COLLECTING_ISUPPORTS NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(BarProp) - nsPIDOMWindow* GetParentObject() const; + nsPIDOMWindowInner* GetParentObject() const; virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override; virtual bool GetVisible(ErrorResult& aRv) = 0; virtual void SetVisible(bool aVisible, ErrorResult& aRv) = 0; protected:
--- a/dom/base/ChromeNodeList.cpp +++ b/dom/base/ChromeNodeList.cpp @@ -8,17 +8,17 @@ #include "mozilla/dom/ChromeNodeListBinding.h" using namespace mozilla; using namespace mozilla::dom; already_AddRefed<ChromeNodeList> ChromeNodeList::Constructor(const GlobalObject& aGlobal, ErrorResult& aRv) { - nsCOMPtr<nsPIDOMWindow> win = do_QueryInterface(aGlobal.GetAsSupports()); + nsCOMPtr<nsPIDOMWindowInner> win = do_QueryInterface(aGlobal.GetAsSupports()); nsIDocument* root = win ? win->GetExtantDoc() : nullptr; RefPtr<ChromeNodeList> list = new ChromeNodeList(root); return list.forget(); } JSObject* ChromeNodeList::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) {
--- a/dom/base/Comment.cpp +++ b/dom/base/Comment.cpp @@ -60,17 +60,17 @@ Comment::List(FILE* out, int32_t aIndent fputs("-->\n", out); } #endif /* static */ already_AddRefed<Comment> Comment::Constructor(const GlobalObject& aGlobal, const nsAString& aData, ErrorResult& aRv) { - nsCOMPtr<nsPIDOMWindow> window = do_QueryInterface(aGlobal.GetAsSupports()); + nsCOMPtr<nsPIDOMWindowInner> window = do_QueryInterface(aGlobal.GetAsSupports()); if (!window || !window->GetDoc()) { aRv.Throw(NS_ERROR_FAILURE); return nullptr; } return window->GetDoc()->CreateComment(aData); }
--- a/dom/base/Console.cpp +++ b/dom/base/Console.cpp @@ -243,17 +243,17 @@ private: AssertIsOnMainThread(); // Walk up to our containing page WorkerPrivate* wp = mWorkerPrivate; while (wp->GetParent()) { wp = wp->GetParent(); } - nsPIDOMWindow* window = wp->GetWindow(); + nsPIDOMWindowInner* window = wp->GetWindow(); if (!window) { RunWindowless(); } else { RunWithWindow(window); } PostDispatch(); return NS_OK; @@ -292,28 +292,28 @@ private: }; RefPtr<WorkerControlRunnable> runnable = new ConsoleReleaseRunnable(mWorkerPrivate, this); runnable->Dispatch(nullptr); } void - RunWithWindow(nsPIDOMWindow* aWindow) + RunWithWindow(nsPIDOMWindowInner* aWindow) { AutoJSAPI jsapi; MOZ_ASSERT(aWindow); - RefPtr<nsGlobalWindow> win = static_cast<nsGlobalWindow*>(aWindow); + RefPtr<nsGlobalWindow> win = nsGlobalWindow::Cast(aWindow); if (NS_WARN_IF(!jsapi.Init(win))) { return; } MOZ_ASSERT(aWindow->IsInnerWindow()); - nsPIDOMWindow* outerWindow = aWindow->GetOuterWindow(); + nsPIDOMWindowOuter* outerWindow = aWindow->GetOuterWindow(); if (NS_WARN_IF(!outerWindow)) { return; } RunConsole(jsapi.cx(), outerWindow, aWindow); } void @@ -342,18 +342,18 @@ private: RunConsole(cx, nullptr, nullptr); } protected: virtual bool PreDispatch(JSContext* aCx) = 0; virtual void - RunConsole(JSContext* aCx, nsPIDOMWindow* aOuterWindow, - nsPIDOMWindow* aInnerWindow) = 0; + RunConsole(JSContext* aCx, nsPIDOMWindowOuter* aOuterWindow, + nsPIDOMWindowInner* aInnerWindow) = 0; virtual JSObject* CustomReadHandler(JSContext* aCx, JSStructuredCloneReader* aReader, uint32_t aTag, uint32_t aIndex) override { AssertIsOnMainThread(); @@ -479,18 +479,18 @@ private: return false; } mCallData->CleanupJSObjects(); return true; } void - RunConsole(JSContext* aCx, nsPIDOMWindow* aOuterWindow, - nsPIDOMWindow* aInnerWindow) override + RunConsole(JSContext* aCx, nsPIDOMWindowOuter* aOuterWindow, + nsPIDOMWindowInner* aInnerWindow) override { MOZ_ASSERT(NS_IsMainThread()); // The windows have to run in parallel. MOZ_ASSERT(!!aOuterWindow == !!aInnerWindow); if (aOuterWindow) { mCallData->SetIDs(aOuterWindow->WindowID(), aInnerWindow->WindowID()); @@ -609,18 +609,18 @@ private: return false; } mArguments.Clear(); return true; } void - RunConsole(JSContext* aCx, nsPIDOMWindow* aOuterWindow, - nsPIDOMWindow* aInnerWindow) override + RunConsole(JSContext* aCx, nsPIDOMWindowOuter* aOuterWindow, + nsPIDOMWindowInner* aInnerWindow) override { ClearException ce(aCx); // Now we could have the correct window (if we are not window-less). mClonedData.mParent = aInnerWindow; JS::Rooted<JS::Value> argumentsValue(aCx); bool ok = Read(aCx, &argumentsValue); @@ -684,29 +684,29 @@ NS_IMPL_CYCLE_COLLECTING_RELEASE(Console NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(Console) NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY NS_INTERFACE_MAP_ENTRY(nsIObserver) NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIObserver) NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference) NS_INTERFACE_MAP_END -Console::Console(nsPIDOMWindow* aWindow) +Console::Console(nsPIDOMWindowInner* aWindow) : mWindow(aWindow) , mOuterID(0) , mInnerID(0) { if (mWindow) { MOZ_ASSERT(mWindow->IsInnerWindow()); mInnerID = mWindow->WindowID(); // Without outerwindow any console message coming from this object will not // shown in the devtools webconsole. But this should be fine because // probably we are shutting down, or the window is CCed/GCed. - nsPIDOMWindow* outerWindow = mWindow->GetOuterWindow(); + nsPIDOMWindowOuter* outerWindow = mWindow->GetOuterWindow(); if (outerWindow) { mOuterID = outerWindow->WindowID(); } } if (NS_IsMainThread()) { nsCOMPtr<nsIObserverService> obs = mozilla::services::GetObserverService(); if (obs) { @@ -1061,17 +1061,17 @@ Console::Method(JSContext* aCx, MethodNa } } // Monotonic timer for 'time' and 'timeEnd' if (aMethodName == MethodTime || aMethodName == MethodTimeEnd || aMethodName == MethodTimeStamp) { if (mWindow) { - nsGlobalWindow *win = static_cast<nsGlobalWindow*>(mWindow.get()); + nsGlobalWindow *win = nsGlobalWindow::Cast(mWindow); MOZ_ASSERT(win); RefPtr<nsPerformance> performance = win->GetPerformance(); if (!performance) { return; } callData->mMonotonicTimer = performance->Now();
--- a/dom/base/Console.h +++ b/dom/base/Console.h @@ -34,20 +34,20 @@ class Console final : public nsIObserver { ~Console(); public: NS_DECL_CYCLE_COLLECTING_ISUPPORTS NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_AMBIGUOUS(Console, nsIObserver) NS_DECL_NSIOBSERVER - explicit Console(nsPIDOMWindow* aWindow); + explicit Console(nsPIDOMWindowInner* aWindow); // WebIDL methods - nsISupports* GetParentObject() const + nsPIDOMWindowInner* GetParentObject() const { return mWindow; } virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override; void @@ -198,17 +198,17 @@ private: const nsTArray<JS::Heap<JS::Value>>& aArguments); bool ShouldIncludeStackTrace(MethodName aMethodName); JSObject* GetOrCreateSandbox(JSContext* aCx, nsIPrincipal* aPrincipal); - nsCOMPtr<nsPIDOMWindow> mWindow; + nsCOMPtr<nsPIDOMWindowInner> mWindow; nsCOMPtr<nsIConsoleAPIStorage> mStorage; RefPtr<JSObjectHolder> mSandbox; nsDataHashtable<nsStringHashKey, DOMHighResTimeStamp> mTimerRegistry; nsDataHashtable<nsStringHashKey, uint32_t> mCounterRegistry; uint64_t mOuterID; uint64_t mInnerID;
--- a/dom/base/DOMCursor.cpp +++ b/dom/base/DOMCursor.cpp @@ -15,17 +15,17 @@ NS_IMPL_CYCLE_COLLECTION_INHERITED(DOMCu NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(DOMCursor) NS_INTERFACE_MAP_ENTRY(nsIDOMDOMCursor) NS_INTERFACE_MAP_END_INHERITING(DOMRequest) NS_IMPL_ADDREF_INHERITED(DOMCursor, DOMRequest) NS_IMPL_RELEASE_INHERITED(DOMCursor, DOMRequest) -DOMCursor::DOMCursor(nsPIDOMWindow* aWindow, nsICursorContinueCallback* aCallback) +DOMCursor::DOMCursor(nsPIDOMWindowInner* aWindow, nsICursorContinueCallback* aCallback) : DOMRequest(aWindow) , mCallback(aCallback) , mFinished(false) { } DOMCursor::DOMCursor(nsIGlobalObject* aGlobal, nsICursorContinueCallback* aCallback) : DOMRequest(aGlobal)
--- a/dom/base/DOMCursor.h +++ b/dom/base/DOMCursor.h @@ -20,17 +20,17 @@ class DOMCursor : public DOMRequest , public nsIDOMDOMCursor { public: NS_DECL_ISUPPORTS_INHERITED NS_DECL_NSIDOMDOMCURSOR NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(DOMCursor, DOMRequest) - DOMCursor(nsPIDOMWindow* aWindow, nsICursorContinueCallback *aCallback); + DOMCursor(nsPIDOMWindowInner* aWindow, nsICursorContinueCallback *aCallback); DOMCursor(nsIGlobalObject* aGlobal, nsICursorContinueCallback *aCallback); virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override; bool Done() const { return mFinished; }
--- a/dom/base/DOMError.cpp +++ b/dom/base/DOMError.cpp @@ -16,38 +16,38 @@ NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(DO NS_IMPL_CYCLE_COLLECTING_ADDREF(DOMError) NS_IMPL_CYCLE_COLLECTING_RELEASE(DOMError) NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(DOMError) NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY NS_INTERFACE_MAP_ENTRY(DOMError) NS_INTERFACE_MAP_ENTRY(nsISupports) NS_INTERFACE_MAP_END -DOMError::DOMError(nsPIDOMWindow* aWindow) +DOMError::DOMError(nsPIDOMWindowInner* aWindow) : mWindow(aWindow) { } -DOMError::DOMError(nsPIDOMWindow* aWindow, nsresult aValue) +DOMError::DOMError(nsPIDOMWindowInner* aWindow, nsresult aValue) : mWindow(aWindow) { nsCString name, message; NS_GetNameAndMessageForDOMNSResult(aValue, name, message); CopyUTF8toUTF16(name, mName); CopyUTF8toUTF16(message, mMessage); } -DOMError::DOMError(nsPIDOMWindow* aWindow, const nsAString& aName) +DOMError::DOMError(nsPIDOMWindowInner* aWindow, const nsAString& aName) : mWindow(aWindow) , mName(aName) { } -DOMError::DOMError(nsPIDOMWindow* aWindow, const nsAString& aName, +DOMError::DOMError(nsPIDOMWindowInner* aWindow, const nsAString& aName, const nsAString& aMessage) : mWindow(aWindow) , mName(aName) , mMessage(aMessage) { } DOMError::~DOMError() @@ -60,17 +60,17 @@ DOMError::WrapObject(JSContext* aCx, JS: return DOMErrorBinding::Wrap(aCx, this, aGivenProto); } /* static */ already_AddRefed<DOMError> DOMError::Constructor(const GlobalObject& aGlobal, const nsAString& aName, const nsAString& aMessage, ErrorResult& aRv) { - nsCOMPtr<nsPIDOMWindow> window = do_QueryInterface(aGlobal.GetAsSupports()); + nsCOMPtr<nsPIDOMWindowInner> window = do_QueryInterface(aGlobal.GetAsSupports()); // Window is null for chrome code. RefPtr<DOMError> ret = new DOMError(window, aName, aMessage); return ret.forget(); } } // namespace dom
--- a/dom/base/DOMError.h +++ b/dom/base/DOMError.h @@ -6,59 +6,60 @@ #ifndef mozilla_dom_domerror_h__ #define mozilla_dom_domerror_h__ #include "mozilla/Attributes.h" #include "nsWrapperCache.h" #include "nsCOMPtr.h" #include "nsString.h" -#include "nsPIDOMWindow.h" #define DOMERROR_IID \ { 0x220cb63f, 0xa37d, 0x4ba4, \ { 0x8e, 0x31, 0xfc, 0xde, 0xec, 0x48, 0xe1, 0x66 } } +class nsPIDOMWindowInner; + namespace mozilla { class ErrorResult; namespace dom { class GlobalObject; class DOMError : public nsISupports, public nsWrapperCache { - nsCOMPtr<nsPIDOMWindow> mWindow; + nsCOMPtr<nsPIDOMWindowInner> mWindow; nsString mName; nsString mMessage; protected: virtual ~DOMError(); public: NS_DECL_CYCLE_COLLECTING_ISUPPORTS NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(DOMError) NS_DECLARE_STATIC_IID_ACCESSOR(DOMERROR_IID) // aWindow can be null if this DOMError is not associated with a particular // window. - explicit DOMError(nsPIDOMWindow* aWindow); + explicit DOMError(nsPIDOMWindowInner* aWindow); - DOMError(nsPIDOMWindow* aWindow, nsresult aValue); + DOMError(nsPIDOMWindowInner* aWindow, nsresult aValue); - DOMError(nsPIDOMWindow* aWindow, const nsAString& aName); + DOMError(nsPIDOMWindowInner* aWindow, const nsAString& aName); - DOMError(nsPIDOMWindow* aWindow, const nsAString& aName, + DOMError(nsPIDOMWindowInner* aWindow, const nsAString& aName, const nsAString& aMessage); - nsPIDOMWindow* GetParentObject() const + nsPIDOMWindowInner* GetParentObject() const { return mWindow; } virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override; static already_AddRefed<DOMError>
--- a/dom/base/DOMParser.cpp +++ b/dom/base/DOMParser.cpp @@ -417,17 +417,17 @@ DOMParser::InitInternal(nsISupports* aOw // using the base URI and document URI of the window off of which the // DOMParser is created, not the window in which parse*() is called. // Does that matter? // Also note that |cx| matches what GetDocumentFromContext() would return, // while GetDocumentFromCaller() gives us the window that the DOMParser() // call was made on. - nsCOMPtr<nsPIDOMWindow> window = do_QueryInterface(aOwner); + nsCOMPtr<nsPIDOMWindowInner> window = do_QueryInterface(aOwner); if (!window) { return NS_ERROR_UNEXPECTED; } baseURI = window->GetDocBaseURI(); documentURI = window->GetDocumentURI(); if (!documentURI) { return NS_ERROR_UNEXPECTED;
--- a/dom/base/DOMRequest.cpp +++ b/dom/base/DOMRequest.cpp @@ -18,19 +18,18 @@ using mozilla::dom::AnyCallback; using mozilla::dom::DOMError; using mozilla::dom::DOMRequest; using mozilla::dom::DOMRequestService; using mozilla::dom::DOMCursor; using mozilla::dom::Promise; using mozilla::dom::AutoJSAPI; -DOMRequest::DOMRequest(nsPIDOMWindow* aWindow) - : DOMEventTargetHelper(aWindow->IsInnerWindow() ? - aWindow : aWindow->GetCurrentInnerWindow()) +DOMRequest::DOMRequest(nsPIDOMWindowInner* aWindow) + : DOMEventTargetHelper(aWindow) , mResult(JS::UndefinedValue()) , mDone(false) { } DOMRequest::DOMRequest(nsIGlobalObject* aGlobal) : DOMEventTargetHelper(aGlobal) , mResult(JS::UndefinedValue()) @@ -235,34 +234,34 @@ DOMRequest::Then(JSContext* aCx, AnyCall JS::Rooted<JSObject*> global(aCx, mPromise->GetWrapper()); global = js::GetGlobalForObjectCrossCompartment(global); mPromise->Then(aCx, global, aResolveCallback, aRejectCallback, aRetval, aRv); } NS_IMPL_ISUPPORTS(DOMRequestService, nsIDOMRequestService) NS_IMETHODIMP -DOMRequestService::CreateRequest(nsIDOMWindow* aWindow, +DOMRequestService::CreateRequest(mozIDOMWindow* aWindow, nsIDOMDOMRequest** aRequest) { MOZ_ASSERT(NS_IsMainThread()); - nsCOMPtr<nsPIDOMWindow> win(do_QueryInterface(aWindow)); - NS_ENSURE_STATE(win); + NS_ENSURE_STATE(aWindow); + auto* win = nsPIDOMWindowInner::From(aWindow); NS_ADDREF(*aRequest = new DOMRequest(win)); return NS_OK; } NS_IMETHODIMP -DOMRequestService::CreateCursor(nsIDOMWindow* aWindow, +DOMRequestService::CreateCursor(mozIDOMWindow* aWindow, nsICursorContinueCallback* aCallback, nsIDOMDOMCursor** aCursor) { - nsCOMPtr<nsPIDOMWindow> win(do_QueryInterface(aWindow)); - NS_ENSURE_STATE(win); + NS_ENSURE_STATE(aWindow); + auto* win = nsPIDOMWindowInner::From(aWindow); NS_ADDREF(*aCursor = new DOMCursor(win, aCallback)); return NS_OK; } NS_IMETHODIMP DOMRequestService::FireSuccess(nsIDOMDOMRequest* aRequest, JS::Handle<JS::Value> aResult)
--- a/dom/base/DOMRequest.h +++ b/dom/base/DOMRequest.h @@ -37,17 +37,17 @@ public: NS_DECL_ISUPPORTS_INHERITED NS_DECL_NSIDOMDOMREQUEST NS_REALLY_FORWARD_NSIDOMEVENTTARGET(DOMEventTargetHelper) NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_INHERITED(DOMRequest, DOMEventTargetHelper) // WrapperCache - nsPIDOMWindow* GetParentObject() const + nsPIDOMWindowInner* GetParentObject() const { return GetOwner(); } virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override; // WebIDL Interface DOMRequestReadyState ReadyState() const @@ -80,17 +80,17 @@ public: JS::MutableHandle<JS::Value> aRetval, mozilla::ErrorResult& aRv); void FireSuccess(JS::Handle<JS::Value> aResult); void FireError(const nsAString& aError); void FireError(nsresult aError); void FireDetailedError(DOMError* aError); - explicit DOMRequest(nsPIDOMWindow* aWindow); + explicit DOMRequest(nsPIDOMWindowInner* aWindow); explicit DOMRequest(nsIGlobalObject* aGlobal); protected: virtual ~DOMRequest(); void FireEvent(const nsAString& aType, bool aBubble, bool aCancelable); void RootResultVal();
--- a/dom/base/DocumentFragment.cpp +++ b/dom/base/DocumentFragment.cpp @@ -111,17 +111,17 @@ DocumentFragment::DumpContent(FILE* out, } } #endif /* static */ already_AddRefed<DocumentFragment> DocumentFragment::Constructor(const GlobalObject& aGlobal, ErrorResult& aRv) { - nsCOMPtr<nsPIDOMWindow> window = do_QueryInterface(aGlobal.GetAsSupports()); + nsCOMPtr<nsPIDOMWindowInner> window = do_QueryInterface(aGlobal.GetAsSupports()); if (!window || !window->GetDoc()) { aRv.Throw(NS_ERROR_FAILURE); return nullptr; } return window->GetDoc()->CreateDocumentFragment(); }
--- a/dom/base/Element.cpp +++ b/dom/base/Element.cpp @@ -2013,21 +2013,21 @@ bool Element::ShouldBlur(nsIContent *aContent) { // Determine if the current element is focused, if it is not focused // then we should not try to blur nsIDocument* document = aContent->GetComposedDoc(); if (!document) return false; - nsCOMPtr<nsPIDOMWindow> window = do_QueryInterface(document->GetWindow()); + nsCOMPtr<nsPIDOMWindowOuter> window = document->GetWindow(); if (!window) return false; - nsCOMPtr<nsPIDOMWindow> focusedFrame; + nsCOMPtr<nsPIDOMWindowOuter> focusedFrame; nsIContent* contentToBlur = nsFocusManager::GetFocusedDescendant(window, false, getter_AddRefs(focusedFrame)); if (contentToBlur == aContent) return true; // if focus on this element would get redirected, then check the redirected // content as well when blurring. return (contentToBlur && nsFocusManager::GetRedirectedFocus(aContent) == contentToBlur); @@ -3228,17 +3228,16 @@ Element::AttrValueToCORSMode(const nsAtt } return CORSMode(aValue->GetEnumValue()); } static const char* GetFullScreenError(nsIDocument* aDoc) { - nsCOMPtr<nsPIDOMWindow> win = aDoc->GetWindow(); if (aDoc->NodePrincipal()->GetAppStatus() >= nsIPrincipal::APP_STATUS_INSTALLED) { // Request is in a web app and in the same origin as the web app. // Don't enforce as strict security checks for web apps, the user // is supposed to have trust in them. However documents cross-origin // to the web app must still confirm to the normal security checks. return nullptr; }
--- a/dom/base/EventSource.cpp +++ b/dom/base/EventSource.cpp @@ -7,16 +7,17 @@ #include "mozilla/dom/EventSource.h" #include "mozilla/ArrayUtils.h" #include "mozilla/DebugOnly.h" #include "mozilla/LoadInfo.h" #include "mozilla/DOMEventTargetHelper.h" #include "mozilla/dom/EventSourceBinding.h" #include "mozilla/dom/MessageEvent.h" +#include "mozilla/dom/MessageEventBinding.h" #include "mozilla/dom/ScriptSettings.h" #include "nsNetUtil.h" #include "nsIAuthPrompt.h" #include "nsIAuthPrompt2.h" #include "nsIInputStream.h" #include "nsIInterfaceRequestorUtils.h" #include "nsMimeTypes.h" @@ -53,17 +54,17 @@ namespace dom { #define DEFAULT_BUFFER_SIZE 4096 // Reconnection time related values in milliseconds. The default one is equal // to the default value of the pref dom.server-events.default-reconnection-time #define MIN_RECONNECTION_TIME_VALUE 500 #define DEFAULT_RECONNECTION_TIME_VALUE 5000 #define MAX_RECONNECTION_TIME_VALUE PR_IntervalToMilliseconds(DELAY_INTERVAL_LIMIT) -EventSource::EventSource(nsPIDOMWindow* aOwnerWindow) : +EventSource::EventSource(nsPIDOMWindowInner* aOwnerWindow) : DOMEventTargetHelper(aOwnerWindow), mStatus(PARSE_STATE_OFF), mFrozen(false), mErrorLoadOnRedirect(false), mGoingToDispatchAllMessages(false), mWithCredentials(false), mWaitingForOnStopRequest(false), mLastConvertionResult(NS_OK), @@ -275,17 +276,17 @@ EventSource::WrapObject(JSContext* aCx, } /* static */ already_AddRefed<EventSource> EventSource::Constructor(const GlobalObject& aGlobal, const nsAString& aURL, const EventSourceInit& aEventSourceInitDict, ErrorResult& aRv) { - nsCOMPtr<nsPIDOMWindow> ownerWindow = + nsCOMPtr<nsPIDOMWindowInner> ownerWindow = do_QueryInterface(aGlobal.GetAsSupports()); if (!ownerWindow) { aRv.Throw(NS_ERROR_UNEXPECTED); return nullptr; } MOZ_ASSERT(ownerWindow->IsInnerWindow()); RefPtr<EventSource> eventSource = new EventSource(ownerWindow); @@ -302,17 +303,17 @@ NS_IMETHODIMP EventSource::Observe(nsISupports* aSubject, const char* aTopic, const char16_t* aData) { if (mReadyState == CLOSED) { return NS_OK; } - nsCOMPtr<nsPIDOMWindow> window = do_QueryInterface(aSubject); + nsCOMPtr<nsPIDOMWindowInner> window = do_QueryInterface(aSubject); if (!GetOwner() || window != GetOwner()) { return NS_OK; } DebugOnly<nsresult> rv; if (strcmp(aTopic, DOM_WINDOW_FROZEN_TOPIC) == 0) { rv = Freeze(); NS_ASSERTION(NS_SUCCEEDED(rv), "Freeze() failed"); @@ -559,17 +560,17 @@ EventSource::GetInterface(const nsIID & nsCOMPtr<nsIPromptFactory> wwatch = do_GetService(NS_WINDOWWATCHER_CONTRACTID, &rv); NS_ENSURE_SUCCESS(rv, rv); // Get the an auth prompter for our window so that the parenting // of the dialogs works as it should when using tabs. - nsCOMPtr<nsIDOMWindow> window; + nsCOMPtr<nsPIDOMWindowOuter> window; if (GetOwner()) { window = GetOwner()->GetOuterWindow(); } return wwatch->GetPrompt(window, aIID, aResult); } return QueryInterface(aIID, aResult); @@ -1107,23 +1108,18 @@ EventSource::DispatchAllMessageEvents() } // create an event that uses the MessageEvent interface, // which does not bubble, is not cancelable, and has no default action RefPtr<MessageEvent> event = NS_NewDOMMessageEvent(this, nullptr, nullptr); - rv = event->InitMessageEvent(message->mEventName, false, false, jsData, - mOrigin, message->mLastEventID, nullptr); - if (NS_FAILED(rv)) { - NS_WARNING("Failed to init the message event!!!"); - return; - } - + event->InitMessageEvent(nullptr, message->mEventName, false, false, jsData, + mOrigin, message->mLastEventID, nullptr, nullptr); event->SetTrusted(true); rv = DispatchDOMEvent(nullptr, static_cast<Event*>(event), nullptr, nullptr); if (NS_FAILED(rv)) { NS_WARNING("Failed to dispatch the message event!!!"); return; }
--- a/dom/base/EventSource.h +++ b/dom/base/EventSource.h @@ -21,17 +21,17 @@ #include "nsIChannelEventSink.h" #include "nsIInterfaceRequestor.h" #include "nsITimer.h" #include "nsIHttpChannel.h" #include "nsWeakReference.h" #include "nsDeque.h" #include "nsIUnicodeDecoder.h" -class nsPIDOMWindow; +class nsPIDOMWindowInner; namespace mozilla { class ErrorResult; namespace dom { struct EventSourceInit; @@ -39,32 +39,32 @@ struct EventSourceInit; class EventSource final : public DOMEventTargetHelper , public nsIObserver , public nsIStreamListener , public nsIChannelEventSink , public nsIInterfaceRequestor , public nsSupportsWeakReference { public: - explicit EventSource(nsPIDOMWindow* aOwnerWindow); + explicit EventSource(nsPIDOMWindowInner* aOwnerWindow); NS_DECL_ISUPPORTS_INHERITED NS_DECL_CYCLE_COLLECTION_SKIPPABLE_SCRIPT_HOLDER_CLASS_INHERITED( EventSource, DOMEventTargetHelper) NS_DECL_NSIOBSERVER NS_DECL_NSISTREAMLISTENER NS_DECL_NSIREQUESTOBSERVER NS_DECL_NSICHANNELEVENTSINK NS_DECL_NSIINTERFACEREQUESTOR // nsWrapperCache virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override; // WebIDL - nsPIDOMWindow* + nsPIDOMWindowInner* GetParentObject() const { return GetOwner(); } static already_AddRefed<EventSource> Constructor(const GlobalObject& aGlobal, const nsAString& aURL, const EventSourceInit& aEventSourceInitDict, ErrorResult& aRv);
--- a/dom/base/File.cpp +++ b/dom/base/File.cpp @@ -208,17 +208,17 @@ Blob::CreateTemporaryBlob(nsISupports* a Blob::Blob(nsISupports* aParent, BlobImpl* aImpl) : mImpl(aImpl) , mParent(aParent) { MOZ_ASSERT(mImpl); #ifdef DEBUG { - nsCOMPtr<nsPIDOMWindow> win = do_QueryInterface(aParent); + nsCOMPtr<nsPIDOMWindowInner> win = do_QueryInterface(aParent); if (win) { MOZ_ASSERT(win->IsInnerWindow()); } } #endif } bool @@ -597,17 +597,17 @@ File::Constructor(const GlobalObject& aG ErrorResult& aRv) { MOZ_ASSERT(NS_IsMainThread()); if (!nsContentUtils::IsCallerChrome()) { aRv.Throw(NS_ERROR_FAILURE); return nullptr; } - nsCOMPtr<nsPIDOMWindow> window = do_QueryInterface(aGlobal.GetAsSupports()); + nsCOMPtr<nsPIDOMWindowInner> window = do_QueryInterface(aGlobal.GetAsSupports()); RefPtr<MultipartBlobImpl> impl = new MultipartBlobImpl(EmptyString()); impl->InitializeChromeFile(window, aData, aBag, true, aRv); if (aRv.Failed()) { return nullptr; } MOZ_ASSERT(impl->IsFile()); @@ -625,17 +625,17 @@ File::Constructor(const GlobalObject& aG const ChromeFilePropertyBag& aBag, ErrorResult& aRv) { if (!nsContentUtils::ThreadsafeIsCallerChrome()) { aRv.Throw(NS_ERROR_FAILURE); return nullptr; } - nsCOMPtr<nsPIDOMWindow> window = do_QueryInterface(aGlobal.GetAsSupports()); + nsCOMPtr<nsPIDOMWindowInner> window = do_QueryInterface(aGlobal.GetAsSupports()); RefPtr<MultipartBlobImpl> impl = new MultipartBlobImpl(EmptyString()); impl->InitializeChromeFile(window, aData, aBag, aRv); if (aRv.Failed()) { return nullptr; } MOZ_ASSERT(impl->IsFile());
--- a/dom/base/FragmentOrElement.cpp +++ b/dom/base/FragmentOrElement.cpp @@ -842,17 +842,17 @@ nsIContent::PreHandleEvent(EventChainPre break; } if (stopEvent) { // If we do stop propagation, we still want to propagate // the event to chrome (nsPIDOMWindow::GetParentTarget()). // The load event is special in that we don't ever propagate it // to chrome. - nsCOMPtr<nsPIDOMWindow> win = OwnerDoc()->GetWindow(); + nsCOMPtr<nsPIDOMWindowOuter> win = OwnerDoc()->GetWindow(); EventTarget* parentTarget = win && aVisitor.mEvent->mMessage != eLoad ? win->GetParentTarget() : nullptr; aVisitor.mParentTarget = parentTarget; return NS_OK; } if (!aVisitor.mDestInsertionPoints.IsEmpty()) {
--- a/dom/base/MultipartBlobImpl.cpp +++ b/dom/base/MultipartBlobImpl.cpp @@ -353,17 +353,17 @@ MultipartBlobImpl::InitializeChromeFile( blobSet.AppendBlobImpl(aBlob.Impl()); mBlobImpls = blobSet.GetBlobImpls(); SetLengthAndModifiedDate(aRv); NS_WARN_IF(aRv.Failed()); } void -MultipartBlobImpl::InitializeChromeFile(nsPIDOMWindow* aWindow, +MultipartBlobImpl::InitializeChromeFile(nsPIDOMWindowInner* aWindow, nsIFile* aFile, const ChromeFilePropertyBag& aBag, bool aIsFromNsIFile, ErrorResult& aRv) { NS_ASSERTION(!mImmutable, "Something went wrong ..."); if (mImmutable) { aRv.Throw(NS_ERROR_UNEXPECTED); @@ -425,17 +425,17 @@ MultipartBlobImpl::InitializeChromeFile( blobSet.AppendBlobImpl(static_cast<File*>(blob.get())->Impl()); mBlobImpls = blobSet.GetBlobImpls(); SetLengthAndModifiedDate(aRv); NS_WARN_IF(aRv.Failed()); } void -MultipartBlobImpl::InitializeChromeFile(nsPIDOMWindow* aWindow, +MultipartBlobImpl::InitializeChromeFile(nsPIDOMWindowInner* aWindow, const nsAString& aData, const ChromeFilePropertyBag& aBag, ErrorResult& aRv) { nsCOMPtr<nsIFile> file; aRv = NS_NewLocalFile(aData, false, getter_AddRefs(file)); if (NS_WARN_IF(aRv.Failed())) { return;
--- a/dom/base/MultipartBlobImpl.h +++ b/dom/base/MultipartBlobImpl.h @@ -59,22 +59,22 @@ public: const nsAString& aContentType, bool aNativeEOL, ErrorResult& aRv); void InitializeChromeFile(Blob& aData, const ChromeFilePropertyBag& aBag, ErrorResult& aRv); - void InitializeChromeFile(nsPIDOMWindow* aWindow, + void InitializeChromeFile(nsPIDOMWindowInner* aWindow, const nsAString& aData, const ChromeFilePropertyBag& aBag, ErrorResult& aRv); - void InitializeChromeFile(nsPIDOMWindow* aWindow, + void InitializeChromeFile(nsPIDOMWindowInner* aWindow, nsIFile* aData, const ChromeFilePropertyBag& aBag, bool aIsFromNsIFile, ErrorResult& aRv); virtual already_AddRefed<BlobImpl> CreateSlice(uint64_t aStart, uint64_t aLength, const nsAString& aContentType,
--- a/dom/base/Navigator.cpp +++ b/dom/base/Navigator.cpp @@ -146,17 +146,17 @@ Navigator::Init() Preferences::AddBoolVarCache(&sVibratorEnabled, "dom.vibrator.enabled", true); Preferences::AddUintVarCache(&sMaxVibrateMS, "dom.vibrator.max_vibrate_ms", 10000); Preferences::AddUintVarCache(&sMaxVibrateListLen, "dom.vibrator.max_vibrate_list_len", 128); } -Navigator::Navigator(nsPIDOMWindow* aWindow) +Navigator::Navigator(nsPIDOMWindowInner* aWindow) : mWindow(aWindow) { MOZ_ASSERT(aWindow->IsInnerWindow(), "Navigator must get an inner window!"); } Navigator::~Navigator() { Invalidate(); @@ -368,17 +368,17 @@ Navigator::Invalidate() //***************************************************************************** // Navigator::nsIDOMNavigator //***************************************************************************** NS_IMETHODIMP Navigator::GetUserAgent(nsAString& aUserAgent) { nsCOMPtr<nsIURI> codebaseURI; - nsCOMPtr<nsPIDOMWindow> window; + nsCOMPtr<nsPIDOMWindowInner> window; if (mWindow) { window = mWindow; nsIDocShell* docshell = window->GetDocShell(); nsString customUserAgent; if (docshell) { docshell->GetCustomUserAgent(customUserAgent); @@ -753,17 +753,17 @@ Navigator::RefreshMIMEArray() } } namespace { class VibrateWindowListener : public nsIDOMEventListener { public: - VibrateWindowListener(nsIDOMWindow* aWindow, nsIDocument* aDocument) + VibrateWindowListener(nsPIDOMWindowInner* aWindow, nsIDocument* aDocument) { mWindow = do_GetWeakReference(aWindow); mDocument = do_GetWeakReference(aDocument); NS_NAMED_LITERAL_STRING(visibilitychange, "visibilitychange"); aDocument->AddSystemEventListener(visibilitychange, this, /* listener */ true, /* use capture */ @@ -806,17 +806,17 @@ VibrateWindowListener::HandleEvent(nsIDO nsCOMPtr<nsIDocument> doc = do_QueryInterface(aEvent->InternalDOMEvent()->GetTarget()); if (!MayVibrate(doc)) { // It's important that we call CancelVibrate(), not Vibrate() with an // empty list, because Vibrate() will fail if we're no longer focused, but // CancelVibrate() will succeed, so long as nobody else has started a new // vibration pattern. - nsCOMPtr<nsIDOMWindow> window = do_QueryReferent(mWindow); + nsCOMPtr<nsPIDOMWindowInner> window = do_QueryReferent(mWindow); hal::CancelVibrate(window); RemoveListener(); gVibrateWindowListener = nullptr; // Careful: The line above might have deleted |this|! } return NS_OK; } @@ -922,17 +922,17 @@ Navigator::Vibrate(const nsTArray<uint32 //***************************************************************************** // Pointer Events interface //***************************************************************************** uint32_t Navigator::MaxTouchPoints() { - nsCOMPtr<nsIWidget> widget = widget::WidgetUtils::DOMWindowToWidget(mWindow); + nsCOMPtr<nsIWidget> widget = widget::WidgetUtils::DOMWindowToWidget(mWindow->GetOuterWindow()); NS_ENSURE_TRUE(widget, 0); return widget->GetMaxTouchPoints(); } //***************************************************************************** // Navigator::nsIDOMClientInformation //***************************************************************************** @@ -1105,17 +1105,17 @@ Navigator::GetGeolocation(ErrorResult& a } if (!mWindow || !mWindow->GetOuterWindow() || !mWindow->GetDocShell()) { aRv.Throw(NS_ERROR_FAILURE); return nullptr; } mGeolocation = new Geolocation(); - if (NS_FAILED(mGeolocation->Init(mWindow->GetOuterWindow()))) { + if (NS_FAILED(mGeolocation->Init(mWindow))) { mGeolocation = nullptr; aRv.Throw(NS_ERROR_FAILURE); return nullptr; } return mGeolocation; } @@ -1504,17 +1504,17 @@ Navigator::GetDeprecatedBattery(ErrorRes mBatteryManager = new battery::BatteryManager(mWindow); mBatteryManager->Init(); } return mBatteryManager; } /* static */ already_AddRefed<Promise> -Navigator::GetDataStores(nsPIDOMWindow* aWindow, +Navigator::GetDataStores(nsPIDOMWindowInner* aWindow, const nsAString& aName, const nsAString& aOwner, ErrorResult& aRv) { if (!aWindow || !aWindow->GetDocShell()) { aRv.Throw(NS_ERROR_UNEXPECTED); return nullptr; } @@ -1918,17 +1918,17 @@ void Navigator::GetGamepads(nsTArray<RefPtr<Gamepad> >& aGamepads, ErrorResult& aRv) { if (!mWindow) { aRv.Throw(NS_ERROR_UNEXPECTED); return; } NS_ENSURE_TRUE_VOID(mWindow->GetDocShell()); - nsGlobalWindow* win = static_cast<nsGlobalWindow*>(mWindow.get()); + nsGlobalWindow* win = nsGlobalWindow::Cast(mWindow); win->SetHasGamepadEventListener(true); win->GetGamepads(aGamepads); } #endif already_AddRefed<Promise> Navigator::GetVRDevices(ErrorResult& aRv) { @@ -1954,17 +1954,17 @@ Navigator::GetVRDevices(ErrorResult& aRv return p.forget(); } void Navigator::NotifyVRDevicesUpdated() { // Synchronize the VR devices and resolve the promises in // mVRGetDevicesPromises - nsGlobalWindow* win = static_cast<nsGlobalWindow*>(mWindow.get()); + nsGlobalWindow* win = nsGlobalWindow::Cast(mWindow); nsTArray<RefPtr<VRDevice>> vrDevs; if (win->UpdateVRDevices(vrDevs)) { for (auto p: mVRGetDevicesPromises) { p->MaybeResolve(vrDevs); } } else { for (auto p: mVRGetDevicesPromises) { @@ -2168,17 +2168,17 @@ Navigator::SizeOfIncludingThis(mozilla:: // TODO: add SizeOfIncludingThis() to nsPluginArray, bug 674114. // TODO: add SizeOfIncludingThis() to Geolocation, bug 674115. // TODO: add SizeOfIncludingThis() to DesktopNotificationCenter, bug 674116. return n; } void -Navigator::SetWindow(nsPIDOMWindow *aInnerWindow) +Navigator::SetWindow(nsPIDOMWindowInner *aInnerWindow) { NS_ASSERTION(aInnerWindow->IsInnerWindow(), "Navigator must get an inner window!"); mWindow = aInnerWindow; } void Navigator::OnNavigation() @@ -2202,17 +2202,17 @@ Navigator::OnNavigation() bool Navigator::CheckPermission(const char* type) { return CheckPermission(mWindow, type); } /* static */ bool -Navigator::CheckPermission(nsPIDOMWindow* aWindow, const char* aType) +Navigator::CheckPermission(nsPIDOMWindowInner* aWindow, const char* aType) { if (!aWindow) { return false; } nsCOMPtr<nsIPermissionManager> permMgr = services::GetPermissionManager(); NS_ENSURE_TRUE(permMgr, false); @@ -2454,17 +2454,17 @@ Navigator::HasWakeLockSupport(JSContext* // No service means no wake lock support return !!pmService; } /* static */ bool Navigator::HasCameraSupport(JSContext* /* unused */, JSObject* aGlobal) { - nsCOMPtr<nsPIDOMWindow> win = GetWindowFromGlobal(aGlobal); + nsCOMPtr<nsPIDOMWindowInner> win = GetWindowFromGlobal(aGlobal); return win && nsDOMCameraManager::CheckPermission(win); } /* static */ bool Navigator::HasWifiManagerSupport(JSContext* /* unused */, JSObject* aGlobal) { @@ -2483,17 +2483,17 @@ Navigator::HasWifiManagerSupport(JSConte return nsIPermissionManager::ALLOW_ACTION == permission; } #ifdef MOZ_NFC /* static */ bool Navigator::HasNFCSupport(JSContext* /* unused */, JSObject* aGlobal) { - nsCOMPtr<nsPIDOMWindow> win = GetWindowFromGlobal(aGlobal); + nsCOMPtr<nsPIDOMWindowInner> win = GetWindowFromGlobal(aGlobal); // Do not support NFC if NFC content helper does not exist. nsCOMPtr<nsISupports> contentHelper = do_GetService("@mozilla.org/nfc/content-helper;1"); return !!contentHelper; } #endif // MOZ_NFC #ifdef MOZ_MEDIA_NAVIGATOR @@ -2559,17 +2559,17 @@ Navigator::HasDataStoreSupport(JSContext new HasDataStoreSupportRunnable(workerPrivate); return runnable->Dispatch() && runnable->mResult; } workers::AssertIsOnMainThread(); JS::Rooted<JSObject*> global(aCx, aGlobal); - nsCOMPtr<nsPIDOMWindow> win = GetWindowFromGlobal(global); + nsCOMPtr<nsPIDOMWindowInner> win = GetWindowFromGlobal(global); if (!win) { return false; } nsIDocument* doc = win->GetExtantDoc(); if (!doc || !doc->NodePrincipal()) { return false; } @@ -2577,17 +2577,17 @@ Navigator::HasDataStoreSupport(JSContext return HasDataStoreSupport(doc->NodePrincipal()); } #ifdef MOZ_B2G /* static */ bool Navigator::HasMobileIdSupport(JSContext* aCx, JSObject* aGlobal) { - nsCOMPtr<nsPIDOMWindow> win = GetWindowFromGlobal(aGlobal); + nsCOMPtr<nsPIDOMWindowInner> win = GetWindowFromGlobal(aGlobal); if (!win) { return false; } nsIDocument* doc = win->GetExtantDoc(); if (!doc) { return false; } @@ -2605,60 +2605,61 @@ Navigator::HasMobileIdSupport(JSContext* #endif /* static */ bool Navigator::HasPresentationSupport(JSContext* aCx, JSObject* aGlobal) { JS::Rooted<JSObject*> global(aCx, aGlobal); - nsCOMPtr<nsPIDOMWindow> win = GetWindowFromGlobal(global); - if (NS_WARN_IF(!win)) { + nsCOMPtr<nsPIDOMWindowInner> inner = GetWindowFromGlobal(global); + if (NS_WARN_IF(!inner)) { return false; } // Grant access if it has the permission. - if (CheckPermission(win, "presentation")) { + if (CheckPermission(inner, "presentation")) { return true; } // Grant access to browser receiving pages and their same-origin iframes. (App // pages should be controlled by "presentation" permission in app manifests.) mozilla::dom::ContentChild* cc = mozilla::dom::ContentChild::GetSingleton(); if (!cc || !cc->IsForBrowser()) { return false; } - win = win->GetOuterWindow(); - nsCOMPtr<nsPIDOMWindow> top = win->GetTop(); + nsCOMPtr<nsPIDOMWindowOuter> win = inner->GetOuterWindow(); + nsCOMPtr<nsPIDOMWindowOuter> top = win->GetTop(); nsCOMPtr<nsIScriptObjectPrincipal> sop = do_QueryInterface(win); nsCOMPtr<nsIScriptObjectPrincipal> topSop = do_QueryInterface(top); if (!sop || !topSop) { return false; } nsIPrincipal* principal = sop->GetPrincipal(); nsIPrincipal* topPrincipal = topSop->GetPrincipal(); if (!principal || !topPrincipal || !principal->Subsumes(topPrincipal)) { return false; } - if (!(top = top->GetCurrentInnerWindow())) { + nsCOMPtr<nsPIDOMWindowInner> topInner; + if (!(topInner = top->GetCurrentInnerWindow())) { return false; } nsCOMPtr<nsIPresentationService> presentationService = do_GetService(PRESENTATION_SERVICE_CONTRACTID); if (NS_WARN_IF(!presentationService)) { return false; } nsAutoString sessionId; - presentationService->GetExistentSessionIdAtLaunch(top->WindowID(), sessionId); + presentationService->GetExistentSessionIdAtLaunch(topInner->WindowID(), sessionId); return !sessionId.IsEmpty(); } /* static */ bool Navigator::IsE10sEnabled(JSContext* aCx, JSObject* aGlobal) { return XRE_IsContentProcess(); @@ -2667,20 +2668,20 @@ Navigator::IsE10sEnabled(JSContext* aCx, bool Navigator::MozE10sEnabled() { // This will only be called if IsE10sEnabled() is true. return true; } /* static */ -already_AddRefed<nsPIDOMWindow> +already_AddRefed<nsPIDOMWindowInner> Navigator::GetWindowFromGlobal(JSObject* aGlobal) { - nsCOMPtr<nsPIDOMWindow> win = + nsCOMPtr<nsPIDOMWindowInner> win = do_QueryInterface(nsJSUtils::GetStaticScriptGlobal(aGlobal)); MOZ_ASSERT(!win || win->IsInnerWindow()); return win.forget(); } nsresult Navigator::GetPlatform(nsAString& aPlatform, bool aUsePrefOverriddenValue) { @@ -2783,17 +2784,17 @@ Navigator::AppName(nsAString& aAppName, void Navigator::ClearUserAgentCache() { NavigatorBinding::ClearCachedUserAgentValue(this); } nsresult -Navigator::GetUserAgent(nsPIDOMWindow* aWindow, nsIURI* aURI, +Navigator::GetUserAgent(nsPIDOMWindowInner* aWindow, nsIURI* aURI, bool aIsCallerChrome, nsAString& aUserAgent) { MOZ_ASSERT(NS_IsMainThread()); if (!aIsCallerChrome) { const nsAdoptingString& override = mozilla::Preferences::GetString("general.useragent.override");
--- a/dom/base/Navigator.h +++ b/dom/base/Navigator.h @@ -20,17 +20,17 @@ #include "nsTArray.h" #include "nsWeakPtr.h" #ifdef MOZ_EME #include "mozilla/dom/MediaKeySystemAccessManager.h" #endif class nsPluginArray; class nsMimeTypeArray; -class nsPIDOMWindow; +class nsPIDOMWindowInner; class nsIDOMNavigatorSystemMessages; class nsDOMCameraManager; class nsDOMDeviceStorage; class nsIPrincipal; class nsIURI; namespace mozilla { namespace dom { @@ -111,40 +111,40 @@ class AudioChannelManager; #endif } // namespace system class Navigator final : public nsIDOMNavigator , public nsIMozNavigatorNetwork , public nsWrapperCache { public: - explicit Navigator(nsPIDOMWindow* aInnerWindow); + explicit Navigator(nsPIDOMWindowInner* aInnerWindow); NS_DECL_CYCLE_COLLECTING_ISUPPORTS NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_AMBIGUOUS(Navigator, nsIDOMNavigator) NS_DECL_NSIDOMNAVIGATOR NS_DECL_NSIMOZNAVIGATORNETWORK static void Init(); void Invalidate(); - nsPIDOMWindow *GetWindow() const + nsPIDOMWindowInner *GetWindow() const { return mWindow; } void RefreshMIMEArray(); size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const; /** * For use during document.write where our inner window changes. */ - void SetWindow(nsPIDOMWindow *aInnerWindow); + void SetWindow(nsPIDOMWindowInner *aInnerWindow); /** * Called when the inner window navigates to a new page. */ void OnNavigation(); // Helper to initialize mMessagesManager. nsresult EnsureMessagesManager(); @@ -159,30 +159,30 @@ public: nsMimeTypeArray* GetMimeTypes(ErrorResult& aRv); nsPluginArray* GetPlugins(ErrorResult& aRv); Permissions* GetPermissions(ErrorResult& aRv); // The XPCOM GetDoNotTrack is ok Geolocation* GetGeolocation(ErrorResult& aRv); Promise* GetBattery(ErrorResult& aRv); battery::BatteryManager* GetDeprecatedBattery(ErrorResult& aRv); - static already_AddRefed<Promise> GetDataStores(nsPIDOMWindow* aWindow, + static already_AddRefed<Promise> GetDataStores(nsPIDOMWindowInner* aWindow, const nsAString& aName, const nsAString& aOwner, ErrorResult& aRv); static void AppName(nsAString& aAppName, bool aUsePrefOverriddenValue); static nsresult GetPlatform(nsAString& aPlatform, bool aUsePrefOverriddenValue); static nsresult GetAppVersion(nsAString& aAppVersion, bool aUsePrefOverriddenValue); - static nsresult GetUserAgent(nsPIDOMWindow* aWindow, + static nsresult GetUserAgent(nsPIDOMWindowInner* aWindow, nsIURI* aURI, bool aIsCallerChrome, nsAString& aUserAgent); // Clears the user agent cache by calling: // NavigatorBinding::ClearCachedUserAgentValue(this); void ClearUserAgentCache(); @@ -338,41 +338,41 @@ public: #ifdef MOZ_B2G static bool HasMobileIdSupport(JSContext* aCx, JSObject* aGlobal); #endif static bool HasPresentationSupport(JSContext* aCx, JSObject* aGlobal); static bool IsE10sEnabled(JSContext* aCx, JSObject* aGlobal); - nsPIDOMWindow* GetParentObject() const + nsPIDOMWindowInner* GetParentObject() const { return GetWindow(); } virtual JSObject* WrapObject(JSContext* cx, JS::Handle<JSObject*> aGivenProto) override; // GetWindowFromGlobal returns the inner window for this global, if // any, else null. - static already_AddRefed<nsPIDOMWindow> GetWindowFromGlobal(JSObject* aGlobal); + static already_AddRefed<nsPIDOMWindowInner> GetWindowFromGlobal(JSObject* aGlobal); #ifdef MOZ_EME already_AddRefed<Promise> RequestMediaKeySystemAccess(const nsAString& aKeySystem, const Sequence<MediaKeySystemConfiguration>& aConfig, ErrorResult& aRv); private: RefPtr<MediaKeySystemAccessManager> mMediaKeySystemAccessManager; #endif private: virtual ~Navigator(); bool CheckPermission(const char* type); - static bool CheckPermission(nsPIDOMWindow* aWindow, const char* aType); + static bool CheckPermission(nsPIDOMWindowInner* aWindow, const char* aType); already_AddRefed<nsDOMDeviceStorage> FindDeviceStorage(const nsAString& aName, const nsAString& aType); RefPtr<nsMimeTypeArray> mMimeTypes; RefPtr<nsPluginArray> mPlugins; RefPtr<Permissions> mPermissions; RefPtr<Geolocation> mGeolocation; @@ -401,17 +401,17 @@ private: RefPtr<system::AudioChannelManager> mAudioChannelManager; #endif RefPtr<nsDOMCameraManager> mCameraManager; RefPtr<MediaDevices> mMediaDevices; nsCOMPtr<nsIDOMNavigatorSystemMessages> mMessagesManager; nsTArray<nsWeakPtr> mDeviceStorageStores; RefPtr<time::TimeManager> mTimeManager; RefPtr<ServiceWorkerContainer> mServiceWorkerContainer; - nsCOMPtr<nsPIDOMWindow> mWindow; + nsCOMPtr<nsPIDOMWindowInner> mWindow; RefPtr<DeviceStorageAreaListener> mDeviceStorageAreaListener; RefPtr<Presentation> mPresentation; // Hashtable for saving cached objects DoResolve created, so we don't create // the object twice if asked for it twice, whether due to use of "delete" or // due to Xrays. We could probably use a nsJSThingHashtable here, but then // we'd need to figure out exactly how to trace that, and that seems to be // rocket science. :(