Bug 1241764: Replace nsPIDOMWindow with nsPIDOMWindowInner/Outer. r=mrbkap,smaug

This commit is contained in:
Kyle Huey 2016-01-30 09:05:36 -08:00
Родитель 9e4a3887ed
Коммит 91efc5a86c
806 изменённых файлов: 4709 добавлений и 5300 удалений

Просмотреть файл

@ -26,7 +26,6 @@
#include "nsDocShellLoadTypes.h"
#include "nsIChannel.h"
#include "nsIDOMDocument.h"
#include "nsIDOMWindow.h"
#include "nsIInterfaceRequestorUtils.h"
#include "nsIWebNavigation.h"
#include "nsServiceManagerUtils.h"
@ -218,11 +217,11 @@ DocManager::OnStateChange(nsIWebProgress* 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();
@ -403,7 +402,7 @@ 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"),
@ -427,7 +426,7 @@ DocManager::AddListeners(nsIDocument* aDocument,
void
DocManager::RemoveListeners(nsIDocument* aDocument)
{
nsPIDOMWindow* window = aDocument->GetWindow();
nsPIDOMWindowOuter* window = aDocument->GetWindow();
if (!window)
return;

Просмотреть файл

@ -389,7 +389,7 @@ FocusManager::FocusedDOMNode() const
}
// Otherwise the focus can be on DOM document.
nsPIDOMWindow* focusedWnd = DOMFocusManager->GetFocusedWindow();
nsPIDOMWindowOuter* focusedWnd = DOMFocusManager->GetFocusedWindow();
return focusedWnd ? focusedWnd->GetExtantDoc() : nullptr;
}

Просмотреть файл

@ -392,9 +392,9 @@ logging::DocLoad(const char* aMsg, nsIWebProgress* aWebProgress,
{
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;

Просмотреть файл

@ -15,7 +15,6 @@
#include "nsIComponentManager.h"
#include "nsIDOMDocument.h"
#include "nsIDOMWindow.h"
#include "nsIWindowMediator.h"
#include "nsServiceManagerUtils.h"
#include "mozilla/Services.h"
@ -193,7 +192,7 @@ ApplicationAccessible::CacheChildren()
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) {

Просмотреть файл

@ -1360,7 +1360,7 @@ HyperTextAccessible::SetSelectionRange(int32_t aStartPos, int32_t aEndPos)
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));

Просмотреть файл

@ -132,11 +132,11 @@ ImageAccessible::DoAction(uint8_t aIndex)
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)));
}

Просмотреть файл

@ -485,12 +485,10 @@ 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);

Просмотреть файл

@ -7,7 +7,7 @@
interface nsIAccessiblePivot;
interface nsIDOMDocument;
interface nsIDOMWindow;
interface mozIDOMWindowProxy;
/**
* An interface for in-process accessibility clients
@ -19,7 +19,7 @@ interface nsIDOMWindow;
* 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
{
/**
@ -50,7 +50,7 @@ interface nsIAccessibleDocument : nsISupports
/**
* The nsIDOMWindow that the document resides in.
*/
readonly attribute nsIDOMWindow window;
readonly attribute mozIDOMWindowProxy window;
/**
* Return the parent document accessible.

Просмотреть файл

@ -9,7 +9,6 @@ interface nsIDOMNode;
interface nsIAccessible;
interface nsIWeakReference;
interface nsIPresShell;
interface nsIDOMWindow;
interface nsIAccessiblePivot;
/**

Просмотреть файл

@ -45,8 +45,7 @@ nsWinUtils::GetComputedStyleDeclaration(nsIContent* aContent)
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;

Просмотреть файл

@ -99,7 +99,7 @@ xpcAccessibleDocument::GetDOMDocument(nsIDOMDocument** aDOMDocument)
}
NS_IMETHODIMP
xpcAccessibleDocument::GetWindow(nsIDOMWindow** aDOMWindow)
xpcAccessibleDocument::GetWindow(mozIDOMWindowProxy** aDOMWindow)
{
NS_ENSURE_ARG_POINTER(aDOMWindow);
*aDOMWindow = nullptr;

Просмотреть файл

@ -41,7 +41,7 @@ public:
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;

Просмотреть файл

@ -313,7 +313,7 @@ nsChromeRegistry::ConvertChromeURL(nsIURI* aChromeURI, nsIURI* *aResult)
// theme stuff
static void FlushSkinBindingsForWindow(nsPIDOMWindow* aWindow)
static void FlushSkinBindingsForWindow(nsPIDOMWindowOuter* aWindow)
{
// Get the document.
nsCOMPtr<nsIDocument> document = aWindow->GetDoc();
@ -340,7 +340,7 @@ NS_IMETHODIMP nsChromeRegistry::RefreshSkins()
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);
}
@ -355,7 +355,7 @@ NS_IMETHODIMP nsChromeRegistry::RefreshSkins()
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);
}
@ -377,7 +377,7 @@ nsChromeRegistry::FlushSkinCaches()
}
// 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();
@ -385,9 +385,9 @@ nsresult nsChromeRegistry::RefreshWindow(nsPIDOMWindow* aWindow)
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);
}
@ -503,7 +503,7 @@ nsChromeRegistry::ReloadChrome()
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) {

Просмотреть файл

@ -22,7 +22,7 @@
#include "mozilla/FileLocation.h"
class nsPIDOMWindow;
class nsPIDOMWindowOuter;
class nsIPrefBranch;
class nsIURL;
@ -95,7 +95,7 @@ protected:
nsresult SelectLocaleFromPref(nsIPrefBranch* prefs);
static nsresult RefreshWindow(nsPIDOMWindow* aWindow);
static nsresult RefreshWindow(nsPIDOMWindowOuter* aWindow);
static nsresult GetProviderAndPath(nsIURL* aChromeURL,
nsACString& aProvider, nsACString& aPath);

Просмотреть файл

@ -69,7 +69,7 @@ LoadContext::LoadContext(nsIPrincipal* aPrincipal,
//-----------------------------------------------------------------------------
NS_IMETHODIMP
LoadContext::GetAssociatedWindow(nsIDOMWindow**)
LoadContext::GetAssociatedWindow(mozIDOMWindowProxy**)
{
MOZ_ASSERT(mIsNotNull);
@ -78,7 +78,7 @@ LoadContext::GetAssociatedWindow(nsIDOMWindow**)
}
NS_IMETHODIMP
LoadContext::GetTopWindow(nsIDOMWindow**)
LoadContext::GetTopWindow(mozIDOMWindowProxy**)
{
MOZ_ASSERT(mIsNotNull);

Просмотреть файл

@ -148,8 +148,8 @@ nsDSURIContentListener::DoContent(const nsACString& aContentType,
}
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();
}
@ -294,7 +294,7 @@ nsDSURIContentListener::CheckOneFrameOptionsPolicy(nsIHttpChannel* aHttpChannel,
// 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;
@ -302,7 +302,7 @@ nsDSURIContentListener::CheckOneFrameOptionsPolicy(nsIHttpChannel* aHttpChannel,
// 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) {
@ -467,13 +467,12 @@ nsDSURIContentListener::ReportXFOViolation(nsIDocShellTreeItem* aTopDocShellItem
{
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;
}

Просмотреть файл

@ -964,7 +964,8 @@ nsDocShell::GetInterface(const nsIID& aIID, void** aSink)
*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())) {
@ -1012,7 +1013,7 @@ nsDocShell::GetInterface(const nsIID& aIID, void** aSink)
// 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;
@ -1080,8 +1081,7 @@ nsDocShell::GetInterface(const nsIID& aIID, void** aSink)
if (tabChild) {
tabChild->GetMessageManager(getter_AddRefs(mm));
} else {
nsCOMPtr<nsPIDOMWindow> win = GetWindow();
if (win) {
if (nsPIDOMWindowOuter* win = GetWindow()) {
mm = do_QueryInterface(win->GetParentTarget());
}
}
@ -1717,7 +1717,8 @@ nsDocShell::MaybeInitTiming()
}
if (mScriptGlobal && mBlankTiming) {
nsPIDOMWindow* innerWin = mScriptGlobal->GetCurrentInnerWindow();
nsPIDOMWindowInner* innerWin =
mScriptGlobal->AsOuter()->GetCurrentInnerWindow();
if (innerWin && innerWin->GetPerformance()) {
mTiming = innerWin->GetPerformance()->GetDOMTiming();
mBlankTiming = false;
@ -2430,8 +2431,8 @@ nsDocShell::SetAllowMedia(bool 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 {
@ -2517,7 +2518,7 @@ nsDocShell::GetFullscreenAllowed(bool* aFullscreenAllowed)
// Assume false until we determine otherwise...
*aFullscreenAllowed = false;
nsCOMPtr<nsPIDOMWindow> win = GetWindow();
nsCOMPtr<nsPIDOMWindowOuter> win = GetWindow();
if (!win) {
return NS_OK;
}
@ -2972,14 +2973,15 @@ nsDocShell::GetSessionStorageForPrincipal(nsIPrincipal* aPrincipal,
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->CreateStorage(domWin->GetCurrentInnerWindow(), aPrincipal,
aDocumentURI, mInPrivateBrowsing, aStorage);
}
return manager->GetStorage(domWin, aPrincipal, mInPrivateBrowsing, aStorage);
return manager->GetStorage(domWin->GetCurrentInnerWindow(), aPrincipal,
mInPrivateBrowsing, aStorage);
}
nsresult
@ -3545,13 +3547,13 @@ nsDocShell::CanAccessItem(nsIDocShellTreeItem* aTargetItem,
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));
@ -3565,8 +3567,8 @@ nsDocShell::CanAccessItem(nsIDocShellTreeItem* aTargetItem,
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;
@ -3823,7 +3825,7 @@ PrintDocTree(nsIDocShellTreeItem* aParentNode, int aLevel)
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();
@ -4442,13 +4444,13 @@ nsDocShell::GetDocument()
return mContentViewer->GetDocument();
}
nsPIDOMWindow*
nsPIDOMWindowOuter*
nsDocShell::GetWindow()
{
if (NS_FAILED(EnsureScriptEnvironment())) {
return nullptr;
}
return mScriptGlobal;
return mScriptGlobal->AsOuter();
}
NS_IMETHODIMP
@ -7575,7 +7577,7 @@ nsDocShell::EndPageLoad(nsIWebProgress* aProgress,
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;
}
@ -7814,8 +7816,7 @@ nsDocShell::EnsureContentViewer()
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();
@ -8668,8 +8669,7 @@ nsDocShell::RestoreFromHistory()
d->AnimationsPaused());
}
nsCOMPtr<nsPIDOMWindow> parentWindow = d->GetWindow();
if (parentWindow) {
if (nsCOMPtr<nsPIDOMWindowOuter> parentWindow = d->GetWindow()) {
parentSuspendCount = parentWindow->TimeoutSuspendCount();
}
}
@ -8688,7 +8688,7 @@ nsDocShell::RestoreFromHistory()
// 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);
@ -9608,7 +9608,7 @@ nsDocShell::InternalLoad(nsIURI* aURI,
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;
@ -9762,11 +9762,11 @@ nsDocShell::InternalLoad(nsIURI* aURI,
}
}
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);
@ -9779,7 +9779,7 @@ nsDocShell::InternalLoad(nsIURI* aURI,
// 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()) {
@ -9832,7 +9832,7 @@ nsDocShell::InternalLoad(nsIURI* aURI,
// 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();
}
}
@ -10187,7 +10187,7 @@ nsDocShell::InternalLoad(nsIURI* aURI,
win->DispatchSyncPopState();
}
if (needsScrollPosUpdate && win->HasActiveDocument()) {
if (needsScrollPosUpdate && win->AsInner()->HasActiveDocument()) {
SetCurScrollPosEx(bx, by);
}
@ -10530,7 +10530,7 @@ nsDocShell::DoURILoad(nsIURI* aURI,
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.
@ -10554,7 +10554,7 @@ nsDocShell::DoURILoad(nsIURI* aURI,
nsCOMPtr<nsINode> requestingNode;
if (mScriptGlobal) {
requestingNode = mScriptGlobal->GetFrameElementInternal();
requestingNode = mScriptGlobal->AsOuter()->GetFrameElementInternal();
if (!requestingNode) {
requestingNode = mScriptGlobal->GetExtantDoc();
}
@ -12964,8 +12964,8 @@ nsDocShell::EnsureFind()
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));
@ -13138,7 +13138,7 @@ nsDocShell::GetAuthPrompt(uint32_t aPromptReason, const nsIID& aIID,
// 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));
}
@ -13147,16 +13147,16 @@ nsDocShell::GetAuthPrompt(uint32_t aPromptReason, const nsIID& aIID,
//*****************************************************************************
NS_IMETHODIMP
nsDocShell::GetAssociatedWindow(nsIDOMWindow** aWindow)
nsDocShell::GetAssociatedWindow(mozIDOMWindowProxy** aWindow)
{
CallGetInterface(this, aWindow);
return NS_OK;
}
NS_IMETHODIMP
nsDocShell::GetTopWindow(nsIDOMWindow** aWindow)
nsDocShell::GetTopWindow(mozIDOMWindowProxy** aWindow)
{
nsCOMPtr<nsPIDOMWindow> win = GetWindow();
nsCOMPtr<nsPIDOMWindowOuter> win = GetWindow();
if (win) {
win = win->GetTop();
}
@ -13168,12 +13168,12 @@ 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
@ -13295,7 +13295,7 @@ nsDocShell::EnsureCommandHandler()
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);
@ -13584,10 +13584,10 @@ nsDocShell::OnLinkClickSync(nsIContent* aContent,
// 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;
}

Просмотреть файл

@ -220,8 +220,8 @@ public:
// 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;

Просмотреть файл

@ -76,7 +76,7 @@ nsDocShellEditorData::CreateEditor()
return rv;
}
nsCOMPtr<nsIDOMWindow> domWindow =
nsCOMPtr<nsPIDOMWindowOuter> domWindow =
mDocShell ? mDocShell->GetWindow() : nullptr;
rv = editingSession->SetupEditorOnWindow(domWindow);
if (NS_FAILED(rv)) {
@ -149,7 +149,7 @@ 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);
@ -158,8 +158,7 @@ nsDocShellEditorData::DetachFromWindow()
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();
@ -175,7 +174,7 @@ 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);
@ -183,8 +182,7 @@ nsDocShellEditorData::ReattachToWindow(nsIDocShell* aDocShell)
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);

Просмотреть файл

@ -43,7 +43,7 @@ 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
{
/**

Просмотреть файл

@ -8,7 +8,7 @@
interface nsIDocShellTreeOwner;
interface nsIDocument;
interface nsPIDOMWindow;
interface nsPIDOMWindowOuter;
/**
@ -17,7 +17,7 @@ interface nsPIDOMWindow;
* node or a leaf.
*/
[scriptable, uuid(edb99640-8378-4106-8673-e701a086eb1c)]
[scriptable, uuid(9b7c586f-9214-480c-a2c4-49b526fff1a6)]
interface nsIDocShellTreeItem : nsISupports
{
/*
@ -179,6 +179,6 @@ interface nsIDocShellTreeItem : nsISupports
in nsIDocShellTreeItem aOriginalRequestor);
[noscript,nostdcall,notxpcom] nsIDocument getDocument();
[noscript,nostdcall,notxpcom] nsPIDOMWindow getWindow();
[noscript,nostdcall,notxpcom] nsPIDOMWindowOuter getWindow();
};

Просмотреть файл

@ -6,7 +6,7 @@
#include "nsISupports.idl"
interface nsIDOMWindow;
interface mozIDOMWindowProxy;
interface nsIDOMElement;
%{C++
@ -20,7 +20,7 @@ interface nsIDOMElement;
* 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
{
/**
@ -30,7 +30,7 @@ interface nsILoadContext : nsISupports
* 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.
@ -38,7 +38,7 @@ interface nsILoadContext : nsISupports
* 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

Просмотреть файл

@ -34,7 +34,7 @@ Activity::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
}
nsresult
Activity::Initialize(nsPIDOMWindow* aWindow,
Activity::Initialize(nsPIDOMWindowInner* aWindow,
JSContext* aCx,
const ActivityOptions& aOptions)
{
@ -97,7 +97,7 @@ Activity::~Activity()
}
}
Activity::Activity(nsPIDOMWindow* aWindow)
Activity::Activity(nsPIDOMWindowInner* aWindow)
: DOMRequest(aWindow)
{
}

Просмотреть файл

@ -30,7 +30,7 @@ public:
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;
@ -41,10 +41,10 @@ public:
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);

Просмотреть файл

@ -4,17 +4,17 @@
#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();
};

Просмотреть файл

@ -28,7 +28,7 @@ ArchiveReader::Constructor(const GlobalObject& aGlobal,
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;
@ -46,7 +46,7 @@ ArchiveReader::Constructor(const GlobalObject& aGlobal,
return reader.forget();
}
ArchiveReader::ArchiveReader(Blob& aBlob, nsPIDOMWindow* aWindow,
ArchiveReader::ArchiveReader(Blob& aBlob, nsPIDOMWindowInner* aWindow,
const nsACString& aEncoding)
: mBlobImpl(aBlob.Impl())
, mWindow(aWindow)

Просмотреть файл

@ -43,10 +43,10 @@ public:
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;
}
@ -85,7 +85,7 @@ protected:
RefPtr<BlobImpl> mBlobImpl;
// The window is needed by the requests
nsCOMPtr<nsPIDOMWindow> mWindow;
nsCOMPtr<nsPIDOMWindowInner> mWindow;
// Are we ready to return data?
enum {

Просмотреть файл

@ -49,7 +49,7 @@ ArchiveRequestEvent::Run()
// ArchiveRequest
ArchiveRequest::ArchiveRequest(nsPIDOMWindow* aWindow,
ArchiveRequest::ArchiveRequest(nsPIDOMWindowInner* aWindow,
ArchiveReader* aReader)
: DOMRequest(aWindow),
mArchiveReader(aReader)
@ -257,7 +257,7 @@ ArchiveRequest::GetFilesResult(JSContext* aCx,
// static
already_AddRefed<ArchiveRequest>
ArchiveRequest::Create(nsPIDOMWindow* aOwner,
ArchiveRequest::Create(nsPIDOMWindowInner* aOwner,
ArchiveReader* aReader)
{
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");

Просмотреть файл

@ -34,7 +34,7 @@ public:
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(ArchiveRequest, DOMRequest)
ArchiveRequest(nsPIDOMWindow* aWindow,
ArchiveRequest(nsPIDOMWindowInner* aWindow,
ArchiveReader* aReader);
// nsIDOMEventTarget
@ -52,7 +52,7 @@ public:
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:

Просмотреть файл

@ -64,38 +64,32 @@ NS_IMETHODIMP AudioChannelAgent::GetAudioChannelType(int32_t *aAudioChannelType)
}
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
@ -103,17 +97,17 @@ AudioChannelAgent::FindCorrectWindow(nsIDOMWindow* aWindow)
// 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;
}
@ -152,11 +146,12 @@ AudioChannelAgent::FindCorrectWindow(nsIDOMWindow* aWindow)
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)
{
@ -182,9 +177,8 @@ AudioChannelAgent::InitInternal(nsIDOMWindow* aWindow, int32_t aChannelType,
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))) {

Просмотреть файл

@ -17,7 +17,8 @@
#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 {
@ -36,7 +37,7 @@ public:
void WindowVolumeChanged();
void WindowAudioCaptureChanged(uint64_t aInnerWindowID, bool aCapture);
nsPIDOMWindow* Window() const
nsPIDOMWindowOuter* Window() const
{
return mWindow;
}
@ -51,15 +52,15 @@ private:
// 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;

Просмотреть файл

@ -103,19 +103,6 @@ NotifyChannelActive(uint64_t aWindowID, AudioChannel aAudioChannel,
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()
{
@ -125,7 +112,7 @@ IsParentProcess()
class MediaPlaybackRunnable : public nsRunnable
{
public:
MediaPlaybackRunnable(nsIDOMWindow* aWindow, bool aActive)
MediaPlaybackRunnable(nsPIDOMWindowOuter* aWindow, bool aActive)
: mWindow(aWindow)
, mActive(aActive)
{}
@ -146,7 +133,7 @@ public:
}
private:
nsCOMPtr<nsIDOMWindow> mWindow;
nsCOMPtr<nsPIDOMWindowOuter> mWindow;
bool mActive;
};
@ -367,7 +354,7 @@ AudioChannelService::UnregisterTabParent(TabParent* 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());
@ -385,7 +372,7 @@ AudioChannelService::GetState(nsPIDOMWindow* aWindow, uint32_t aAudioChannel,
*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.
@ -399,7 +386,7 @@ AudioChannelService::GetState(nsPIDOMWindow* aWindow, uint32_t aAudioChannel,
*aVolume *= window->GetAudioVolume();
*aMuted = *aMuted || window->GetAudioMuted();
nsCOMPtr<nsPIDOMWindow> win = window->GetScriptableParent();
nsCOMPtr<nsPIDOMWindowOuter> win = window->GetScriptableParent();
if (window == win) {
break;
}
@ -587,12 +574,12 @@ AudioChannelService::Observe(nsISupports* aSubject, const char* aTopic,
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;
}
@ -612,12 +599,12 @@ AudioChannelService::RefreshAgentsVolumeAndPropagate(AudioChannel aAudioChannel,
}
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;
}
@ -635,7 +622,7 @@ AudioChannelService::RefreshAgentsVolume(nsPIDOMWindow* aWindow)
}
void
AudioChannelService::SetWindowAudioCaptured(nsPIDOMWindow* aWindow,
AudioChannelService::SetWindowAudioCaptured(nsPIDOMWindowOuter* aWindow,
uint64_t aInnerWindowID,
bool aCapture)
{
@ -647,7 +634,7 @@ AudioChannelService::SetWindowAudioCaptured(nsPIDOMWindow* aWindow,
("AudioChannelService, SetWindowAudioCaptured, window = %p, "
"aCapture = %d\n", aWindow, aCapture));
nsCOMPtr<nsPIDOMWindow> topWindow = aWindow->GetScriptableTop();
nsCOMPtr<nsPIDOMWindowOuter> topWindow = aWindow->GetScriptableTop();
if (!topWindow) {
return;
}
@ -740,7 +727,7 @@ AudioChannelService::GetDefaultAudioChannelString(nsAString& aString)
}
AudioChannelService::AudioChannelWindow*
AudioChannelService::GetOrCreateWindowData(nsPIDOMWindow* aWindow)
AudioChannelService::GetOrCreateWindowData(nsPIDOMWindowOuter* aWindow)
{
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(aWindow);
@ -771,7 +758,7 @@ AudioChannelService::GetWindowData(uint64_t aWindowID) const
}
float
AudioChannelService::GetAudioChannelVolume(nsPIDOMWindow* aWindow,
AudioChannelService::GetAudioChannelVolume(nsPIDOMWindowOuter* aWindow,
AudioChannel aAudioChannel)
{
MOZ_ASSERT(NS_IsMainThread());
@ -783,21 +770,19 @@ AudioChannelService::GetAudioChannelVolume(nsPIDOMWindow* aWindow,
}
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)
{
@ -815,21 +800,19 @@ AudioChannelService::SetAudioChannelVolume(nsPIDOMWindow* 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());
@ -841,21 +824,19 @@ AudioChannelService::GetAudioChannelMuted(nsPIDOMWindow* aWindow,
}
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)
{
@ -878,21 +859,19 @@ AudioChannelService::SetAudioChannelMuted(nsPIDOMWindow* 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());
@ -904,15 +883,13 @@ AudioChannelService::IsAudioChannelActive(nsPIDOMWindow* aWindow,
}
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;
}

Просмотреть файл

@ -18,7 +18,7 @@
#include "mozilla/dom/AudioChannelBinding.h"
class nsIRunnable;
class nsPIDOMWindow;
class nsPIDOMWindowOuter;
struct PRLogModuleInfo;
namespace mozilla {
@ -74,21 +74,21 @@ public:
* 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
@ -113,20 +113,19 @@ public:
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)
{
@ -204,7 +203,7 @@ private:
};
AudioChannelWindow*
GetOrCreateWindowData(nsPIDOMWindow* aWindow);
GetOrCreateWindowData(nsPIDOMWindowOuter* aWindow);
AudioChannelWindow*
GetWindowData(uint64_t aWindowID) const;

Просмотреть файл

@ -4,9 +4,9 @@
#include "nsISupports.idl"
interface nsIDOMWindow;
interface mozIDOMWindow;
[uuid(0a451ee0-972e-11e5-a837-0800200c9a66)]
[uuid(15c05894-408e-4798-b527-a8c32d9c5f8c)]
interface nsIAudioChannelAgentCallback : nsISupports
{
/**
@ -80,7 +80,7 @@ interface nsIAudioChannelAgent : nsISupports
* 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);
/**
@ -90,7 +90,7 @@ interface nsIAudioChannelAgent : nsISupports
* 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);
/**

Просмотреть файл

@ -5,25 +5,25 @@
#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);
};

Просмотреть файл

@ -28,10 +28,10 @@ BarProp::~BarProp()
{
}
nsPIDOMWindow*
nsPIDOMWindowInner*
BarProp::GetParentObject() const
{
return mDOMWindow;
return mDOMWindow->AsInner();
}
JSObject*

Просмотреть файл

@ -38,7 +38,7 @@ public:
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;

Просмотреть файл

@ -13,7 +13,7 @@ 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();

Просмотреть файл

@ -65,7 +65,7 @@ Comment::List(FILE* out, int32_t aIndent) const
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;

Просмотреть файл

@ -248,7 +248,7 @@ private:
wp = wp->GetParent();
}
nsPIDOMWindow* window = wp->GetWindow();
nsPIDOMWindowInner* window = wp->GetWindow();
if (!window) {
RunWindowless();
} else {
@ -297,18 +297,18 @@ private:
}
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;
}
@ -347,8 +347,8 @@ protected:
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,
@ -484,8 +484,8 @@ private:
}
void
RunConsole(JSContext* aCx, nsPIDOMWindow* aOuterWindow,
nsPIDOMWindow* aInnerWindow) override
RunConsole(JSContext* aCx, nsPIDOMWindowOuter* aOuterWindow,
nsPIDOMWindowInner* aInnerWindow) override
{
MOZ_ASSERT(NS_IsMainThread());
@ -614,8 +614,8 @@ private:
}
void
RunConsole(JSContext* aCx, nsPIDOMWindow* aOuterWindow,
nsPIDOMWindow* aInnerWindow) override
RunConsole(JSContext* aCx, nsPIDOMWindowOuter* aOuterWindow,
nsPIDOMWindowInner* aInnerWindow) override
{
ClearException ce(aCx);
@ -689,7 +689,7 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(Console)
NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference)
NS_INTERFACE_MAP_END
Console::Console(nsPIDOMWindow* aWindow)
Console::Console(nsPIDOMWindowInner* aWindow)
: mWindow(aWindow)
, mOuterID(0)
, mInnerID(0)
@ -701,7 +701,7 @@ Console::Console(nsPIDOMWindow* aWindow)
// 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();
}
@ -1066,7 +1066,7 @@ Console::Method(JSContext* aCx, MethodName aMethodName,
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();

Просмотреть файл

@ -39,10 +39,10 @@ public:
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;
}
@ -203,7 +203,7 @@ private:
JSObject*
GetOrCreateSandbox(JSContext* aCx, nsIPrincipal* aPrincipal);
nsCOMPtr<nsPIDOMWindow> mWindow;
nsCOMPtr<nsPIDOMWindowInner> mWindow;
nsCOMPtr<nsIConsoleAPIStorage> mStorage;
RefPtr<JSObjectHolder> mSandbox;

Просмотреть файл

@ -20,7 +20,7 @@ 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)

Просмотреть файл

@ -25,7 +25,7 @@ public:
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;

Просмотреть файл

@ -21,12 +21,12 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(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;
@ -36,13 +36,13 @@ DOMError::DOMError(nsPIDOMWindow* aWindow, nsresult aValue)
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)
@ -65,7 +65,7 @@ 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.

Просмотреть файл

@ -11,12 +11,13 @@
#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;
@ -28,7 +29,7 @@ class GlobalObject;
class DOMError : public nsISupports,
public nsWrapperCache
{
nsCOMPtr<nsPIDOMWindow> mWindow;
nsCOMPtr<nsPIDOMWindowInner> mWindow;
nsString mName;
nsString mMessage;
@ -44,16 +45,16 @@ public:
// 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;
}

Просмотреть файл

@ -422,7 +422,7 @@ DOMParser::InitInternal(nsISupports* aOwner, nsIPrincipal* prin,
// 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;
}

Просмотреть файл

@ -23,9 +23,8 @@ 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)
{
@ -240,24 +239,24 @@ DOMRequest::Then(JSContext* aCx, AnyCallback* aResolveCallback,
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;

Просмотреть файл

@ -42,7 +42,7 @@ public:
DOMEventTargetHelper)
// WrapperCache
nsPIDOMWindow* GetParentObject() const
nsPIDOMWindowInner* GetParentObject() const
{
return GetOwner();
}
@ -85,7 +85,7 @@ public:
void FireError(nsresult aError);
void FireDetailedError(DOMError* aError);
explicit DOMRequest(nsPIDOMWindow* aWindow);
explicit DOMRequest(nsPIDOMWindowInner* aWindow);
explicit DOMRequest(nsIGlobalObject* aGlobal);
protected:

Просмотреть файл

@ -116,7 +116,7 @@ DocumentFragment::DumpContent(FILE* out, int32_t aIndent,
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;

Просмотреть файл

@ -2018,11 +2018,11 @@ Element::ShouldBlur(nsIContent *aContent)
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)
@ -3233,7 +3233,6 @@ Element::AttrValueToCORSMode(const nsAttrValue* aValue)
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

Просмотреть файл

@ -12,6 +12,7 @@
#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"
@ -58,7 +59,7 @@ namespace dom {
#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),
@ -280,7 +281,7 @@ EventSource::Constructor(const GlobalObject& aGlobal,
const EventSourceInit& aEventSourceInitDict,
ErrorResult& aRv)
{
nsCOMPtr<nsPIDOMWindow> ownerWindow =
nsCOMPtr<nsPIDOMWindowInner> ownerWindow =
do_QueryInterface(aGlobal.GetAsSupports());
if (!ownerWindow) {
aRv.Throw(NS_ERROR_UNEXPECTED);
@ -307,7 +308,7 @@ EventSource::Observe(nsISupports* aSubject,
return NS_OK;
}
nsCOMPtr<nsPIDOMWindow> window = do_QueryInterface(aSubject);
nsCOMPtr<nsPIDOMWindowInner> window = do_QueryInterface(aSubject);
if (!GetOwner() || window != GetOwner()) {
return NS_OK;
}
@ -564,7 +565,7 @@ EventSource::GetInterface(const nsIID & aIID,
// 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();
}
@ -1112,13 +1113,8 @@ EventSource::DispatchAllMessageEvents()
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,

Просмотреть файл

@ -26,7 +26,7 @@
#include "nsDeque.h"
#include "nsIUnicodeDecoder.h"
class nsPIDOMWindow;
class nsPIDOMWindowInner;
namespace mozilla {
@ -44,7 +44,7 @@ class EventSource final : public DOMEventTargetHelper
, 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)
@ -59,7 +59,7 @@ public:
virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
// WebIDL
nsPIDOMWindow*
nsPIDOMWindowInner*
GetParentObject() const
{
return GetOwner();

Просмотреть файл

@ -213,7 +213,7 @@ Blob::Blob(nsISupports* aParent, BlobImpl* aImpl)
#ifdef DEBUG
{
nsCOMPtr<nsPIDOMWindow> win = do_QueryInterface(aParent);
nsCOMPtr<nsPIDOMWindowInner> win = do_QueryInterface(aParent);
if (win) {
MOZ_ASSERT(win->IsInnerWindow());
}
@ -602,7 +602,7 @@ File::Constructor(const GlobalObject& aGlobal,
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);
@ -630,7 +630,7 @@ File::Constructor(const GlobalObject& aGlobal,
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);

Просмотреть файл

@ -847,7 +847,7 @@ nsIContent::PreHandleEvent(EventChainPreVisitor& aVisitor)
// 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;

Просмотреть файл

@ -358,7 +358,7 @@ MultipartBlobImpl::InitializeChromeFile(Blob& aBlob,
}
void
MultipartBlobImpl::InitializeChromeFile(nsPIDOMWindow* aWindow,
MultipartBlobImpl::InitializeChromeFile(nsPIDOMWindowInner* aWindow,
nsIFile* aFile,
const ChromeFilePropertyBag& aBag,
bool aIsFromNsIFile,
@ -430,7 +430,7 @@ MultipartBlobImpl::InitializeChromeFile(nsPIDOMWindow* aWindow,
}
void
MultipartBlobImpl::InitializeChromeFile(nsPIDOMWindow* aWindow,
MultipartBlobImpl::InitializeChromeFile(nsPIDOMWindowInner* aWindow,
const nsAString& aData,
const ChromeFilePropertyBag& aBag,
ErrorResult& aRv)

Просмотреть файл

@ -64,12 +64,12 @@ public:
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,

Просмотреть файл

@ -151,7 +151,7 @@ Navigator::Init()
"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!");
@ -373,7 +373,7 @@ NS_IMETHODIMP
Navigator::GetUserAgent(nsAString& aUserAgent)
{
nsCOMPtr<nsIURI> codebaseURI;
nsCOMPtr<nsPIDOMWindow> window;
nsCOMPtr<nsPIDOMWindowInner> window;
if (mWindow) {
window = mWindow;
@ -758,7 +758,7 @@ namespace {
class VibrateWindowListener : public nsIDOMEventListener
{
public:
VibrateWindowListener(nsIDOMWindow* aWindow, nsIDocument* aDocument)
VibrateWindowListener(nsPIDOMWindowInner* aWindow, nsIDocument* aDocument)
{
mWindow = do_GetWeakReference(aWindow);
mDocument = do_GetWeakReference(aDocument);
@ -811,7 +811,7 @@ VibrateWindowListener::HandleEvent(nsIDOMEvent* aEvent)
// 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;
@ -927,7 +927,7 @@ Navigator::Vibrate(const nsTArray<uint32_t>& aPattern)
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();
@ -1110,7 +1110,7 @@ Navigator::GetGeolocation(ErrorResult& aRv)
}
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;
@ -1509,7 +1509,7 @@ Navigator::GetDeprecatedBattery(ErrorResult& aRv)
}
/* static */ already_AddRefed<Promise>
Navigator::GetDataStores(nsPIDOMWindow* aWindow,
Navigator::GetDataStores(nsPIDOMWindowInner* aWindow,
const nsAString& aName,
const nsAString& aOwner,
ErrorResult& aRv)
@ -1923,7 +1923,7 @@ Navigator::GetGamepads(nsTArray<RefPtr<Gamepad> >& aGamepads,
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);
}
@ -1959,7 +1959,7 @@ 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)) {
@ -2173,7 +2173,7 @@ Navigator::SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const
}
void
Navigator::SetWindow(nsPIDOMWindow *aInnerWindow)
Navigator::SetWindow(nsPIDOMWindowInner *aInnerWindow)
{
NS_ASSERTION(aInnerWindow->IsInnerWindow(),
"Navigator must get an inner window!");
@ -2207,7 +2207,7 @@ Navigator::CheckPermission(const char* type)
/* static */
bool
Navigator::CheckPermission(nsPIDOMWindow* aWindow, const char* aType)
Navigator::CheckPermission(nsPIDOMWindowInner* aWindow, const char* aType)
{
if (!aWindow) {
return false;
@ -2459,7 +2459,7 @@ Navigator::HasWakeLockSupport(JSContext* /* unused*/, JSObject* /*unused */)
bool
Navigator::HasCameraSupport(JSContext* /* unused */, JSObject* aGlobal)
{
nsCOMPtr<nsPIDOMWindow> win = GetWindowFromGlobal(aGlobal);
nsCOMPtr<nsPIDOMWindowInner> win = GetWindowFromGlobal(aGlobal);
return win && nsDOMCameraManager::CheckPermission(win);
}
@ -2488,7 +2488,7 @@ Navigator::HasWifiManagerSupport(JSContext* /* unused */,
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");
@ -2564,7 +2564,7 @@ Navigator::HasDataStoreSupport(JSContext* aCx, JSObject* aGlobal)
JS::Rooted<JSObject*> global(aCx, aGlobal);
nsCOMPtr<nsPIDOMWindow> win = GetWindowFromGlobal(global);
nsCOMPtr<nsPIDOMWindowInner> win = GetWindowFromGlobal(global);
if (!win) {
return false;
}
@ -2582,7 +2582,7 @@ Navigator::HasDataStoreSupport(JSContext* aCx, JSObject* aGlobal)
bool
Navigator::HasMobileIdSupport(JSContext* aCx, JSObject* aGlobal)
{
nsCOMPtr<nsPIDOMWindow> win = GetWindowFromGlobal(aGlobal);
nsCOMPtr<nsPIDOMWindowInner> win = GetWindowFromGlobal(aGlobal);
if (!win) {
return false;
}
@ -2610,13 +2610,13 @@ 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;
}
@ -2628,8 +2628,8 @@ Navigator::HasPresentationSupport(JSContext* aCx, JSObject* aGlobal)
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) {
@ -2642,7 +2642,8 @@ Navigator::HasPresentationSupport(JSContext* aCx, JSObject* aGlobal)
return false;
}
if (!(top = top->GetCurrentInnerWindow())) {
nsCOMPtr<nsPIDOMWindowInner> topInner;
if (!(topInner = top->GetCurrentInnerWindow())) {
return false;
}
@ -2653,7 +2654,7 @@ Navigator::HasPresentationSupport(JSContext* aCx, JSObject* aGlobal)
}
nsAutoString sessionId;
presentationService->GetExistentSessionIdAtLaunch(top->WindowID(), sessionId);
presentationService->GetExistentSessionIdAtLaunch(topInner->WindowID(), sessionId);
return !sessionId.IsEmpty();
}
@ -2672,10 +2673,10 @@ Navigator::MozE10sEnabled()
}
/* 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();
@ -2788,7 +2789,7 @@ Navigator::ClearUserAgentCache()
}
nsresult
Navigator::GetUserAgent(nsPIDOMWindow* aWindow, nsIURI* aURI,
Navigator::GetUserAgent(nsPIDOMWindowInner* aWindow, nsIURI* aURI,
bool aIsCallerChrome,
nsAString& aUserAgent)
{

Просмотреть файл

@ -25,7 +25,7 @@
class nsPluginArray;
class nsMimeTypeArray;
class nsPIDOMWindow;
class nsPIDOMWindowInner;
class nsIDOMNavigatorSystemMessages;
class nsDOMCameraManager;
class nsDOMDeviceStorage;
@ -116,7 +116,7 @@ class Navigator final : public nsIDOMNavigator
, 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,
@ -127,7 +127,7 @@ public:
static void Init();
void Invalidate();
nsPIDOMWindow *GetWindow() const
nsPIDOMWindowInner *GetWindow() const
{
return mWindow;
}
@ -139,7 +139,7 @@ public:
/**
* 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.
@ -164,7 +164,7 @@ public:
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);
@ -177,7 +177,7 @@ public:
static nsresult GetAppVersion(nsAString& aAppVersion,
bool aUsePrefOverriddenValue);
static nsresult GetUserAgent(nsPIDOMWindow* aWindow,
static nsresult GetUserAgent(nsPIDOMWindowInner* aWindow,
nsIURI* aURI,
bool aIsCallerChrome,
nsAString& aUserAgent);
@ -343,7 +343,7 @@ public:
static bool IsE10sEnabled(JSContext* aCx, JSObject* aGlobal);
nsPIDOMWindow* GetParentObject() const
nsPIDOMWindowInner* GetParentObject() const
{
return GetWindow();
}
@ -352,7 +352,7 @@ public:
// 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>
@ -367,7 +367,7 @@ 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);
@ -406,7 +406,7 @@ private:
nsTArray<nsWeakPtr> mDeviceStorageStores;
RefPtr<time::TimeManager> mTimeManager;
RefPtr<ServiceWorkerContainer> mServiceWorkerContainer;
nsCOMPtr<nsPIDOMWindow> mWindow;
nsCOMPtr<nsPIDOMWindowInner> mWindow;
RefPtr<DeviceStorageAreaListener> mDeviceStorageAreaListener;
RefPtr<Presentation> mPresentation;

Просмотреть файл

@ -46,7 +46,7 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(PerformanceObserver)
NS_INTERFACE_MAP_ENTRY(nsISupports)
NS_INTERFACE_MAP_END
PerformanceObserver::PerformanceObserver(nsPIDOMWindow* aOwner,
PerformanceObserver::PerformanceObserver(nsPIDOMWindowInner* aOwner,
PerformanceObserverCallback& aCb)
: mOwner(aOwner)
, mCallback(&aCb)
@ -78,7 +78,7 @@ PerformanceObserver::Constructor(const GlobalObject& aGlobal,
ErrorResult& aRv)
{
if (NS_IsMainThread()) {
nsCOMPtr<nsPIDOMWindow> ownerWindow =
nsCOMPtr<nsPIDOMWindowInner> ownerWindow =
do_QueryInterface(aGlobal.GetAsSupports());
if (!ownerWindow) {
aRv.Throw(NS_ERROR_FAILURE);

Просмотреть файл

@ -14,7 +14,7 @@
#include "nsTArray.h"
#include "nsWrapperCache.h"
class nsPIDOMWindow;
class nsPIDOMWindowInner;
class PerformanceBase;
namespace mozilla {
@ -43,7 +43,7 @@ public:
PerformanceObserverCallback& aCb,
ErrorResult& aRv);
PerformanceObserver(nsPIDOMWindow* aOwner,
PerformanceObserver(nsPIDOMWindowInner* aOwner,
PerformanceObserverCallback& aCb);
PerformanceObserver(workers::WorkerPrivate* aWorkerPrivate,

Просмотреть файл

@ -11,10 +11,12 @@
#include "mozilla/dom/File.h"
#include "mozilla/dom/FileList.h"
#include "mozilla/dom/FileListBinding.h"
#include "mozilla/dom/MessageEventBinding.h"
#include "mozilla/dom/MessagePort.h"
#include "mozilla/dom/MessagePortBinding.h"
#include "mozilla/dom/PMessagePort.h"
#include "mozilla/dom/StructuredCloneTags.h"
#include "mozilla/dom/UnionConversions.h"
#include "mozilla/EventDispatcher.h"
#include "nsGlobalWindow.h"
#include "nsIPresShell.h"
@ -120,7 +122,7 @@ PostMessageEvent::Run()
ErrorResult rv;
JS::Rooted<JS::Value> messageData(cx);
nsCOMPtr<nsPIDOMWindow> window = targetWindow.get();
nsCOMPtr<nsPIDOMWindowInner> window = targetWindow->AsInner();
Read(window, cx, &messageData, rv);
if (NS_WARN_IF(rv.Failed())) {
@ -128,14 +130,18 @@ PostMessageEvent::Run()
}
// Create the event
nsCOMPtr<mozilla::dom::EventTarget> eventTarget =
do_QueryInterface(static_cast<nsPIDOMWindow*>(targetWindow.get()));
nsCOMPtr<mozilla::dom::EventTarget> eventTarget = do_QueryObject(targetWindow);
RefPtr<MessageEvent> event =
new MessageEvent(eventTarget, nullptr, nullptr);
event->InitMessageEvent(NS_LITERAL_STRING("message"), false /*non-bubbling */,
false /*cancelable */, messageData, mCallerOrigin,
EmptyString(), mSource);
Nullable<WindowProxyOrMessagePort> source;
source.SetValue().SetAsWindowProxy() = mSource ? mSource->AsOuter() : nullptr;
event->InitMessageEvent(nullptr, NS_LITERAL_STRING("message"),
false /*non-bubbling */, false /*cancelable */,
messageData, mCallerOrigin,
EmptyString(), source, nullptr);
nsTArray<RefPtr<MessagePort>> ports = TakeTransferredPorts();
@ -156,7 +162,7 @@ PostMessageEvent::Run()
WidgetEvent* internalEvent = event->GetInternalNSEvent();
nsEventStatus status = nsEventStatus_eIgnore;
EventDispatcher::Dispatch(static_cast<nsPIDOMWindow*>(mTargetWindow),
EventDispatcher::Dispatch(window,
presContext,
internalEvent,
static_cast<dom::Event*>(event.get()),

Просмотреть файл

@ -15,7 +15,6 @@
class nsGlobalWindow;
class nsIPrincipal;
class nsPIDOMWindow;
namespace mozilla {
namespace dom {

Просмотреть файл

@ -63,7 +63,7 @@ OrientationTypeToInternal(OrientationType aOrientation)
}
}
ScreenOrientation::ScreenOrientation(nsPIDOMWindow* aWindow, nsScreen* aScreen)
ScreenOrientation::ScreenOrientation(nsPIDOMWindowInner* aWindow, nsScreen* aScreen)
: DOMEventTargetHelper(aWindow), mScreen(aScreen)
{
MOZ_ASSERT(aWindow);
@ -289,7 +289,7 @@ ScreenOrientation::LockInternal(ScreenOrientationInternal aOrientation, ErrorRes
return nullptr;
}
nsCOMPtr<nsPIDOMWindow> owner = GetOwner();
nsCOMPtr<nsPIDOMWindowInner> owner = GetOwner();
if (NS_WARN_IF(!owner)) {
aRv.Throw(NS_ERROR_UNEXPECTED);
return nullptr;
@ -439,7 +439,7 @@ ScreenOrientation::GetAngle(ErrorResult& aRv) const
ScreenOrientation::LockPermission
ScreenOrientation::GetLockOrientationPermission(bool aCheckSandbox) const
{
nsCOMPtr<nsPIDOMWindow> owner = GetOwner();
nsCOMPtr<nsPIDOMWindowInner> owner = GetOwner();
if (!owner) {
return LOCK_DENIED;
}
@ -478,7 +478,7 @@ ScreenOrientation::GetLockOrientationPermission(bool aCheckSandbox) const
nsIDocument*
ScreenOrientation::GetResponsibleDocument() const
{
nsCOMPtr<nsPIDOMWindow> owner = GetOwner();
nsCOMPtr<nsPIDOMWindowInner> owner = GetOwner();
if (!owner) {
return nullptr;
}
@ -579,7 +579,7 @@ ScreenOrientation::VisibleEventListener::HandleEvent(nsIDOMEvent* aEvent)
return NS_OK;
}
nsGlobalWindow* win = static_cast<nsGlobalWindow*>(doc->GetInnerWindow());
auto* win = nsGlobalWindow::Cast(doc->GetInnerWindow());
if (!win) {
return NS_OK;
}

Просмотреть файл

@ -43,7 +43,7 @@ public:
IMPL_EVENT_HANDLER(change)
ScreenOrientation(nsPIDOMWindow* aWindow, nsScreen* aScreen);
ScreenOrientation(nsPIDOMWindowInner* aWindow, nsScreen* aScreen);
already_AddRefed<Promise> Lock(OrientationLockType aOrientation,
ErrorResult& aRv);

Просмотреть файл

@ -192,13 +192,15 @@ nsIDocument*
GetEntryDocument()
{
nsIGlobalObject* global = GetEntryGlobal();
nsCOMPtr<nsPIDOMWindow> entryWin = do_QueryInterface(global);
nsCOMPtr<nsPIDOMWindowInner> entryWin = do_QueryInterface(global);
// If our entry global isn't a window, see if it's an addon scope associated
// with a window. If it is, the caller almost certainly wants that rather
// than null.
if (!entryWin && global) {
entryWin = xpc::AddonWindowOrNull(global->GetGlobalJSObject());
if (auto* win = xpc::AddonWindowOrNull(global->GetGlobalJSObject())) {
entryWin = win->AsInner();
}
}
return entryWin ? entryWin->GetExtantDoc() : nullptr;
@ -419,15 +421,15 @@ AutoJSAPI::InitWithLegacyErrorReporting(nsIGlobalObject* aGlobalObject)
}
bool
AutoJSAPI::Init(nsPIDOMWindow* aWindow, JSContext* aCx)
AutoJSAPI::Init(nsPIDOMWindowInner* aWindow, JSContext* aCx)
{
return Init(static_cast<nsGlobalWindow*>(aWindow), aCx);
return Init(nsGlobalWindow::Cast(aWindow), aCx);
}
bool
AutoJSAPI::Init(nsPIDOMWindow* aWindow)
AutoJSAPI::Init(nsPIDOMWindowInner* aWindow)
{
return Init(static_cast<nsGlobalWindow*>(aWindow));
return Init(nsGlobalWindow::Cast(aWindow));
}
bool
@ -443,9 +445,9 @@ AutoJSAPI::Init(nsGlobalWindow* aWindow)
}
bool
AutoJSAPI::InitWithLegacyErrorReporting(nsPIDOMWindow* aWindow)
AutoJSAPI::InitWithLegacyErrorReporting(nsPIDOMWindowInner* aWindow)
{
return InitWithLegacyErrorReporting(static_cast<nsGlobalWindow*>(aWindow));
return InitWithLegacyErrorReporting(nsGlobalWindow::Cast(aWindow));
}
bool
@ -467,9 +469,9 @@ WarningOnlyErrorReporter(JSContext* aCx, const char* aMessage, JSErrorReport* aR
MOZ_ASSERT(JSREPORT_IS_WARNING(aRep->flags));
RefPtr<xpc::ErrorReport> xpcReport = new xpc::ErrorReport();
nsPIDOMWindow* win = xpc::CurrentWindowOrNull(aCx);
nsGlobalWindow* win = xpc::CurrentWindowOrNull(aCx);
xpcReport->Init(aRep, aMessage, nsContentUtils::IsCallerChrome(),
win ? win->WindowID() : 0);
win ? win->AsInner()->WindowID() : 0);
xpcReport->LogToConsole();
}
@ -513,12 +515,13 @@ AutoJSAPI::ReportException()
if (StealException(&exn) && jsReport.init(cx(), exn)) {
if (mIsMainThread) {
RefPtr<xpc::ErrorReport> xpcReport = new xpc::ErrorReport();
nsCOMPtr<nsPIDOMWindow> win = xpc::WindowGlobalOrNull(errorGlobal);
RefPtr<nsGlobalWindow> win = xpc::WindowGlobalOrNull(errorGlobal);
nsPIDOMWindowInner* inner = win ? win->AsInner() : nullptr;
xpcReport->Init(jsReport.report(), jsReport.message(),
nsContentUtils::IsCallerChrome(),
win ? win->WindowID() : 0);
if (win) {
DispatchScriptErrorEvent(win, JS_GetRuntime(cx()), xpcReport, exn);
inner ? inner->WindowID() : 0);
if (inner) {
DispatchScriptErrorEvent(inner, JS_GetRuntime(cx()), xpcReport, exn);
} else {
xpcReport->LogToConsole();
}
@ -612,7 +615,7 @@ AutoEntryScript::DocshellEntryMonitor::Entry(JSContext* aCx, JSFunction* aFuncti
rootedScript = aScript;
}
nsCOMPtr<nsPIDOMWindow> window =
nsCOMPtr<nsPIDOMWindowInner> window =
do_QueryInterface(xpc::NativeGlobal(JS::CurrentGlobalOrNull(aCx)));
if (!window || !window->GetDocShell() ||
!window->GetDocShell()->GetRecordProfileTimelineMarkers()) {
@ -659,7 +662,7 @@ AutoEntryScript::DocshellEntryMonitor::Entry(JSContext* aCx, JSFunction* aFuncti
void
AutoEntryScript::DocshellEntryMonitor::Exit(JSContext* aCx)
{
nsCOMPtr<nsPIDOMWindow> window =
nsCOMPtr<nsPIDOMWindowInner> window =
do_QueryInterface(xpc::NativeGlobal(JS::CurrentGlobalOrNull(aCx)));
// Not really worth checking GetRecordProfileTimelineMarkers here.
if (window && window->GetDocShell()) {

Просмотреть файл

@ -18,7 +18,7 @@
#include "jsapi.h"
#include "js/Debug.h"
class nsPIDOMWindow;
class nsPIDOMWindowInner;
class nsGlobalWindow;
class nsIScriptContext;
class nsIDocument;
@ -251,13 +251,13 @@ public:
// Convenience functions to take an nsPIDOMWindow* or nsGlobalWindow*,
// when it is more easily available than an nsIGlobalObject.
bool Init(nsPIDOMWindow* aWindow);
bool Init(nsPIDOMWindow* aWindow, JSContext* aCx);
bool Init(nsPIDOMWindowInner* aWindow);
bool Init(nsPIDOMWindowInner* aWindow, JSContext* aCx);
bool Init(nsGlobalWindow* aWindow);
bool Init(nsGlobalWindow* aWindow, JSContext* aCx);
bool InitWithLegacyErrorReporting(nsPIDOMWindow* aWindow);
bool InitWithLegacyErrorReporting(nsPIDOMWindowInner* aWindow);
bool InitWithLegacyErrorReporting(nsGlobalWindow* aWindow);
JSContext* cx() const {

Просмотреть файл

@ -1041,7 +1041,7 @@ StructuredCloneHolder::CustomReadTransferHandler(JSContext* aCx,
if (aTag == SCTAG_DOM_MAP_MESSAGEPORT) {
// This can be null.
nsCOMPtr<nsPIDOMWindow> window = do_QueryInterface(mParent);
nsCOMPtr<nsPIDOMWindowInner> window = do_QueryInterface(mParent);
MOZ_ASSERT(aExtraData < mPortIdentifiers.Length());
const MessagePortIdentifier& portIdentifier = mPortIdentifiers[aExtraData];

Просмотреть файл

@ -25,7 +25,7 @@ Text::SplitText(uint32_t aOffset, ErrorResult& rv)
Text::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;

Просмотреть файл

@ -97,7 +97,7 @@ TextInputProcessor::GetHasComposition(bool* aHasComposition)
NS_IMETHODIMP
TextInputProcessor::BeginInputTransaction(
nsIDOMWindow* aWindow,
mozIDOMWindow* aWindow,
nsITextInputProcessorCallback* aCallback,
bool* aSucceeded)
{
@ -112,7 +112,7 @@ TextInputProcessor::BeginInputTransaction(
NS_IMETHODIMP
TextInputProcessor::BeginInputTransactionForTests(
nsIDOMWindow* aWindow,
mozIDOMWindow* aWindow,
nsITextInputProcessorCallback* aCallback,
uint8_t aOptionalArgc,
bool* aSucceeded)
@ -126,7 +126,7 @@ TextInputProcessor::BeginInputTransactionForTests(
nsresult
TextInputProcessor::BeginInputTransactionInternal(
nsIDOMWindow* aWindow,
mozIDOMWindow* aWindow,
nsITextInputProcessorCallback* aCallback,
bool aForTests,
bool& aSucceeded)
@ -135,7 +135,7 @@ TextInputProcessor::BeginInputTransactionInternal(
if (NS_WARN_IF(!aWindow)) {
return NS_ERROR_INVALID_ARG;
}
nsCOMPtr<nsPIDOMWindow> pWindow(do_QueryInterface(aWindow));
nsCOMPtr<nsPIDOMWindowInner> pWindow = nsPIDOMWindowInner::From(aWindow);
if (NS_WARN_IF(!pWindow)) {
return NS_ERROR_INVALID_ARG;
}

Просмотреть файл

@ -42,7 +42,7 @@ protected:
private:
bool IsComposing() const;
nsresult BeginInputTransactionInternal(
nsIDOMWindow* aWindow,
mozIDOMWindow* aWindow,
nsITextInputProcessorCallback* aCallback,
bool aForTests,
bool& aSucceeded);

Просмотреть файл

@ -64,7 +64,7 @@ ThirdPartyUtil::IsThirdPartyInternal(const nsCString& aFirstDomain,
// Get the URI associated with a window.
NS_IMETHODIMP
ThirdPartyUtil::GetURIFromWindow(nsIDOMWindow* aWin, nsIURI** result)
ThirdPartyUtil::GetURIFromWindow(mozIDOMWindowProxy* aWin, nsIURI** result)
{
nsresult rv;
nsCOMPtr<nsIScriptObjectPrincipal> scriptObjPrin = do_QueryInterface(aWin);
@ -108,7 +108,7 @@ ThirdPartyUtil::IsThirdPartyURI(nsIURI* aFirstURI,
// Determine if any URI of the window hierarchy of aWindow is foreign with
// respect to aSecondURI. See docs for mozIThirdPartyUtil.
NS_IMETHODIMP
ThirdPartyUtil::IsThirdPartyWindow(nsIDOMWindow* aWindow,
ThirdPartyUtil::IsThirdPartyWindow(mozIDOMWindowProxy* aWindow,
nsIURI* aURI,
bool* aResult)
{
@ -140,7 +140,7 @@ ThirdPartyUtil::IsThirdPartyWindow(nsIDOMWindow* aWindow,
}
}
nsCOMPtr<nsPIDOMWindow> current = do_QueryInterface(aWindow), parent;
nsCOMPtr<nsPIDOMWindowOuter> current = nsPIDOMWindowOuter::From(aWindow), parent;
nsCOMPtr<nsIURI> parentURI;
do {
// We use GetScriptableParent rather than GetParent because we consider
@ -250,7 +250,7 @@ ThirdPartyUtil::IsThirdPartyChannel(nsIChannel* aChannel,
}
NS_IMETHODIMP
ThirdPartyUtil::GetTopWindowForChannel(nsIChannel* aChannel, nsIDOMWindow** aWin)
ThirdPartyUtil::GetTopWindowForChannel(nsIChannel* aChannel, mozIDOMWindowProxy** aWin)
{
NS_ENSURE_ARG(aWin);
@ -261,14 +261,13 @@ ThirdPartyUtil::GetTopWindowForChannel(nsIChannel* aChannel, nsIDOMWindow** aWin
return NS_ERROR_INVALID_ARG;
}
nsCOMPtr<nsIDOMWindow> window;
nsCOMPtr<mozIDOMWindowProxy> window;
ctx->GetAssociatedWindow(getter_AddRefs(window));
nsCOMPtr<nsPIDOMWindow> top = do_QueryInterface(window);
if (!top) {
if (!window) {
return NS_ERROR_INVALID_ARG;
}
top = top->GetTop();
nsCOMPtr<nsPIDOMWindowOuter> top = nsPIDOMWindowOuter::From(window)->GetTop();
top.forget(aWin);
return NS_OK;
}

Просмотреть файл

@ -14,6 +14,7 @@
#include "mozilla/net/WebSocketChannel.h"
#include "mozilla/dom/File.h"
#include "mozilla/dom/MessageEvent.h"
#include "mozilla/dom/MessageEventBinding.h"
#include "mozilla/dom/nsCSPContext.h"
#include "mozilla/dom/nsCSPUtils.h"
#include "mozilla/dom/ScriptSettings.h"
@ -919,7 +920,7 @@ WebSocketImpl::GetInterface(const nsIID& aIID, void** aResult)
do_GetService(NS_WINDOWWATCHER_CONTRACTID, &rv);
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsPIDOMWindow> outerWindow = doc->GetWindow();
nsCOMPtr<nsPIDOMWindowOuter> outerWindow = doc->GetWindow();
return wwatch->GetPrompt(outerWindow, aIID, aResult);
}
@ -930,7 +931,7 @@ WebSocketImpl::GetInterface(const nsIID& aIID, void** aResult)
// WebSocket
////////////////////////////////////////////////////////////////////////////////
WebSocket::WebSocket(nsPIDOMWindow* aOwnerWindow)
WebSocket::WebSocket(nsPIDOMWindowInner* aOwnerWindow)
: DOMEventTargetHelper(aOwnerWindow)
, mIsMainThread(true)
, mKeepingAlive(false)
@ -1023,7 +1024,7 @@ public:
wp = wp->GetParent();
}
nsPIDOMWindow* window = wp->GetWindow();
nsPIDOMWindowInner* window = wp->GetWindow();
if (window) {
return InitWithWindow(window);
}
@ -1032,7 +1033,7 @@ public:
}
protected:
virtual bool InitWithWindow(nsPIDOMWindow* aWindow) = 0;
virtual bool InitWithWindow(nsPIDOMWindowInner* aWindow) = 0;
virtual bool InitWindowless(WorkerPrivate* aTopLevelWorkerPrivate) = 0;
};
@ -1060,7 +1061,7 @@ public:
}
protected:
virtual bool InitWithWindow(nsPIDOMWindow* aWindow) override
virtual bool InitWithWindow(nsPIDOMWindowInner* aWindow) override
{
AutoJSAPI jsapi;
if (NS_WARN_IF(!jsapi.Init(aWindow))) {
@ -1123,7 +1124,7 @@ public:
}
protected:
virtual bool InitWithWindow(nsPIDOMWindow* aWindow) override
virtual bool InitWithWindow(nsPIDOMWindowInner* aWindow) override
{
AssertIsOnMainThread();
MOZ_ASSERT(aWindow);
@ -1140,20 +1141,15 @@ protected:
return true;
}
if (aWindow->IsOuterWindow()) {
aWindow = aWindow->GetCurrentInnerWindow();
}
MOZ_ASSERT(aWindow);
uint64_t windowID = 0;
nsCOMPtr<nsPIDOMWindow> topWindow = aWindow->GetScriptableTop();
nsCOMPtr<nsPIDOMWindowOuter> topWindow = aWindow->GetScriptableTop();
nsCOMPtr<nsPIDOMWindowInner> topInner;
if (topWindow) {
topWindow = topWindow->GetCurrentInnerWindow();
topInner = topWindow->GetCurrentInnerWindow();
}
if (topWindow) {
windowID = topWindow->WindowID();
if (topInner) {
windowID = topInner->WindowID();
}
mImpl->AsyncOpen(principal, windowID, mRv);
@ -1185,7 +1181,7 @@ WebSocket::Constructor(const GlobalObject& aGlobal,
ErrorResult& aRv)
{
nsCOMPtr<nsIPrincipal> principal;
nsCOMPtr<nsPIDOMWindow> ownerWindow;
nsCOMPtr<nsPIDOMWindowInner> ownerWindow;
if (NS_IsMainThread()) {
nsCOMPtr<nsIScriptObjectPrincipal> scriptPrincipal =
@ -1330,16 +1326,17 @@ WebSocket::Constructor(const GlobalObject& aGlobal,
if (NS_IsMainThread()) {
MOZ_ASSERT(principal);
nsPIDOMWindow* outerWindow = ownerWindow->GetOuterWindow();
nsPIDOMWindowOuter* outerWindow = ownerWindow->GetOuterWindow();
uint64_t windowID = 0;
nsCOMPtr<nsPIDOMWindow> topWindow = outerWindow->GetScriptableTop();
nsCOMPtr<nsPIDOMWindowOuter> topWindow = outerWindow->GetScriptableTop();
nsCOMPtr<nsPIDOMWindowInner> topInner;
if (topWindow) {
topWindow = topWindow->GetCurrentInnerWindow();
topInner = topWindow->GetCurrentInnerWindow();
}
if (topWindow) {
windowID = topWindow->WindowID();
if (topInner) {
windowID = topInner->WindowID();
}
webSocket->mImpl->AsyncOpen(principal, windowID, aRv);
@ -1888,11 +1885,9 @@ WebSocket::CreateAndDispatchMessageEvent(JSContext* aCx,
RefPtr<MessageEvent> event = NS_NewDOMMessageEvent(this, nullptr, nullptr);
rv = event->InitMessageEvent(NS_LITERAL_STRING("message"), false, false,
jsData, mImpl->mUTF16Origin, EmptyString(),
nullptr);
NS_ENSURE_SUCCESS(rv, rv);
event->InitMessageEvent(nullptr, NS_LITERAL_STRING("message"), false, false,
jsData, mImpl->mUTF16Origin, EmptyString(), nullptr,
nullptr);
event->SetTrusted(true);
return DispatchDOMEvent(nullptr, static_cast<Event*>(event), nullptr,
@ -2459,7 +2454,7 @@ WebSocketImpl::Observe(nsISupports* aSubject,
return NS_OK;
}
nsCOMPtr<nsPIDOMWindow> window = do_QueryInterface(aSubject);
nsCOMPtr<nsPIDOMWindowInner> window = do_QueryInterface(aSubject);
if (!mWebSocket->GetOwner() || window != mWebSocket->GetOwner()) {
return NS_OK;
}
@ -2629,7 +2624,7 @@ WebSocketImpl::GetLoadGroup(nsILoadGroup** aLoadGroup)
wp = wp->GetParent();
}
nsPIDOMWindow* window = wp->GetWindow();
nsPIDOMWindowInner* window = wp->GetWindow();
if (!window) {
return NS_OK;
}

Просмотреть файл

@ -56,7 +56,7 @@ public:
virtual void DisconnectFromOwner() override;
// nsWrapperCache
nsPIDOMWindow* GetParentObject() { return GetOwner(); }
nsPIDOMWindowInner* GetParentObject() { return GetOwner(); }
virtual JSObject* WrapObject(JSContext* cx, JS::Handle<JSObject*> aGivenProto) override;
@ -129,7 +129,7 @@ public: // WebIDL interface:
ErrorResult& aRv);
private: // constructor && distructor
explicit WebSocket(nsPIDOMWindow* aOwnerWindow);
explicit WebSocket(nsPIDOMWindowInner* aOwnerWindow);
virtual ~WebSocket();
void SetReadyState(uint16_t aReadyState);

Просмотреть файл

@ -18,11 +18,9 @@ namespace mozilla {
namespace dom {
static bool
ShouldExposeChildWindow(nsString& aNameBeingResolved, nsIDOMWindow *aChild)
ShouldExposeChildWindow(nsString& aNameBeingResolved, nsPIDOMWindowOuter* aChild)
{
nsCOMPtr<nsPIDOMWindow> piWin = do_QueryInterface(aChild);
NS_ENSURE_TRUE(piWin, false);
Element* e = piWin->GetFrameElementInternal();
Element* e = aChild->GetFrameElementInternal();
if (e && e->IsInShadowTree()) {
return false;
}
@ -105,7 +103,7 @@ WindowNamedPropertiesHandler::getOwnPropDescriptor(JSContext* aCx,
JS::Rooted<JSObject*> global(aCx, JS_GetGlobalForObject(aCx, aProxy));
nsGlobalWindow* win = xpc::WindowOrNull(global);
if (win->Length() > 0) {
nsCOMPtr<nsIDOMWindow> childWin = win->GetChildWindow(str);
nsCOMPtr<nsPIDOMWindowOuter> childWin = win->GetChildWindow(str);
if (childWin && ShouldExposeChildWindow(str, childWin)) {
// We found a subframe of the right name. Shadowing via |var foo| in
// global scope is still allowed, since |var| only looks up |own|
@ -182,7 +180,7 @@ WindowNamedPropertiesHandler::ownPropNames(JSContext* aCx,
// We iterate backwards so we can remove things from the list easily.
for (size_t i = names.Length(); i > 0; ) {
--i; // Now we're pointing at the next name we want to look at
nsIDOMWindow* childWin = win->GetChildWindow(names[i]);
nsCOMPtr<nsPIDOMWindowOuter> childWin = win->GetChildWindow(names[i]);
if (!childWin || !ShouldExposeChildWindow(names[i], childWin)) {
names.RemoveElementAt(i);
}

Просмотреть файл

@ -39,7 +39,7 @@ WindowOrientationObserver::Notify(
const mozilla::hal::ScreenConfiguration& aConfiguration)
{
uint16_t currentAngle = aConfiguration.angle();
if (mAngle != currentAngle && mWindow->IsCurrentInnerWindow()) {
if (mAngle != currentAngle && mWindow->AsInner()->IsCurrentInnerWindow()) {
mAngle = currentAngle;
mWindow->GetOuterWindow()->DispatchCustomEvent(NS_LITERAL_STRING("orientationchange"));
}

Просмотреть файл

@ -7,6 +7,7 @@
TEST_DIRS += ['test']
XPIDL_SOURCES += [
'mozIDOMWindow.idl',
'nsIConsoleAPIStorage.idl',
'nsIContentPolicy.idl',
'nsIContentPolicyBase.idl',
@ -114,6 +115,7 @@ EXPORTS += [
'nsNodeUtils.h',
'nsPerformance.h',
'nsPIDOMWindow.h',
'nsPIDOMWindowInlines.h',
'nsPIWindowRoot.h',
'nsPropertyTable.h',
'nsRange.h',

Просмотреть файл

@ -0,0 +1,16 @@
/* 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"
/*
* Placeholder interfaces to allow passing inner/outer windows through XPIDL.
*/
[scriptable, builtinclass, uuid(75fbabd6-7a2e-4787-aa33-449a33512135)]
interface mozIDOMWindow : nsISupports
{};
[scriptable, builtinclass, uuid(53ca090c-e739-48b9-8911-208c72f9191e)]
interface mozIDOMWindowProxy : nsISupports
{};

Просмотреть файл

@ -215,12 +215,10 @@ MarkContentViewer(nsIContentViewer* aViewer, bool aCleanupJS,
}
}
if (doc) {
nsPIDOMWindow* inner = doc->GetInnerWindow();
if (inner) {
if (nsPIDOMWindowInner* inner = doc->GetInnerWindow()) {
inner->MarkUncollectableForCCGeneration(nsCCUncollectableMarker::sGeneration);
}
nsPIDOMWindow* outer = doc->GetWindow();
if (outer) {
if (nsPIDOMWindowOuter* outer = doc->GetWindow()) {
outer->MarkUncollectableForCCGeneration(nsCCUncollectableMarker::sGeneration);
}
}
@ -300,8 +298,7 @@ MarkWindowList(nsISimpleEnumerator* aWindowList, bool aCleanupJS,
nsCOMPtr<nsISupports> iter;
while (NS_SUCCEEDED(aWindowList->GetNext(getter_AddRefs(iter))) &&
iter) {
nsCOMPtr<nsPIDOMWindow> window = do_QueryInterface(iter);
if (window) {
if (nsCOMPtr<nsPIDOMWindowOuter> window = do_QueryInterface(iter)) {
nsCOMPtr<nsIDocShell> rootDocShell = window->GetDocShell();
MarkDocShell(rootDocShell, aCleanupJS, aPrepareForCC);

Просмотреть файл

@ -64,7 +64,7 @@ using namespace mozilla::dom;
class MOZ_STACK_CLASS DragDataProducer
{
public:
DragDataProducer(nsPIDOMWindow* aWindow,
DragDataProducer(nsPIDOMWindowOuter* aWindow,
nsIContent* aTarget,
nsIContent* aSelectionTargetNode,
bool aIsAltKeyPressed);
@ -90,7 +90,7 @@ private:
static void CreateLinkText(const nsAString& inURL, const nsAString & inText,
nsAString& outLinkText);
nsCOMPtr<nsPIDOMWindow> mWindow;
nsCOMPtr<nsPIDOMWindowOuter> mWindow;
nsCOMPtr<nsIContent> mTarget;
nsCOMPtr<nsIContent> mSelectionTargetNode;
bool mIsAltKeyPressed;
@ -110,7 +110,7 @@ private:
nsresult
nsContentAreaDragDrop::GetDragData(nsPIDOMWindow* aWindow,
nsContentAreaDragDrop::GetDragData(nsPIDOMWindowOuter* aWindow,
nsIContent* aTarget,
nsIContent* aSelectionTargetNode,
bool aIsAltKeyPressed,
@ -252,7 +252,7 @@ nsContentAreaDragDropDataProvider::GetFlavorData(nsITransferable *aTransferable,
return rv;
}
DragDataProducer::DragDataProducer(nsPIDOMWindow* aWindow,
DragDataProducer::DragDataProducer(nsPIDOMWindowOuter* aWindow,
nsIContent* aTarget,
nsIContent* aSelectionTargetNode,
bool aIsAltKeyPressed)

Просмотреть файл

@ -14,7 +14,7 @@
#include "nsIDOMEventListener.h"
#include "nsITransferable.h"
class nsPIDOMWindow;
class nsPIDOMWindowOuter;
class nsISelection;
class nsITransferable;
class nsIContent;
@ -51,7 +51,7 @@ public:
* aDragNode - [out] the link, image or area being dragged, or null if the
* drag occurred on another element.
*/
static nsresult GetDragData(nsPIDOMWindow* aWindow,
static nsresult GetDragData(nsPIDOMWindowOuter* aWindow,
nsIContent* aTarget,
nsIContent* aSelectionTargetNode,
bool aIsAltKeyPressed,

Просмотреть файл

@ -46,7 +46,7 @@ public:
NS_DECL_ISUPPORTS
NS_DECL_NSIDOMEVENTLISTENER
explicit VisibilityChangeListener(nsPIDOMWindow* aWindow);
explicit VisibilityChangeListener(nsPIDOMWindowInner* aWindow);
void RemoveListener();
void SetCallback(nsIContentPermissionRequestCallback* aCallback);
@ -61,7 +61,7 @@ private:
NS_IMPL_ISUPPORTS(VisibilityChangeListener, nsIDOMEventListener)
VisibilityChangeListener::VisibilityChangeListener(nsPIDOMWindow* aWindow)
VisibilityChangeListener::VisibilityChangeListener(nsPIDOMWindowInner* aWindow)
{
MOZ_ASSERT(aWindow);
@ -99,7 +99,7 @@ VisibilityChangeListener::HandleEvent(nsIDOMEvent* aEvent)
void
VisibilityChangeListener::RemoveListener()
{
nsCOMPtr<nsPIDOMWindow> window = do_QueryReferent(mWindow);
nsCOMPtr<nsPIDOMWindowInner> window = do_QueryReferent(mWindow);
if (!window) {
return;
}
@ -365,7 +365,8 @@ nsContentPermissionUtils::CreateContentPermissionRequestParent(const nsTArray<Pe
}
/* static */ nsresult
nsContentPermissionUtils::AskPermission(nsIContentPermissionRequest* aRequest, nsPIDOMWindow* aWindow)
nsContentPermissionUtils::AskPermission(nsIContentPermissionRequest* aRequest,
nsPIDOMWindowInner* aWindow)
{
MOZ_ASSERT(!aWindow || aWindow->IsInnerWindow());
NS_ENSURE_STATE(aWindow && aWindow->IsCurrentInnerWindow());
@ -463,7 +464,7 @@ nsContentPermissionUtils::NotifyRemoveContentPermissionRequestChild(
NS_IMPL_ISUPPORTS(nsContentPermissionRequester, nsIContentPermissionRequester)
nsContentPermissionRequester::nsContentPermissionRequester(nsPIDOMWindow* aWindow)
nsContentPermissionRequester::nsContentPermissionRequester(nsPIDOMWindowInner* aWindow)
: mWindow(do_GetWeakReference(aWindow))
, mListener(new VisibilityChangeListener(aWindow))
{
@ -480,7 +481,7 @@ nsContentPermissionRequester::GetVisibility(nsIContentPermissionRequestCallback*
{
NS_ENSURE_ARG_POINTER(aCallback);
nsCOMPtr<nsPIDOMWindow> window = do_QueryReferent(mWindow);
nsCOMPtr<nsPIDOMWindowInner> window = do_QueryReferent(mWindow);
if (!window) {
return NS_ERROR_FAILURE;
}
@ -620,7 +621,7 @@ nsContentPermissionRequestProxy::GetTypes(nsIArray** aTypes)
}
NS_IMETHODIMP
nsContentPermissionRequestProxy::GetWindow(nsIDOMWindow * *aRequestingWindow)
nsContentPermissionRequestProxy::GetWindow(mozIDOMWindow * *aRequestingWindow)
{
NS_ENSURE_ARG_POINTER(aRequestingWindow);
*aRequestingWindow = nullptr; // ipc doesn't have a window
@ -765,7 +766,7 @@ NS_IMPL_ISUPPORTS(RemotePermissionRequest, nsIContentPermissionRequestCallback);
RemotePermissionRequest::RemotePermissionRequest(
nsIContentPermissionRequest* aRequest,
nsPIDOMWindow* aWindow)
nsPIDOMWindowInner* aWindow)
: mRequest(aRequest)
, mWindow(aWindow)
, mIPCOpen(false)

Просмотреть файл

@ -19,7 +19,7 @@
// https://bugzilla.mozilla.org/show_bug.cgi?id=932421#c3 for why.
#undef LoadImage
class nsPIDOMWindow;
class nsPIDOMWindowInner;
class nsContentPermissionRequestProxy;
class VisibilityChangeListener;
@ -83,7 +83,8 @@ public:
const TabId& aTabId);
static nsresult
AskPermission(nsIContentPermissionRequest* aRequest, nsPIDOMWindow* aWindow);
AskPermission(nsIContentPermissionRequest* aRequest,
nsPIDOMWindowInner* aWindow);
static nsTArray<PContentPermissionRequestParent*>
GetContentPermissionRequestParentById(const TabId& aTabId);
@ -104,7 +105,7 @@ public:
NS_DECL_ISUPPORTS
NS_DECL_NSICONTENTPERMISSIONREQUESTER
explicit nsContentPermissionRequester(nsPIDOMWindow* aWindow);
explicit nsContentPermissionRequester(nsPIDOMWindowInner* aWindow);
private:
virtual ~nsContentPermissionRequester();
@ -173,7 +174,7 @@ public:
NS_DECL_NSICONTENTPERMISSIONREQUESTCALLBACK
RemotePermissionRequest(nsIContentPermissionRequest* aRequest,
nsPIDOMWindow* aWindow);
nsPIDOMWindowInner* aWindow);
// It will be called when prompt dismissed.
virtual bool RecvNotifyResult(const bool &aAllow,
@ -204,7 +205,7 @@ private:
void DoCancel();
nsCOMPtr<nsIContentPermissionRequest> mRequest;
nsCOMPtr<nsPIDOMWindow> mWindow;
nsCOMPtr<nsPIDOMWindowInner> mWindow;
bool mIPCOpen;
bool mDestroyed;
RefPtr<VisibilityChangeListener> mListener;

Просмотреть файл

@ -150,7 +150,7 @@ nsContentPolicy::CheckPolicy(CPMethod policyMethod,
nsCOMPtr<nsIDOMElement> topFrameElement;
bool isTopLevel = true;
nsCOMPtr<nsPIDOMWindow> window;
nsCOMPtr<nsPIDOMWindowOuter> window;
if (nsCOMPtr<nsINode> node = do_QueryInterface(requestingContext)) {
window = node->OwnerDoc()->GetWindow();
} else {
@ -165,7 +165,7 @@ nsContentPolicy::CheckPolicy(CPMethod policyMethod,
MOZ_ASSERT(window->IsOuterWindow());
if (topFrameElement) {
nsCOMPtr<nsPIDOMWindow> topWindow = window->GetScriptableTop();
nsCOMPtr<nsPIDOMWindowOuter> topWindow = window->GetScriptableTop();
isTopLevel = topWindow == window;
} else {
// If we don't have a top frame element, then requestingContext is

Просмотреть файл

@ -184,7 +184,7 @@ NS_CP_ContentTypeName(uint32_t contentType)
*decision = nsIContentPolicy::ACCEPT; \
nsCOMPtr<nsINode> n = do_QueryInterface(context); \
if (!n) { \
nsCOMPtr<nsPIDOMWindow> win = do_QueryInterface(context); \
nsCOMPtr<nsPIDOMWindowOuter> win = do_QueryInterface(context);\
n = win ? win->GetExtantDoc() : nullptr; \
} \
if (n) { \
@ -299,7 +299,7 @@ NS_CP_GetDocShellFromContext(nsISupports *aContext)
return nullptr;
}
nsCOMPtr<nsPIDOMWindow> window = do_QueryInterface(aContext);
nsCOMPtr<nsPIDOMWindowOuter> window = do_QueryInterface(aContext);
if (!window) {
// our context might be a document (which also QIs to nsIDOMNode), so

Просмотреть файл

@ -1125,7 +1125,7 @@ nsContentSink::ProcessOfflineManifest(const nsAString& aManifestSpec)
// Only continue if the document has permission to use offline APIs or
// when preferences indicate to permit it automatically.
if (!nsContentUtils::OfflineAppAllowed(mDocument->NodePrincipal()) &&
!nsContentUtils::MaybeAllowOfflineAppByDefault(mDocument->NodePrincipal(), mDocument->GetWindow()) &&
!nsContentUtils::MaybeAllowOfflineAppByDefault(mDocument->NodePrincipal()) &&
!nsContentUtils::OfflineAppAllowed(mDocument->NodePrincipal())) {
return;
}

Просмотреть файл

@ -1834,8 +1834,7 @@ nsContentUtils::OfflineAppAllowed(nsIPrincipal *aPrincipal)
}
bool
nsContentUtils::MaybeAllowOfflineAppByDefault(nsIPrincipal *aPrincipal,
nsIDOMWindow *aWindow)
nsContentUtils::MaybeAllowOfflineAppByDefault(nsIPrincipal *aPrincipal)
{
if (!Preferences::GetRootBranch())
return false;
@ -1857,7 +1856,7 @@ nsContentUtils::MaybeAllowOfflineAppByDefault(nsIPrincipal *aPrincipal,
return false;
}
rv = updateService->AllowOfflineApp(aWindow, aPrincipal);
rv = updateService->AllowOfflineApp(aPrincipal);
return NS_SUCCEEDED(rv);
}
@ -2019,11 +2018,9 @@ nsContentUtils::CanCallerAccess(nsINode* aNode)
// static
bool
nsContentUtils::CanCallerAccess(nsPIDOMWindow* aWindow)
nsContentUtils::CanCallerAccess(nsPIDOMWindowInner* aWindow)
{
nsCOMPtr<nsIScriptObjectPrincipal> scriptObject =
do_QueryInterface(aWindow->IsOuterWindow() ?
aWindow->GetCurrentInnerWindow() : aWindow);
nsCOMPtr<nsIScriptObjectPrincipal> scriptObject = do_QueryInterface(aWindow);
NS_ENSURE_TRUE(scriptObject, false);
return CanCallerAccess(SubjectPrincipal(), scriptObject->GetPrincipal());
@ -2051,7 +2048,7 @@ nsContentUtils::GetDocumentFromCaller()
{
AutoJSContext cx;
nsCOMPtr<nsPIDOMWindow> win =
nsCOMPtr<nsPIDOMWindowInner> win =
do_QueryInterface(nsJSUtils::GetStaticScriptGlobal(JS::CurrentGlobalOrNull(cx)));
if (!win) {
return nullptr;
@ -3078,7 +3075,7 @@ bool
nsContentUtils::DocumentInactiveForImageLoads(nsIDocument* aDocument)
{
if (aDocument && !IsChromeDoc(aDocument) && !aDocument->IsResourceDoc()) {
nsCOMPtr<nsPIDOMWindow> win =
nsCOMPtr<nsPIDOMWindowInner> win =
do_QueryInterface(aDocument->GetScopeObject());
return !win || !win->GetDocShell();
}
@ -3874,7 +3871,7 @@ nsContentUtils::GetSubdocumentWithOuterWindowId(nsIDocument *aDocument,
return nullptr;
}
nsCOMPtr<nsPIDOMWindow> window = nsGlobalWindow::GetOuterWindowWithId(aOuterWindowId);
nsCOMPtr<nsPIDOMWindowOuter> window = nsGlobalWindow::GetOuterWindowWithId(aOuterWindowId)->AsOuter();
if (!window) {
return nullptr;
}
@ -3982,7 +3979,7 @@ nsContentUtils::HasMutationListeners(nsINode* aNode,
nsIDocument* doc = aNode->OwnerDoc();
// global object will be null for documents that don't have windows.
nsPIDOMWindow* window = doc->GetInnerWindow();
nsPIDOMWindowInner* window = doc->GetInnerWindow();
// This relies on EventListenerManager::AddEventListener, which sets
// all mutation bits when there is a listener for DOMSubtreeModified event.
if (window && !window->HasMutationListeners(aType)) {
@ -4035,7 +4032,7 @@ bool
nsContentUtils::HasMutationListeners(nsIDocument* aDocument,
uint32_t aType)
{
nsPIDOMWindow* window = aDocument ?
nsPIDOMWindowInner* window = aDocument ?
aDocument->GetInnerWindow() : nullptr;
// This relies on EventListenerManager::AddEventListener, which sets
@ -5163,17 +5160,17 @@ nsContentUtils::GetWindowProviderForContentProcess()
}
/* static */
already_AddRefed<nsPIDOMWindow>
already_AddRefed<nsPIDOMWindowOuter>
nsContentUtils::GetMostRecentNonPBWindow()
{
nsCOMPtr<nsIWindowMediator> windowMediator =
do_GetService(NS_WINDOWMEDIATOR_CONTRACTID);
nsCOMPtr<nsIWindowMediator_44> wm = do_QueryInterface(windowMediator);
nsCOMPtr<nsIDOMWindow> window;
nsCOMPtr<mozIDOMWindowProxy> window;
wm->GetMostRecentNonPBWindow(MOZ_UTF16("navigator:browser"),
getter_AddRefs(window));
nsCOMPtr<nsPIDOMWindow> pwindow;
nsCOMPtr<nsPIDOMWindowOuter> pwindow;
pwindow = do_QueryInterface(window);
return pwindow.forget();
@ -5528,7 +5525,7 @@ nsContentUtils::CheckForSubFrameDrop(nsIDragSession* aDragSession,
}
nsIDocument* targetDoc = target->OwnerDoc();
nsPIDOMWindow* targetWin = targetDoc->GetWindow();
nsPIDOMWindowOuter* targetWin = targetDoc->GetWindow();
if (!targetWin) {
return true;
}
@ -6029,7 +6026,7 @@ nsContentUtils::GetDocumentFromScriptContext(nsIScriptContext *aScriptContext)
return nullptr;
}
nsCOMPtr<nsPIDOMWindow> window =
nsCOMPtr<nsPIDOMWindowOuter> window =
do_QueryInterface(aScriptContext->GetGlobalObject());
if (!window) {
return nullptr;
@ -6105,7 +6102,7 @@ nsContentUtils::DispatchXULCommand(nsIContent* aTarget,
getter_AddRefs(event));
nsCOMPtr<nsIDOMXULCommandEvent> xulCommand = do_QueryInterface(event);
nsresult rv = xulCommand->InitCommandEvent(NS_LITERAL_STRING("command"),
true, true, doc->GetWindow(),
true, true, doc->GetInnerWindow(),
0, aCtrl, aAlt, aShift, aMeta,
aSourceEvent);
NS_ENSURE_SUCCESS(rv, rv);
@ -6357,7 +6354,7 @@ nsContentUtils::IsUserFocusIgnored(nsINode* aNode)
browserFrame->GetReallyIsBrowserOrApp()) {
return true;
}
nsPIDOMWindow* win = aNode->OwnerDoc()->GetWindow();
nsPIDOMWindowOuter* win = aNode->OwnerDoc()->GetWindow();
aNode = win ? win->GetFrameElementInternal() : nullptr;
}
@ -6372,33 +6369,31 @@ nsContentUtils::HasScrollgrab(nsIContent* aContent)
}
void
nsContentUtils::FlushLayoutForTree(nsIDOMWindow* aWindow)
nsContentUtils::FlushLayoutForTree(nsPIDOMWindowOuter* aWindow)
{
nsCOMPtr<nsPIDOMWindow> piWin = do_QueryInterface(aWindow);
if (!piWin)
return;
if (!aWindow) {
return;
}
// Note that because FlushPendingNotifications flushes parents, this
// is O(N^2) in docshell tree depth. However, the docshell tree is
// usually pretty shallow.
// Note that because FlushPendingNotifications flushes parents, this
// is O(N^2) in docshell tree depth. However, the docshell tree is
// usually pretty shallow.
if (nsCOMPtr<nsIDocument> doc = piWin->GetDoc()) {
doc->FlushPendingNotifications(Flush_Layout);
}
nsCOMPtr<nsIDocShell> docShell = piWin->GetDocShell();
if (docShell) {
int32_t i = 0, i_end;
docShell->GetChildCount(&i_end);
for (; i < i_end; ++i) {
nsCOMPtr<nsIDocShellTreeItem> item;
docShell->GetChildAt(i, getter_AddRefs(item));
nsCOMPtr<nsIDOMWindow> win = item->GetWindow();
if (win) {
FlushLayoutForTree(win);
}
}
if (nsCOMPtr<nsIDocument> doc = aWindow->GetDoc()) {
doc->FlushPendingNotifications(Flush_Layout);
}
if (nsCOMPtr<nsIDocShell> docShell = aWindow->GetDocShell()) {
int32_t i = 0, i_end;
docShell->GetChildCount(&i_end);
for (; i < i_end; ++i) {
nsCOMPtr<nsIDocShellTreeItem> item;
docShell->GetChildAt(i, getter_AddRefs(item));
if (nsCOMPtr<nsPIDOMWindowOuter> win = item->GetWindow()) {
FlushLayoutForTree(win);
}
}
}
}
void nsContentUtils::RemoveNewlines(nsString &aString)
@ -6887,7 +6882,7 @@ nsContentUtils::GetRootDocument(nsIDocument* aDoc)
/* static */
bool
nsContentUtils::IsInPointerLockContext(nsPIDOMWindow* aWin)
nsContentUtils::IsInPointerLockContext(nsPIDOMWindowOuter* aWin)
{
if (!aWin) {
return false;
@ -6899,8 +6894,9 @@ nsContentUtils::IsInPointerLockContext(nsPIDOMWindow* aWin)
return false;
}
nsCOMPtr<nsPIDOMWindow> lockTop = pointerLockedDoc->GetWindow()->GetScriptableTop();
nsCOMPtr<nsPIDOMWindow> top = aWin->GetScriptableTop();
nsCOMPtr<nsPIDOMWindowOuter> lockTop =
pointerLockedDoc->GetWindow()->GetScriptableTop();
nsCOMPtr<nsPIDOMWindowOuter> top = aWin->GetScriptableTop();
return top == lockTop;
}
@ -7259,19 +7255,18 @@ nsContentUtils::GetInnerWindowID(nsIRequest* aRequest)
return 0;
}
nsCOMPtr<nsIDOMWindow> window;
nsCOMPtr<mozIDOMWindowProxy> window;
rv = loadContext->GetAssociatedWindow(getter_AddRefs(window));
if (NS_FAILED(rv) || !window) {
return 0;
}
nsCOMPtr<nsPIDOMWindow> pwindow = do_QueryInterface(window);
auto* pwindow = nsPIDOMWindowOuter::From(window);
if (!pwindow) {
return 0;
}
nsPIDOMWindow* inner = pwindow->IsInnerWindow() ? pwindow.get() : pwindow->GetCurrentInnerWindow();
nsPIDOMWindowInner* inner = pwindow->GetCurrentInnerWindow();
return inner ? inner->WindowID() : 0;
}
@ -7335,7 +7330,7 @@ nsContentUtils::CallOnAllRemoteChildren(nsIMessageBroadcaster* aManager,
}
void
nsContentUtils::CallOnAllRemoteChildren(nsIDOMWindow* aWindow,
nsContentUtils::CallOnAllRemoteChildren(nsPIDOMWindowOuter* aWindow,
CallOnRemoteChildFunction aCallback,
void* aArg)
{
@ -7974,8 +7969,7 @@ already_AddRefed<nsPIWindowRoot>
nsContentUtils::GetWindowRoot(nsIDocument* aDoc)
{
if (aDoc) {
nsPIDOMWindow* win = aDoc->GetWindow();
if (win) {
if (nsPIDOMWindowOuter* win = aDoc->GetWindow()) {
return win->GetTopWindowRoot();
}
}
@ -8141,12 +8135,11 @@ nsContentUtils::IsNonSubresourceRequest(nsIChannel* aChannel)
// static, public
nsContentUtils::StorageAccess
nsContentUtils::StorageAllowedForWindow(nsPIDOMWindow* aWindow)
nsContentUtils::StorageAllowedForWindow(nsPIDOMWindowInner* aWindow)
{
MOZ_ASSERT(aWindow->IsInnerWindow());
nsIDocument* document = aWindow->GetExtantDoc();
if (document) {
if (nsIDocument* document = aWindow->GetExtantDoc()) {
nsCOMPtr<nsIPrincipal> principal = document->NodePrincipal();
return InternalStorageAllowedForPrincipal(principal, aWindow);
}
@ -8164,7 +8157,7 @@ nsContentUtils::StorageAllowedForPrincipal(nsIPrincipal* aPrincipal)
// static, private
nsContentUtils::StorageAccess
nsContentUtils::InternalStorageAllowedForPrincipal(nsIPrincipal* aPrincipal,
nsPIDOMWindow* aWindow)
nsPIDOMWindowInner* aWindow)
{
MOZ_ASSERT(aPrincipal);
MOZ_ASSERT(!aWindow || aWindow->IsInnerWindow());
@ -8265,7 +8258,7 @@ nsContentUtils::InternalStorageAllowedForPrincipal(nsIPrincipal* aPrincipal,
bool thirdPartyWindow = false;
if (NS_SUCCEEDED(thirdPartyUtil->IsThirdPartyWindow(
aWindow, nullptr, &thirdPartyWindow)) && thirdPartyWindow) {
aWindow->GetOuterWindow(), nullptr, &thirdPartyWindow)) && thirdPartyWindow) {
// XXX For non-cookie forms of storage, we handle BEHAVIOR_LIMIT_FOREIGN by
// simply rejecting the request to use the storage. In the future, if we
// change the meaning of BEHAVIOR_LIMIT_FOREIGN to be one which makes sense

Просмотреть файл

@ -61,7 +61,6 @@ class nsIDOMEvent;
class nsIDOMHTMLInputElement;
class nsIDOMKeyEvent;
class nsIDOMNode;
class nsIDOMWindow;
class nsIDragSession;
class nsIEditor;
class nsIFragmentContentSink;
@ -92,7 +91,8 @@ class nsIWidget;
class nsIWordBreaker;
class nsIXPConnect;
class nsNodeInfoManager;
class nsPIDOMWindow;
class nsPIDOMWindowInner;
class nsPIDOMWindowOuter;
class nsPresContext;
class nsStringBuffer;
class nsStringHashKey;
@ -479,7 +479,7 @@ public:
// Check if the (JS) caller can access aWindow.
// aWindow can be either outer or inner window.
static bool CanCallerAccess(nsPIDOMWindow* aWindow);
static bool CanCallerAccess(nsPIDOMWindowInner* aWindow);
/**
* GetDocumentFromCaller gets its document by looking at the last called
@ -1594,7 +1594,7 @@ public:
* If offline-apps.allow_by_default is true, we set offline-app permission
* for the principal and return true. Otherwise false.
*/
static bool MaybeAllowOfflineAppByDefault(nsIPrincipal *aPrincipal, nsIDOMWindow *aWindow);
static bool MaybeAllowOfflineAppByDefault(nsIPrincipal *aPrincipal);
/**
* Increases the count of blockers preventing scripts from running.
@ -1643,7 +1643,7 @@ public:
// Returns the browser window with the most recent time stamp that is
// not in private browsing mode.
static already_AddRefed<nsPIDOMWindow>
static already_AddRefed<nsPIDOMWindowOuter>
GetMostRecentNonPBWindow();
/**
@ -2069,7 +2069,7 @@ public:
* Returns true if aWin and the current pointer lock document
* have common scriptable top window.
*/
static bool IsInPointerLockContext(nsPIDOMWindow* aWin);
static bool IsInPointerLockContext(nsPIDOMWindowOuter* aWin);
/**
* Returns the time limit on handling user input before
@ -2116,7 +2116,7 @@ public:
* @param aWindow the window the flush should start at
*
*/
static void FlushLayoutForTree(nsIDOMWindow* aWindow);
static void FlushLayoutForTree(nsPIDOMWindowOuter* aWindow);
/**
* Returns true if content with the given principal is allowed to use XUL
@ -2409,7 +2409,7 @@ public:
* Call the given callback on all remote children of the given top-level
* window.
*/
static void CallOnAllRemoteChildren(nsIDOMWindow* aWindow,
static void CallOnAllRemoteChildren(nsPIDOMWindowOuter* aWindow,
CallOnRemoteChildFunction aCallback,
void* aArg);
@ -2548,7 +2548,7 @@ public:
* persistent storage which are available to web pages. Cookies don't use
* this logic, and security logic related to them must be updated separately.
*/
static StorageAccess StorageAllowedForWindow(nsPIDOMWindow* aWindow);
static StorageAccess StorageAllowedForWindow(nsPIDOMWindowInner* aWindow);
/*
* Checks if storage for the given principal is permitted by the user's
@ -2622,7 +2622,7 @@ private:
* StorageAllowedForPrincipal.
*/
static StorageAccess InternalStorageAllowedForPrincipal(nsIPrincipal* aPrincipal,
nsPIDOMWindow* aWindow);
nsPIDOMWindowInner* aWindow);
static nsIXPConnect *sXPConnect;

Просмотреть файл

@ -552,7 +552,7 @@ nsCopySupport::GetSelectionForCopy(nsIDocument* aDocument, nsISelection** aSelec
return nullptr;
// check if the focused node in the window has a selection
nsCOMPtr<nsPIDOMWindow> focusedWindow;
nsCOMPtr<nsPIDOMWindowOuter> focusedWindow;
nsIContent* content =
nsFocusManager::GetFocusedDescendant(aDocument->GetWindow(), false,
getter_AddRefs(focusedWindow));
@ -643,7 +643,7 @@ nsCopySupport::FireClipboardEvent(EventMessage aEventMessage,
if (!doc)
return false;
nsCOMPtr<nsPIDOMWindow> piWindow = doc->GetWindow();
nsCOMPtr<nsPIDOMWindowOuter> piWindow = doc->GetWindow();
if (!piWindow)
return false;

Просмотреть файл

@ -1082,12 +1082,12 @@ nsDOMClassInfo::PostCreatePrototype(JSContext * cx, JSObject * aProto)
// Only do this if the global object is a window.
// XXX Is there a better way to check this?
nsISupports *globalNative = XPConnect()->GetNativeOfWrapper(cx, global);
nsCOMPtr<nsPIDOMWindow> piwin = do_QueryInterface(globalNative);
nsCOMPtr<nsPIDOMWindowInner> piwin = do_QueryInterface(globalNative);
if (!piwin) {
return NS_OK;
}
nsGlobalWindow *win = nsGlobalWindow::FromSupports(globalNative);
nsGlobalWindow *win = nsGlobalWindow::Cast(piwin);
if (win->IsClosedOrClosing()) {
return NS_OK;
}
@ -1100,18 +1100,6 @@ nsDOMClassInfo::PostCreatePrototype(JSContext * cx, JSObject * aProto)
return NS_OK;
}
if (win->IsOuterWindow()) {
// XXXjst: Do security checks here when we remove the security
// checks on the inner window.
win = win->GetCurrentInnerWindowInternal();
if (!win || !(global = win->GetGlobalJSObject()) ||
win->IsClosedOrClosing()) {
return NS_OK;
}
}
// Don't overwrite a property set by content.
bool contentDefinedProperty;
if (!::JS_AlreadyHasOwnUCProperty(cx, global, reinterpret_cast<const char16_t*>(mData->mNameUTF16),
@ -1288,7 +1276,7 @@ class nsDOMConstructor final : public nsIDOMDOMConstructor
protected:
nsDOMConstructor(const char16_t* aName,
bool aIsConstructable,
nsPIDOMWindow* aOwner)
nsPIDOMWindowInner* aOwner)
: mClassName(aName),
mConstructable(aIsConstructable),
mWeakOwner(do_GetWeakReference(aOwner))
@ -1302,7 +1290,7 @@ public:
static nsresult Create(const char16_t* aName,
const nsDOMClassInfoData* aData,
const nsGlobalNameStruct* aNameStruct,
nsPIDOMWindow* aOwner,
nsPIDOMWindowInner* aOwner,
nsDOMConstructor** aResult);
NS_DECL_ISUPPORTS
@ -1387,7 +1375,7 @@ nsresult
nsDOMConstructor::Create(const char16_t* aName,
const nsDOMClassInfoData* aData,
const nsGlobalNameStruct* aNameStruct,
nsPIDOMWindow* aOwner,
nsPIDOMWindowInner* aOwner,
nsDOMConstructor** aResult)
{
*aResult = nullptr;
@ -1396,8 +1384,8 @@ nsDOMConstructor::Create(const char16_t* aName,
// caller can't access the outer window's current inner window then try to use
// the owner (so long as it is, in fact, an inner window). If that doesn't
// work then prevent creation also.
nsPIDOMWindow* outerWindow = aOwner->GetOuterWindow();
nsPIDOMWindow* currentInner =
nsPIDOMWindowOuter* outerWindow = aOwner->GetOuterWindow();
nsPIDOMWindowInner* currentInner =
outerWindow ? outerWindow->GetCurrentInnerWindow() : aOwner;
if (!currentInner ||
(aOwner != currentInner &&
@ -1443,13 +1431,13 @@ NS_INTERFACE_MAP_END
nsresult
nsDOMConstructor::PreCreate(JSContext *cx, JSObject *globalObj, JSObject **parentObj)
{
nsCOMPtr<nsPIDOMWindow> owner(do_QueryReferent(mWeakOwner));
nsCOMPtr<nsPIDOMWindowInner> owner(do_QueryReferent(mWeakOwner));
if (!owner) {
// Can't do anything.
return NS_OK;
}
nsGlobalWindow *win = static_cast<nsGlobalWindow *>(owner.get());
nsGlobalWindow *win = nsGlobalWindow::Cast(owner);
return SetParentToWindow(win, parentObj);
}
@ -1724,7 +1712,8 @@ ResolvePrototype(nsIXPConnect *aXPConnect, nsGlobalWindow *aWin, JSContext *cx,
"Wrong type or missing ci_data!");
RefPtr<nsDOMConstructor> constructor;
nsresult rv = nsDOMConstructor::Create(name, ci_data, name_struct, aWin,
nsresult rv = nsDOMConstructor::Create(name, ci_data, name_struct,
aWin->AsInner(),
getter_AddRefs(constructor));
NS_ENSURE_SUCCESS(rv, rv);
@ -1899,7 +1888,7 @@ OldBindingConstructorEnabled(const nsGlobalNameStruct *aStruct,
static nsresult
LookupComponentsShim(JSContext *cx, JS::Handle<JSObject*> global,
nsPIDOMWindow *win,
nsPIDOMWindowInner *win,
JS::MutableHandle<JS::PropertyDescriptor> desc);
// static
@ -1940,7 +1929,7 @@ nsWindowSH::GlobalResolve(nsGlobalWindow *aWin, JSContext *cx,
JS::MutableHandle<JS::PropertyDescriptor> desc)
{
if (id == XPCJSRuntime::Get()->GetStringID(XPCJSRuntime::IDX_COMPONENTS)) {
return LookupComponentsShim(cx, obj, aWin, desc);
return LookupComponentsShim(cx, obj, aWin->AsInner(), desc);
}
#ifdef USE_CONTROLLERS_SHIM
@ -2097,7 +2086,7 @@ nsWindowSH::GlobalResolve(nsGlobalWindow *aWin, JSContext *cx,
rv = nsDOMConstructor::Create(class_name,
nullptr,
name_struct,
static_cast<nsPIDOMWindow*>(aWin),
aWin->AsInner(),
getter_AddRefs(constructor));
NS_ENSURE_SUCCESS(rv, rv);
@ -2204,8 +2193,7 @@ nsWindowSH::GlobalResolve(nsGlobalWindow *aWin, JSContext *cx,
if (name_struct->mType == nsGlobalNameStruct::eTypeExternalConstructor) {
RefPtr<nsDOMConstructor> constructor;
rv = nsDOMConstructor::Create(class_name, nullptr, name_struct,
static_cast<nsPIDOMWindow*>(aWin),
getter_AddRefs(constructor));
aWin->AsInner(), getter_AddRefs(constructor));
NS_ENSURE_SUCCESS(rv, rv);
JS::Rooted<JS::Value> val(cx);
@ -2228,9 +2216,9 @@ nsWindowSH::GlobalResolve(nsGlobalWindow *aWin, JSContext *cx,
// Before defining a global property, check for a named subframe of the
// same name. If it exists, we don't want to shadow it.
nsCOMPtr<nsIDOMWindow> childWin = aWin->GetChildWindow(name);
if (childWin)
if (nsCOMPtr<nsPIDOMWindowOuter> childWin = aWin->GetChildWindow(name)) {
return NS_OK;
}
nsCOMPtr<nsISupports> native(do_CreateInstance(name_struct->mCID, &rv));
NS_ENSURE_SUCCESS(rv, rv);
@ -2239,16 +2227,11 @@ nsWindowSH::GlobalResolve(nsGlobalWindow *aWin, JSContext *cx,
nsCOMPtr<nsIDOMGlobalPropertyInitializer> gpi(do_QueryInterface(native));
if (gpi) {
rv = gpi->Init(aWin, &prop_val);
rv = gpi->Init(aWin->AsInner(), &prop_val);
NS_ENSURE_SUCCESS(rv, rv);
}
if (prop_val.isPrimitive() && !prop_val.isNull()) {
if (aWin->IsOuterWindow()) {
nsGlobalWindow *inner = aWin->GetCurrentInnerWindowInternal();
NS_ENSURE_TRUE(inner, NS_ERROR_UNEXPECTED);
}
rv = nsContentUtils::WrapNative(cx, native, &prop_val, true);
}
@ -2299,7 +2282,7 @@ const InterfaceShimEntry kInterfaceShimMap[] =
static nsresult
LookupComponentsShim(JSContext *cx, JS::Handle<JSObject*> global,
nsPIDOMWindow *win,
nsPIDOMWindowInner *win,
JS::MutableHandle<JS::PropertyDescriptor> desc)
{
// Keep track of how often this happens.

Просмотреть файл

@ -15,6 +15,7 @@
#include "mozilla/DOMEventTargetHelper.h"
#include "mozilla/dom/File.h"
#include "mozilla/dom/MessageEvent.h"
#include "mozilla/dom/MessageEventBinding.h"
#include "mozilla/dom/ScriptSettings.h"
#include "nsError.h"
@ -72,16 +73,15 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(nsDOMDataChannel)
NS_INTERFACE_MAP_END_INHERITING(DOMEventTargetHelper)
nsDOMDataChannel::nsDOMDataChannel(already_AddRefed<mozilla::DataChannel>& aDataChannel,
nsPIDOMWindow* aWindow)
: DOMEventTargetHelper(aWindow && aWindow->IsOuterWindow() ?
aWindow->GetCurrentInnerWindow() : aWindow)
nsPIDOMWindowInner* aWindow)
: DOMEventTargetHelper(aWindow)
, mDataChannel(aDataChannel)
, mBinaryType(DC_BINARY_TYPE_BLOB)
{
}
nsresult
nsDOMDataChannel::Init(nsPIDOMWindow* aDOMWindow)
nsDOMDataChannel::Init(nsPIDOMWindowInner* aDOMWindow)
{
nsresult rv;
nsAutoString urlParam;
@ -414,9 +414,8 @@ nsDOMDataChannel::DoOnMessageAvailable(const nsACString& aData,
RefPtr<MessageEvent> event = NS_NewDOMMessageEvent(this, nullptr, nullptr);
rv = event->InitMessageEvent(NS_LITERAL_STRING("message"), false, false,
jsData, mOrigin, EmptyString(), nullptr);
NS_ENSURE_SUCCESS(rv,rv);
event->InitMessageEvent(nullptr, NS_LITERAL_STRING("message"), false, false,
jsData, mOrigin, EmptyString(), nullptr, nullptr);
event->SetTrusted(true);
LOG(("%p(%p): %s - Dispatching\n",this,(void*)mDataChannel,__FUNCTION__));
@ -494,7 +493,7 @@ nsDOMDataChannel::AppReady()
/* static */
nsresult
NS_NewDOMDataChannel(already_AddRefed<mozilla::DataChannel>&& aDataChannel,
nsPIDOMWindow* aWindow,
nsPIDOMWindowInner* aWindow,
nsIDOMDataChannel** aDomDataChannel)
{
RefPtr<nsDOMDataChannel> domdc =

Просмотреть файл

@ -30,9 +30,9 @@ class nsDOMDataChannel final : public mozilla::DOMEventTargetHelper,
{
public:
nsDOMDataChannel(already_AddRefed<mozilla::DataChannel>& aDataChannel,
nsPIDOMWindow* aWindow);
nsPIDOMWindowInner* aWindow);
nsresult Init(nsPIDOMWindow* aDOMWindow);
nsresult Init(nsPIDOMWindowInner* aDOMWindow);
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_NSIDOMDATACHANNEL
@ -44,7 +44,7 @@ public:
virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
override;
nsPIDOMWindow* GetParentObject() const
nsPIDOMWindowInner* GetParentObject() const
{
return GetOwner();
}

Просмотреть файл

@ -17,11 +17,11 @@ namespace mozilla {
class DataChannel;
}
class nsPIDOMWindow;
class nsPIDOMWindowInner;
nsresult
NS_NewDOMDataChannel(already_AddRefed<mozilla::DataChannel>&& dataChannel,
nsPIDOMWindow* aWindow,
nsPIDOMWindowInner* aWindow,
nsIDOMDataChannel** domDataChannel);
// Tell DataChannel it's ok to deliver open and message events

Просмотреть файл

@ -779,7 +779,7 @@ nsDOMMutationObserver::Constructor(const mozilla::dom::GlobalObject& aGlobal,
mozilla::dom::MutationCallback& aCb,
mozilla::ErrorResult& aRv)
{
nsCOMPtr<nsPIDOMWindow> window = do_QueryInterface(aGlobal.GetAsSupports());
nsCOMPtr<nsPIDOMWindowInner> window = do_QueryInterface(aGlobal.GetAsSupports());
if (!window) {
aRv.Throw(NS_ERROR_FAILURE);
return nullptr;
@ -820,7 +820,7 @@ nsDOMMutationObserver::HandleMutation()
}
mTransientReceivers.Clear();
nsPIDOMWindow* outer = mOwner->GetOuterWindow();
nsPIDOMWindowOuter* outer = mOwner->GetOuterWindow();
if (!mPendingMutationCount || !outer ||
outer->GetCurrentInnerWindow() != mOwner) {
ClearPendingRecords();

Просмотреть файл

@ -465,7 +465,7 @@ class nsDOMMutationObserver final : public nsISupports,
public nsWrapperCache
{
public:
nsDOMMutationObserver(already_AddRefed<nsPIDOMWindow>&& aOwner,
nsDOMMutationObserver(already_AddRefed<nsPIDOMWindowInner>&& aOwner,
mozilla::dom::MutationCallback& aCb,
bool aChrome)
: mOwner(aOwner), mLastPendingMutation(nullptr), mPendingMutationCount(0),
@ -599,7 +599,7 @@ protected:
static void AddCurrentlyHandlingObserver(nsDOMMutationObserver* aObserver,
uint32_t aMutationLevel);
nsCOMPtr<nsPIDOMWindow> mOwner;
nsCOMPtr<nsPIDOMWindowInner> mOwner;
nsCOMArray<nsMutationReceiver> mReceivers;
nsClassHashtable<nsISupportsHashKey,

Просмотреть файл

@ -82,7 +82,7 @@ nsDOMWindowList::GetLength(uint32_t* aLength)
return NS_OK;
}
already_AddRefed<nsIDOMWindow>
already_AddRefed<nsPIDOMWindowOuter>
nsDOMWindowList::IndexedGetter(uint32_t aIndex)
{
nsCOMPtr<nsIDocShellTreeItem> item = GetDocShellTreeItemAt(aIndex);
@ -90,22 +90,22 @@ nsDOMWindowList::IndexedGetter(uint32_t aIndex)
return nullptr;
}
nsCOMPtr<nsIDOMWindow> window = item->GetWindow();
nsCOMPtr<nsPIDOMWindowOuter> window = item->GetWindow();
MOZ_ASSERT(window);
return window.forget();
}
NS_IMETHODIMP
nsDOMWindowList::Item(uint32_t aIndex, nsIDOMWindow** aReturn)
nsDOMWindowList::Item(uint32_t aIndex, mozIDOMWindowProxy** aReturn)
{
nsCOMPtr<nsIDOMWindow> window = IndexedGetter(aIndex);
nsCOMPtr<nsPIDOMWindowOuter> window = IndexedGetter(aIndex);
window.forget(aReturn);
return NS_OK;
}
NS_IMETHODIMP
nsDOMWindowList::NamedItem(const nsAString& aName, nsIDOMWindow** aReturn)
nsDOMWindowList::NamedItem(const nsAString& aName, mozIDOMWindowProxy** aReturn)
{
nsCOMPtr<nsIDocShellTreeItem> item;

Просмотреть файл

@ -23,7 +23,7 @@ public:
NS_DECL_NSIDOMWINDOWCOLLECTION
uint32_t GetLength();
already_AddRefed<nsIDOMWindow> IndexedGetter(uint32_t aIndex);
already_AddRefed<nsPIDOMWindowOuter> IndexedGetter(uint32_t aIndex);
//local methods
NS_IMETHOD SetDocShell(nsIDocShell* aDocShell);

Просмотреть файл

@ -144,7 +144,7 @@ nsDOMWindowUtils::~nsDOMWindowUtils()
nsIPresShell*
nsDOMWindowUtils::GetPresShell()
{
nsCOMPtr<nsPIDOMWindow> window = do_QueryReferent(mWindow);
nsCOMPtr<nsPIDOMWindowOuter> window = do_QueryReferent(mWindow);
if (!window)
return nullptr;
@ -158,7 +158,7 @@ nsDOMWindowUtils::GetPresShell()
nsPresContext*
nsDOMWindowUtils::GetPresContext()
{
nsCOMPtr<nsPIDOMWindow> window = do_QueryReferent(mWindow);
nsCOMPtr<nsPIDOMWindowOuter> window = do_QueryReferent(mWindow);
if (!window)
return nullptr;
nsIDocShell *docShell = window->GetDocShell();
@ -172,7 +172,7 @@ nsDOMWindowUtils::GetPresContext()
nsIDocument*
nsDOMWindowUtils::GetDocument()
{
nsCOMPtr<nsPIDOMWindow> window = do_QueryReferent(mWindow);
nsCOMPtr<nsPIDOMWindowOuter> window = do_QueryReferent(mWindow);
if (!window) {
return nullptr;
}
@ -1159,7 +1159,7 @@ nsDOMWindowUtils::ForceUpdateNativeMenuAt(const nsAString& indexString)
nsIWidget*
nsDOMWindowUtils::GetWidget(nsPoint* aOffset)
{
nsCOMPtr<nsPIDOMWindow> window = do_QueryReferent(mWindow);
nsCOMPtr<nsPIDOMWindowOuter> window = do_QueryReferent(mWindow);
if (window) {
nsIDocShell *docShell = window->GetDocShell();
if (docShell) {
@ -1196,7 +1196,7 @@ nsDOMWindowUtils::GetWidgetForElement(nsIDOMElement* aElement)
NS_IMETHODIMP
nsDOMWindowUtils::Focus(nsIDOMElement* aElement)
{
nsCOMPtr<nsIDOMWindow> window = do_QueryReferent(mWindow);
nsCOMPtr<nsPIDOMWindowOuter> window = do_QueryReferent(mWindow);
nsIFocusManager* fm = nsFocusManager::GetFocusManager();
if (fm) {
if (aElement)
@ -1531,7 +1531,7 @@ nsDOMWindowUtils::ClearMozAfterPaintEvents()
NS_IMETHODIMP
nsDOMWindowUtils::DisableNonTestMouseEvents(bool aDisable)
{
nsCOMPtr<nsPIDOMWindow> window = do_QueryReferent(mWindow);
nsCOMPtr<nsPIDOMWindowOuter> window = do_QueryReferent(mWindow);
NS_ENSURE_TRUE(window, NS_ERROR_FAILURE);
nsIDocShell *docShell = window->GetDocShell();
NS_ENSURE_TRUE(docShell, NS_ERROR_FAILURE);
@ -1558,7 +1558,7 @@ nsDOMWindowUtils::SuppressEventHandling(bool aSuppress)
static nsresult
getScrollXYAppUnits(nsWeakPtr aWindow, bool aFlushLayout, nsPoint& aScrollPos) {
nsCOMPtr<nsPIDOMWindow> window = do_QueryReferent(aWindow);
nsCOMPtr<nsPIDOMWindowOuter> window = do_QueryReferent(aWindow);
nsCOMPtr<nsIDocument> doc = window ? window->GetExtantDoc() : nullptr;
NS_ENSURE_STATE(doc);
@ -1631,7 +1631,7 @@ NS_IMETHODIMP
nsDOMWindowUtils::GetBoundsWithoutFlushing(nsIDOMElement *aElement,
nsIDOMClientRect** aResult)
{
nsCOMPtr<nsPIDOMWindow> window = do_QueryReferent(mWindow);
nsCOMPtr<nsPIDOMWindowOuter> window = do_QueryReferent(mWindow);
NS_ENSURE_STATE(window);
nsresult rv;
@ -1671,7 +1671,7 @@ nsDOMWindowUtils::GetRootBounds(nsIDOMClientRect** aResult)
}
}
nsCOMPtr<nsPIDOMWindow> window = do_QueryReferent(mWindow);
nsCOMPtr<nsPIDOMWindowOuter> window = do_QueryReferent(mWindow);
RefPtr<DOMRect> rect = new DOMRect(window);
rect->SetRect(nsPresContext::AppUnitsToFloatCSSPixels(bounds.x),
nsPresContext::AppUnitsToFloatCSSPixels(bounds.y),
@ -1753,7 +1753,7 @@ nsDOMWindowUtils::GetViewId(nsIDOMElement* aElement, nsViewID* aResult)
NS_IMETHODIMP
nsDOMWindowUtils::GetScreenPixelsPerCSSPixel(float* aScreenPixels)
{
nsCOMPtr<nsPIDOMWindow> window = do_QueryReferent(mWindow);
nsCOMPtr<nsPIDOMWindowOuter> window = do_QueryReferent(mWindow);
NS_ENSURE_TRUE(window, NS_ERROR_FAILURE);
return window->GetDevicePixelRatio(aScreenPixels);
}
@ -1785,7 +1785,7 @@ nsDOMWindowUtils::DispatchDOMEventViaPresShell(nsIDOMNode* aTarget,
NS_ENSURE_STATE(internalEvent);
nsCOMPtr<nsIContent> content = do_QueryInterface(aTarget);
NS_ENSURE_STATE(content);
nsCOMPtr<nsPIDOMWindow> window = do_QueryReferent(mWindow);
nsCOMPtr<nsPIDOMWindowOuter> window = do_QueryReferent(mWindow);
if (content->OwnerDoc()->GetWindow() != window) {
return NS_ERROR_DOM_HIERARCHY_REQUEST_ERR;
}
@ -1820,7 +1820,7 @@ nsDOMWindowUtils::SendQueryContentEvent(uint32_t aType,
{
*aResult = nullptr;
nsCOMPtr<nsPIDOMWindow> window = do_QueryReferent(mWindow);
nsCOMPtr<nsPIDOMWindowOuter> window = do_QueryReferent(mWindow);
NS_ENSURE_TRUE(window, NS_ERROR_FAILURE);
nsIDocShell *docShell = window->GetDocShell();
@ -2010,16 +2010,16 @@ nsDOMWindowUtils::GetVisitedDependentComputedStyle(
{
aResult.Truncate();
nsCOMPtr<nsPIDOMWindow> window = do_QueryReferent(mWindow);
nsCOMPtr<nsPIDOMWindowOuter> window = do_QueryReferent(mWindow);
nsCOMPtr<Element> element = do_QueryInterface(aElement);
NS_ENSURE_STATE(window && element);
window = window->GetCurrentInnerWindow();
nsCOMPtr<nsPIDOMWindowInner> innerWindow = window->GetCurrentInnerWindow();
NS_ENSURE_STATE(window);
nsCOMPtr<nsIDOMCSSStyleDeclaration> decl;
{
ErrorResult rv;
decl = window->GetComputedStyle(*element, aPseudoElement, rv);
decl = innerWindow->GetComputedStyle(*element, aPseudoElement, rv);
ENSURE_SUCCESS(rv, rv.StealNSResult());
}
@ -2033,7 +2033,7 @@ nsDOMWindowUtils::GetVisitedDependentComputedStyle(
NS_IMETHODIMP
nsDOMWindowUtils::EnterModalState()
{
nsCOMPtr<nsPIDOMWindow> window = do_QueryReferent(mWindow);
nsCOMPtr<nsPIDOMWindowOuter> window = do_QueryReferent(mWindow);
NS_ENSURE_STATE(window);
window->EnterModalState();
@ -2043,7 +2043,7 @@ nsDOMWindowUtils::EnterModalState()
NS_IMETHODIMP
nsDOMWindowUtils::LeaveModalState()
{
nsCOMPtr<nsPIDOMWindow> window = do_QueryReferent(mWindow);
nsCOMPtr<nsPIDOMWindowOuter> window = do_QueryReferent(mWindow);
NS_ENSURE_STATE(window);
window->LeaveModalState();
@ -2053,27 +2053,27 @@ nsDOMWindowUtils::LeaveModalState()
NS_IMETHODIMP
nsDOMWindowUtils::IsInModalState(bool *retval)
{
nsCOMPtr<nsPIDOMWindow> window = do_QueryReferent(mWindow);
nsCOMPtr<nsPIDOMWindowOuter> window = do_QueryReferent(mWindow);
NS_ENSURE_STATE(window);
*retval = static_cast<nsGlobalWindow*>(window.get())->IsInModalState();
*retval = nsGlobalWindow::Cast(window)->IsInModalState();
return NS_OK;
}
NS_IMETHODIMP
nsDOMWindowUtils::SetDesktopModeViewport(bool aDesktopMode)
{
nsCOMPtr<nsPIDOMWindow> window = do_QueryReferent(mWindow);
nsCOMPtr<nsPIDOMWindowOuter> window = do_QueryReferent(mWindow);
NS_ENSURE_STATE(window);
static_cast<nsGlobalWindow*>(window.get())->SetDesktopModeViewport(aDesktopMode);
window->SetDesktopModeViewport(aDesktopMode);
return NS_OK;
}
NS_IMETHODIMP
nsDOMWindowUtils::GetOuterWindowID(uint64_t *aWindowID)
{
nsCOMPtr<nsPIDOMWindow> window = do_QueryReferent(mWindow);
nsCOMPtr<nsPIDOMWindowOuter> window = do_QueryReferent(mWindow);
NS_ENSURE_STATE(window);
NS_ASSERTION(window->IsOuterWindow(), "How did that happen?");
@ -2084,12 +2084,12 @@ nsDOMWindowUtils::GetOuterWindowID(uint64_t *aWindowID)
NS_IMETHODIMP
nsDOMWindowUtils::GetCurrentInnerWindowID(uint64_t *aWindowID)
{
nsCOMPtr<nsPIDOMWindow> window = do_QueryReferent(mWindow);
nsCOMPtr<nsPIDOMWindowOuter> window = do_QueryReferent(mWindow);
NS_ENSURE_TRUE(window, NS_ERROR_NOT_AVAILABLE);
NS_ASSERTION(window->IsOuterWindow(), "How did that happen?");
nsGlobalWindow* inner =
static_cast<nsGlobalWindow*>(window.get())->GetCurrentInnerWindowInternal();
nsGlobalWindow::Cast(window)->GetCurrentInnerWindowInternal();
if (!inner) {
return NS_ERROR_NOT_AVAILABLE;
}
@ -2100,7 +2100,7 @@ nsDOMWindowUtils::GetCurrentInnerWindowID(uint64_t *aWindowID)
NS_IMETHODIMP
nsDOMWindowUtils::SuspendTimeouts()
{
nsCOMPtr<nsPIDOMWindow> window = do_QueryReferent(mWindow);
nsCOMPtr<nsPIDOMWindowOuter> window = do_QueryReferent(mWindow);
NS_ENSURE_TRUE(window, NS_ERROR_FAILURE);
window->SuspendTimeouts(1, true, false);
@ -2111,7 +2111,7 @@ nsDOMWindowUtils::SuspendTimeouts()
NS_IMETHODIMP
nsDOMWindowUtils::ResumeTimeouts()
{
nsCOMPtr<nsPIDOMWindow> window = do_QueryReferent(mWindow);
nsCOMPtr<nsPIDOMWindowOuter> window = do_QueryReferent(mWindow);
NS_ENSURE_TRUE(window, NS_ERROR_FAILURE);
window->ResumeTimeouts(true, false);
@ -2594,7 +2594,7 @@ nsDOMWindowUtils::GetOuterWindowWithId(uint64_t aWindowID,
NS_IMETHODIMP
nsDOMWindowUtils::GetContainerElement(nsIDOMElement** aResult)
{
nsCOMPtr<nsPIDOMWindow> window = do_QueryReferent(mWindow);
nsCOMPtr<nsPIDOMWindowOuter> window = do_QueryReferent(mWindow);
NS_ENSURE_STATE(window);
nsCOMPtr<nsIDOMElement> element =
@ -2612,10 +2612,10 @@ nsDOMWindowUtils::WrapDOMFile(nsIFile *aFile,
return NS_ERROR_FAILURE;
}
nsCOMPtr<nsPIDOMWindow> window = do_QueryReferent(mWindow);
nsCOMPtr<nsPIDOMWindowOuter> window = do_QueryReferent(mWindow);
NS_ENSURE_STATE(window);
nsPIDOMWindow* innerWindow = window->GetCurrentInnerWindow();
nsPIDOMWindowInner* innerWindow = window->GetCurrentInnerWindow();
if (!innerWindow) {
return NS_ERROR_FAILURE;
}
@ -2780,10 +2780,10 @@ nsDOMWindowUtils::NumberOfAssignedPaintedLayers(nsIDOMElement** aElements,
NS_IMETHODIMP
nsDOMWindowUtils::EnableDialogs()
{
nsCOMPtr<nsPIDOMWindow> window = do_QueryReferent(mWindow);
nsCOMPtr<nsPIDOMWindowOuter> window = do_QueryReferent(mWindow);
NS_ENSURE_TRUE(window, NS_ERROR_FAILURE);
static_cast<nsGlobalWindow*>(window.get())->EnableDialogs();
nsGlobalWindow::Cast(window)->EnableDialogs();
return NS_OK;
}
@ -2794,10 +2794,10 @@ nsDOMWindowUtils::DisableDialogs()
return NS_ERROR_DOM_SECURITY_ERR;
}
nsCOMPtr<nsPIDOMWindow> window = do_QueryReferent(mWindow);
nsCOMPtr<nsPIDOMWindowOuter> window = do_QueryReferent(mWindow);
NS_ENSURE_TRUE(window, NS_ERROR_FAILURE);
static_cast<nsGlobalWindow*>(window.get())->DisableDialogs();
nsGlobalWindow::Cast(window)->DisableDialogs();
return NS_OK;
}
@ -2808,10 +2808,10 @@ nsDOMWindowUtils::AreDialogsEnabled(bool* aResult)
return NS_ERROR_DOM_SECURITY_ERR;
}
nsCOMPtr<nsPIDOMWindow> window = do_QueryReferent(mWindow);
nsCOMPtr<nsPIDOMWindowOuter> window = do_QueryReferent(mWindow);
NS_ENSURE_TRUE(window, NS_ERROR_FAILURE);
*aResult = static_cast<nsGlobalWindow*>(window.get())->AreDialogsEnabled();
*aResult = nsGlobalWindow::Cast(window)->AreDialogsEnabled();
return NS_OK;
}
@ -2877,7 +2877,7 @@ nsDOMWindowUtils::GetFileReferences(const nsAString& aDatabaseName, int64_t aId,
int32_t* aSliceRefCnt, JSContext* aCx,
bool* aResult)
{
nsCOMPtr<nsPIDOMWindow> window = do_QueryReferent(mWindow);
nsCOMPtr<nsPIDOMWindowOuter> window = do_QueryReferent(mWindow);
NS_ENSURE_TRUE(window, NS_ERROR_FAILURE);
nsCString origin;
@ -2991,7 +2991,7 @@ nsDOMWindowUtils::GetPCCountScriptContents(int32_t script, JSContext* cx, nsAStr
NS_IMETHODIMP
nsDOMWindowUtils::GetPaintingSuppressed(bool *aPaintingSuppressed)
{
nsCOMPtr<nsPIDOMWindow> window = do_QueryReferent(mWindow);
nsCOMPtr<nsPIDOMWindowOuter> window = do_QueryReferent(mWindow);
NS_ENSURE_TRUE(window, NS_ERROR_FAILURE);
nsIDocShell *docShell = window->GetDocShell();
NS_ENSURE_TRUE(docShell, NS_ERROR_FAILURE);
@ -3092,7 +3092,7 @@ private:
class OldWindowSize : public LinkedListElement<OldWindowSize>
{
public:
static void Set(nsPIDOMWindow* aWindow, const nsSize& aSize)
static void Set(nsPIDOMWindowOuter* aWindow, const nsSize& aSize)
{
OldWindowSize* item = GetItem(aWindow);
if (item) {
@ -3103,7 +3103,7 @@ public:
}
}
static nsSize GetAndRemove(nsPIDOMWindow* aWindow)
static nsSize GetAndRemove(nsPIDOMWindowOuter* aWindow)
{
nsSize result;
if (OldWindowSize* item = GetItem(aWindow)) {
@ -3119,11 +3119,11 @@ private:
: mWindow(Move(aWindow)), mSize(aSize) { }
~OldWindowSize() { };
static OldWindowSize* GetItem(nsPIDOMWindow* aWindow)
static OldWindowSize* GetItem(nsPIDOMWindowOuter* aWindow)
{
OldWindowSize* item = sList.getFirst();
while (item) {
nsCOMPtr<nsPIDOMWindow> window = do_QueryReferent(item->mWindow);
nsCOMPtr<nsPIDOMWindowOuter> window = do_QueryReferent(item->mWindow);
if (!window) {
OldWindowSize* thisItem = item;
item = thisItem->getNext();
@ -3364,9 +3364,9 @@ nsDOMWindowUtils::GetIsHandlingUserInput(bool* aHandlingUserInput)
NS_IMETHODIMP
nsDOMWindowUtils::AllowScriptsToClose()
{
nsCOMPtr<nsPIDOMWindow> window = do_QueryReferent(mWindow);
nsCOMPtr<nsPIDOMWindowOuter> window = do_QueryReferent(mWindow);
NS_ENSURE_STATE(window);
static_cast<nsGlobalWindow*>(window.get())->AllowScriptsToClose();
nsGlobalWindow::Cast(window)->AllowScriptsToClose();
return NS_OK;
}
@ -3375,7 +3375,7 @@ nsDOMWindowUtils::GetIsParentWindowMainWidgetVisible(bool* aIsVisible)
{
// this should reflect the "is parent window visible" logic in
// nsWindowWatcher::OpenWindowInternal()
nsCOMPtr<nsPIDOMWindow> window = do_QueryReferent(mWindow);
nsCOMPtr<nsPIDOMWindowOuter> window = do_QueryReferent(mWindow);
NS_ENSURE_STATE(window);
nsCOMPtr<nsIWidget> parentWidget;
@ -3666,7 +3666,7 @@ nsDOMWindowUtils::PostRestyleSelfEvent(nsIDOMElement* aElement)
NS_IMETHODIMP
nsDOMWindowUtils::GetAudioMuted(bool* aMuted)
{
nsCOMPtr<nsPIDOMWindow> window = do_QueryReferent(mWindow);
nsCOMPtr<nsPIDOMWindowOuter> window = do_QueryReferent(mWindow);
NS_ENSURE_STATE(window);
*aMuted = window->GetAudioMuted();
@ -3676,7 +3676,7 @@ nsDOMWindowUtils::GetAudioMuted(bool* aMuted)
NS_IMETHODIMP
nsDOMWindowUtils::SetAudioMuted(bool aMuted)
{
nsCOMPtr<nsPIDOMWindow> window = do_QueryReferent(mWindow);
nsCOMPtr<nsPIDOMWindowOuter> window = do_QueryReferent(mWindow);
NS_ENSURE_STATE(window);
window->SetAudioMuted(aMuted);
@ -3686,7 +3686,7 @@ nsDOMWindowUtils::SetAudioMuted(bool aMuted)
NS_IMETHODIMP
nsDOMWindowUtils::GetAudioVolume(float* aVolume)
{
nsCOMPtr<nsPIDOMWindow> window = do_QueryReferent(mWindow);
nsCOMPtr<nsPIDOMWindowOuter> window = do_QueryReferent(mWindow);
NS_ENSURE_STATE(window);
*aVolume = window->GetAudioVolume();
@ -3696,7 +3696,7 @@ nsDOMWindowUtils::GetAudioVolume(float* aVolume)
NS_IMETHODIMP
nsDOMWindowUtils::SetAudioVolume(float aVolume)
{
nsCOMPtr<nsPIDOMWindow> window = do_QueryReferent(mWindow);
nsCOMPtr<nsPIDOMWindowOuter> window = do_QueryReferent(mWindow);
NS_ENSURE_STATE(window);
return window->SetAudioVolume(aVolume);
@ -3708,7 +3708,7 @@ nsDOMWindowUtils::SetChromeMargin(int32_t aTop,
int32_t aBottom,
int32_t aLeft)
{
nsCOMPtr<nsPIDOMWindow> window = do_QueryReferent(mWindow);
nsCOMPtr<nsPIDOMWindowOuter> window = do_QueryReferent(mWindow);
if (window) {
nsCOMPtr<nsIBaseWindow> baseWindow = do_QueryInterface(window->GetDocShell());
if (baseWindow) {
@ -3754,7 +3754,7 @@ nsDOMWindowUtils::XpconnectArgument(nsIDOMWindowUtils* aThis)
NS_IMETHODIMP
nsDOMWindowUtils::AskPermission(nsIContentPermissionRequest* aRequest)
{
nsCOMPtr<nsPIDOMWindow> window = do_QueryReferent(mWindow);
nsCOMPtr<nsPIDOMWindowOuter> window = do_QueryReferent(mWindow);
return nsContentPermissionUtils::AskPermission(aRequest, window->GetCurrentInnerWindow());
}
@ -3785,7 +3785,7 @@ nsDOMWindowUtils::GetFramesReflowed(uint64_t* aResult)
NS_IMETHODIMP
nsDOMWindowUtils::SetServiceWorkersTestingEnabled(bool aEnabled)
{
nsCOMPtr<nsPIDOMWindow> window = do_QueryReferent(mWindow);
nsCOMPtr<nsPIDOMWindowOuter> window = do_QueryReferent(mWindow);
NS_ENSURE_STATE(window);
window->SetServiceWorkersTestingEnabled(aEnabled);
@ -3796,7 +3796,7 @@ nsDOMWindowUtils::SetServiceWorkersTestingEnabled(bool aEnabled)
NS_IMETHODIMP
nsDOMWindowUtils::GetServiceWorkersTestingEnabled(bool *aEnabled)
{
nsCOMPtr<nsPIDOMWindow> window = do_QueryReferent(mWindow);
nsCOMPtr<nsPIDOMWindowOuter> window = do_QueryReferent(mWindow);
NS_ENSURE_STATE(window);
*aEnabled = window->GetServiceWorkersTestingEnabled();

Просмотреть файл

@ -56,8 +56,7 @@ nsDataDocumentContentPolicy::ShouldLoad(uint32_t aContentType,
if (node) {
doc = node->OwnerDoc();
} else {
nsCOMPtr<nsPIDOMWindow> window = do_QueryInterface(aRequestingContext);
if (window) {
if (nsCOMPtr<nsPIDOMWindowOuter> window = do_QueryInterface(aRequestingContext)) {
doc = window->GetDoc();
}
}

Просмотреть файл

@ -2271,8 +2271,7 @@ nsDocument::ResetToURI(nsIURI *aURI, nsILoadGroup *aLoadGroup,
}
// Refresh the principal on the compartment.
nsPIDOMWindow* win = GetInnerWindow();
if (win) {
if (nsPIDOMWindowInner* win = GetInnerWindow()) {
win->RefreshCompartmentPrincipal();
}
}
@ -3164,14 +3163,13 @@ nsIDocument::HasFocus(ErrorResult& rv) const
}
// Is there a focused DOMWindow?
nsCOMPtr<nsIDOMWindow> focusedWindow;
nsCOMPtr<mozIDOMWindowProxy> focusedWindow;
fm->GetFocusedWindow(getter_AddRefs(focusedWindow));
if (!focusedWindow) {
return false;
}
nsCOMPtr<nsPIDOMWindow> piWindow = do_QueryInterface(focusedWindow);
MOZ_ASSERT(piWindow);
nsPIDOMWindowOuter* piWindow = nsPIDOMWindowOuter::From(focusedWindow);
// Are we an ancestor of the focused DOMWindow?
for (nsIDocument* currentDoc = piWindow->GetDoc(); currentDoc;
@ -3226,9 +3224,8 @@ Element*
nsIDocument::GetActiveElement()
{
// Get the focused element.
nsCOMPtr<nsPIDOMWindow> window = GetWindow();
if (window) {
nsCOMPtr<nsPIDOMWindow> focusedWindow;
if (nsCOMPtr<nsPIDOMWindowOuter> window = GetWindow()) {
nsCOMPtr<nsPIDOMWindowOuter> focusedWindow;
nsIContent* focusedContent =
nsFocusManager::GetFocusedDescendant(window, false,
getter_AddRefs(focusedWindow));
@ -4515,7 +4512,7 @@ nsDocument::SetScriptGlobalObject(nsIScriptGlobalObject *aScriptGlobalObject)
{
#ifdef DEBUG
{
nsCOMPtr<nsPIDOMWindow> win(do_QueryInterface(aScriptGlobalObject));
nsCOMPtr<nsPIDOMWindowInner> win(do_QueryInterface(aScriptGlobalObject));
NS_ASSERTION(!win || win->IsInnerWindow(),
"Script global object must be an inner window!");
@ -4587,7 +4584,7 @@ nsDocument::SetScriptGlobalObject(nsIScriptGlobalObject *aScriptGlobalObject)
// Remember the pointer to our window (or lack there of), to avoid
// having to QI every time it's asked for.
nsCOMPtr<nsPIDOMWindow> window = do_QueryInterface(mScriptGlobalObject);
nsCOMPtr<nsPIDOMWindowInner> window = do_QueryInterface(mScriptGlobalObject);
mWindow = window;
// Now that we know what our window is, we can flush the CSP errors to the
@ -4668,10 +4665,9 @@ nsDocument::GetScriptHandlingObjectInternal() const
nsCOMPtr<nsIScriptGlobalObject> scriptHandlingObject =
do_QueryReferent(mScopeObject);
nsCOMPtr<nsPIDOMWindow> win = do_QueryInterface(scriptHandlingObject);
nsCOMPtr<nsPIDOMWindowInner> win = do_QueryInterface(scriptHandlingObject);
if (win) {
NS_ASSERTION(win->IsInnerWindow(), "Should have inner window here!");
nsPIDOMWindow* outer = win->GetOuterWindow();
nsPIDOMWindowOuter* outer = win->GetOuterWindow();
if (!outer || outer->GetCurrentInnerWindow() != win) {
NS_WARNING("Wrong inner/outer window combination!");
return nullptr;
@ -4685,8 +4681,8 @@ nsDocument::SetScriptHandlingObject(nsIScriptGlobalObject* aScriptObject)
NS_ASSERTION(!mScriptGlobalObject ||
mScriptGlobalObject == aScriptObject,
"Wrong script object!");
nsCOMPtr<nsPIDOMWindow> win = do_QueryInterface(aScriptObject);
NS_ASSERTION(!win || win->IsInnerWindow(), "Should have inner window here!");
// XXXkhuey why bother?
nsCOMPtr<nsPIDOMWindowInner> win = do_QueryInterface(aScriptObject);
if (aScriptObject) {
mScopeObject = do_GetWeakReference(aScriptObject);
mHasHadScriptHandlingObject = true;
@ -4718,13 +4714,13 @@ nsDocument::SetIsContentDocument(bool aIsContentDocument)
mIsContentDocument = aIsContentDocument;
}
nsPIDOMWindow *
nsPIDOMWindowOuter*
nsDocument::GetWindowInternal() const
{
MOZ_ASSERT(!mWindow, "This should not be called when mWindow is not null!");
// Let's use mScriptGlobalObject. Even if the document is already removed from
// the docshell, the outer window might be still obtainable from the it.
nsCOMPtr<nsPIDOMWindow> win;
nsCOMPtr<nsPIDOMWindowOuter> win;
if (mRemovedFromDocShell) {
// The docshell returns the outer window we are done.
nsCOMPtr<nsIDocShell> kungfuDeathGrip(mDocumentContainer);
@ -4732,10 +4728,9 @@ nsDocument::GetWindowInternal() const
win = mDocumentContainer->GetWindow();
}
} else {
win = do_QueryInterface(mScriptGlobalObject);
if (win) {
if (nsCOMPtr<nsPIDOMWindowInner> inner = do_QueryInterface(mScriptGlobalObject)) {
// mScriptGlobalObject is always the inner window, let's get the outer.
win = win->GetOuterWindow();
win = inner->GetOuterWindow();
}
}
@ -5710,7 +5705,7 @@ nsDocument::CustomElementConstructor(JSContext* aCx, unsigned aArgc, JS::Value*
JS::Rooted<JSObject*> global(aCx,
JS_GetGlobalForObject(aCx, &args.callee()));
nsCOMPtr<nsPIDOMWindow> window = do_QueryWrapper(aCx, global);
nsCOMPtr<nsPIDOMWindowInner> window = do_QueryWrapper(aCx, global);
MOZ_ASSERT(window, "Should have a non-null window");
nsDocument* document = static_cast<nsDocument*>(window->GetDoc());
@ -5762,7 +5757,7 @@ nsDocument::IsWebComponentsEnabled(JSContext* aCx, JSObject* aObject)
// Check for the webcomponents permission. See Bug 1181555.
JSAutoCompartment ac(aCx, obj);
JS::Rooted<JSObject*> global(aCx, JS_GetGlobalForObject(aCx, obj));
nsCOMPtr<nsPIDOMWindow> window =
nsCOMPtr<nsPIDOMWindowInner> window =
do_QueryInterface(nsJSUtils::GetStaticScriptGlobal(global));
if (window) {
@ -6876,10 +6871,10 @@ nsIDocument::CreateTreeWalker(nsINode& aRoot, uint32_t aWhatToShow,
NS_IMETHODIMP
nsDocument::GetDefaultView(nsIDOMWindow** aDefaultView)
nsDocument::GetDefaultView(mozIDOMWindowProxy** aDefaultView)
{
*aDefaultView = nullptr;
nsCOMPtr<nsPIDOMWindow> win = GetWindow();
nsCOMPtr<nsPIDOMWindowOuter> win = GetWindow();
win.forget(aDefaultView);
return NS_OK;
}
@ -6894,13 +6889,13 @@ nsDocument::GetLocation(nsIDOMLocation **_retval)
already_AddRefed<nsLocation>
nsIDocument::GetLocation() const
{
nsCOMPtr<nsIDOMWindow> w = do_QueryInterface(mScriptGlobalObject);
nsCOMPtr<nsPIDOMWindowInner> w = do_QueryInterface(mScriptGlobalObject);
if (!w) {
return nullptr;
}
nsGlobalWindow* window = static_cast<nsGlobalWindow*>(w.get());
nsGlobalWindow* window = nsGlobalWindow::Cast(w);
ErrorResult dummy;
RefPtr<nsLocation> loc = window->GetLocation(dummy);
dummy.SuppressException();
@ -7650,8 +7645,7 @@ nsIDocument::AdoptNode(nsINode& aAdoptedNode, ErrorResult& rv)
// descendants.
nsIDocument *doc = this;
do {
nsPIDOMWindow *win = doc->GetWindow();
if (win) {
if (nsPIDOMWindowOuter *win = doc->GetWindow()) {
nsCOMPtr<nsINode> node = win->GetFrameElementInternal();
if (node &&
nsContentUtils::ContentIsDescendantOf(node, adoptedNode)) {
@ -7780,7 +7774,7 @@ nsDocument::GetViewportInfo(const ScreenIntSize& aDisplaySize)
* LayoutDeviceToScreenScale(1.0);
// Special behaviour for desktop mode, provided we are not on an about: page
nsPIDOMWindow* win = GetWindow();
nsPIDOMWindowOuter* win = GetWindow();
if (win && win->IsDesktopModeViewport() && !IsAboutPage())
{
CSSCoord viewportWidth = gfxPrefs::DesktopViewportWidth() / fullZoom;
@ -8030,7 +8024,7 @@ nsDocument::PreHandleEvent(EventChainPreVisitor& aVisitor)
// Load events must not propagate to |window| object, see bug 335251.
if (aVisitor.mEvent->mMessage != eLoad) {
nsGlobalWindow* window = static_cast<nsGlobalWindow*>(GetWindow());
nsGlobalWindow* window = nsGlobalWindow::Cast(GetWindow());
aVisitor.mParentTarget =
window ? window->GetTargetForEventTargetChain() : nullptr;
}
@ -8662,7 +8656,7 @@ nsDocument::CanSavePresentation(nsIRequest *aNewRequest)
return false;
}
nsPIDOMWindow* win = GetInnerWindow();
nsPIDOMWindowInner* win = GetInnerWindow();
if (win && win->TimeoutSuspendCount()) {
return false;
}
@ -8762,12 +8756,12 @@ nsDocument::CanSavePresentation(nsIRequest *aNewRequest)
}
}
#ifdef MOZ_WEBSPEECH
nsGlobalWindow* globalWindow = static_cast<nsGlobalWindow*>(win);
#ifdef MOZ_WEBSPEECH
auto* globalWindow = nsGlobalWindow::Cast(win);
if (globalWindow->HasActiveSpeechSynthesis()) {
return false;
}
#endif
#endif
return true;
}
@ -9292,7 +9286,7 @@ nsDocument::MutationEventDispatched(nsINode* aTarget)
return;
}
nsPIDOMWindow* window = GetInnerWindow();
nsPIDOMWindowInner* window = GetInnerWindow();
if (window &&
!window->HasMutationListeners(NS_EVENT_BITS_MUTATION_SUBTREEMODIFIED)) {
mSubtreeModifiedTargets.Clear();
@ -10996,8 +10990,8 @@ AskWindowToExitFullscreen(nsIDocument* aDoc)
/* Bubbles */ true, /* Cancelable */ false,
/* DefaultAction */ nullptr);
} else {
if (nsPIDOMWindow* win = aDoc->GetWindow()) {
win->SetFullscreenInternal(nsPIDOMWindow::eForFullscreenAPI, false);
if (nsPIDOMWindowOuter* win = aDoc->GetWindow()) {
win->SetFullscreenInternal(FullscreenReason::ForFullscreenAPI, false);
}
}
}
@ -11092,8 +11086,8 @@ public:
NS_LITERAL_STRING("MozDOMFullscreen:Exited"),
/* Bubbles */ true, /* Cancelable */ false, /* DefaultAction */ nullptr);
// Ensure the window exits fullscreen.
if (nsPIDOMWindow* win = mDocuments[0]->GetWindow()) {
win->SetFullscreenInternal(nsPIDOMWindow::eForForceExitFullscreen, false);
if (nsPIDOMWindowOuter* win = mDocuments[0]->GetWindow()) {
win->SetFullscreenInternal(FullscreenReason::ForForceExitFullscreen, false);
}
return NS_OK;
}
@ -11461,7 +11455,7 @@ IsInActiveTab(nsIDocument* aDoc)
if (!rootItem) {
return false;
}
nsCOMPtr<nsIDOMWindow> rootWin = rootItem->GetWindow();
nsCOMPtr<nsPIDOMWindowOuter> rootWin = rootItem->GetWindow();
if (!rootWin) {
return false;
}
@ -11471,7 +11465,7 @@ IsInActiveTab(nsIDocument* aDoc)
return false;
}
nsCOMPtr<nsIDOMWindow> activeWindow;
nsCOMPtr<mozIDOMWindowProxy> activeWindow;
fm->GetActiveWindow(getter_AddRefs(activeWindow));
if (!activeWindow) {
return false;
@ -11687,7 +11681,7 @@ private:
/* static */ LinkedList<FullscreenRequest> PendingFullscreenRequestList::sList;
static nsCOMPtr<nsPIDOMWindow>
static nsCOMPtr<nsPIDOMWindowOuter>
GetRootWindow(nsIDocument* aDoc)
{
nsIDocShell* docShell = aDoc->GetDocShell();
@ -11701,7 +11695,7 @@ GetRootWindow(nsIDocument* aDoc)
static bool
ShouldApplyFullscreenDirectly(nsIDocument* aDoc,
nsPIDOMWindow* aRootWin)
nsPIDOMWindowOuter* aRootWin)
{
if (XRE_GetProcessType() == GeckoProcessType_Content) {
// If we are in the content process, we can apply the fullscreen
@ -11735,7 +11729,7 @@ ShouldApplyFullscreenDirectly(nsIDocument* aDoc,
void
nsDocument::RequestFullScreen(UniquePtr<FullscreenRequest>&& aRequest)
{
nsCOMPtr<nsPIDOMWindow> rootWin = GetRootWindow(this);
nsCOMPtr<nsPIDOMWindowOuter> rootWin = GetRootWindow(this);
if (!rootWin) {
return;
}
@ -11763,7 +11757,7 @@ nsDocument::RequestFullScreen(UniquePtr<FullscreenRequest>&& aRequest)
// Make the window fullscreen.
const FullscreenRequest*
lastRequest = PendingFullscreenRequestList::GetLast();
rootWin->SetFullscreenInternal(nsPIDOMWindow::eForFullscreenAPI, true,
rootWin->SetFullscreenInternal(FullscreenReason::ForFullscreenAPI, true,
lastRequest->mVRHMDDevice);
}
}
@ -12121,7 +12115,7 @@ public:
// Handling a request from user input in non-fullscreen mode.
// Do a normal permission check.
nsCOMPtr<nsPIDOMWindow> window = doc->GetInnerWindow();
nsCOMPtr<nsPIDOMWindowInner> window = doc->GetInnerWindow();
nsContentPermissionUtils::AskPermission(this, window);
return NS_OK;
}
@ -12169,7 +12163,7 @@ nsPointerLockPermissionRequest::GetPrincipal(nsIPrincipal** aPrincipal)
}
NS_IMETHODIMP
nsPointerLockPermissionRequest::GetWindow(nsIDOMWindow** aWindow)
nsPointerLockPermissionRequest::GetWindow(mozIDOMWindow** aWindow)
{
nsCOMPtr<nsIDocument> d = do_QueryReferent(mDocument);
if (d) {
@ -12411,11 +12405,11 @@ nsDocument::ShouldLockPointer(Element* aElement, Element* aCurrentLock,
if (!ownerDoc->GetContainer()) {
return false;
}
nsCOMPtr<nsPIDOMWindow> ownerWindow = ownerDoc->GetWindow();
nsCOMPtr<nsPIDOMWindowOuter> ownerWindow = ownerDoc->GetWindow();
if (!ownerWindow) {
return false;
}
nsCOMPtr<nsPIDOMWindow> ownerInnerWindow = ownerDoc->GetInnerWindow();
nsCOMPtr<nsPIDOMWindowInner> ownerInnerWindow = ownerDoc->GetInnerWindow();
if (!ownerInnerWindow) {
return false;
}
@ -12423,7 +12417,7 @@ nsDocument::ShouldLockPointer(Element* aElement, Element* aCurrentLock,
return false;
}
nsCOMPtr<nsPIDOMWindow> top = ownerWindow->GetScriptableTop();
nsCOMPtr<nsPIDOMWindowOuter> top = ownerWindow->GetScriptableTop();
if (!top || !top->GetExtantDoc() || top->GetExtantDoc()->Hidden()) {
NS_WARNING("ShouldLockPointer(): Top document isn't visible.");
return false;
@ -12444,7 +12438,7 @@ bool
nsDocument::SetPointerLock(Element* aElement, int aCursorStyle)
{
// NOTE: aElement will be nullptr when unlocking.
nsCOMPtr<nsPIDOMWindow> window = GetWindow();
nsCOMPtr<nsPIDOMWindowOuter> window = GetWindow();
if (!window) {
NS_WARNING("SetPointerLock(): No Window");
return false;
@ -12892,7 +12886,7 @@ nsIDocument::GetTopLevelContentDocument()
if (!mLoadedAsData) {
parent = static_cast<nsDocument*>(this);
} else {
nsCOMPtr<nsPIDOMWindow> window = do_QueryInterface(GetScopeObject());
nsCOMPtr<nsPIDOMWindowInner> window = do_QueryInterface(GetScopeObject());
if (!window) {
return nullptr;
}
@ -13219,9 +13213,8 @@ nsAutoSyncOperation::nsAutoSyncOperation(nsIDocument* aDoc)
mMicroTaskLevel = nsContentUtils::MicroTaskLevel();
nsContentUtils::SetMicroTaskLevel(0);
if (aDoc) {
nsPIDOMWindow* win = aDoc->GetWindow();
if (win) {
if (nsCOMPtr<nsPIDOMWindow> top = win->GetTop()) {
if (nsPIDOMWindowOuter* win = aDoc->GetWindow()) {
if (nsCOMPtr<nsPIDOMWindowOuter> top = win->GetTop()) {
nsCOMPtr<nsIDocument> doc = top->GetExtantDoc();
MarkDocumentTreeToBeInSyncOperation(doc, &mDocuments);
}
@ -13294,7 +13287,7 @@ nsIDocument::FlushUserFontSet()
bool changed = false;
if (!mFontFaceSet && !rules.IsEmpty()) {
nsCOMPtr<nsPIDOMWindow> window = do_QueryInterface(GetScopeObject());
nsCOMPtr<nsPIDOMWindowInner> window = do_QueryInterface(GetScopeObject());
mFontFaceSet = new FontFaceSet(window, this);
}
if (mFontFaceSet) {
@ -13350,7 +13343,7 @@ FontFaceSet*
nsIDocument::Fonts()
{
if (!mFontFaceSet) {
nsCOMPtr<nsPIDOMWindow> window = do_QueryInterface(GetScopeObject());
nsCOMPtr<nsPIDOMWindowInner> window = do_QueryInterface(GetScopeObject());
mFontFaceSet = new FontFaceSet(window, this);
GetUserFontSet(); // this will cause the user font set to be created/updated
}

Просмотреть файл

@ -1512,7 +1512,7 @@ protected:
const nsAString& aType,
bool aPersisted);
virtual nsPIDOMWindow *GetWindowInternal() const override;
virtual nsPIDOMWindowOuter* GetWindowInternal() const override;
virtual nsIScriptGlobalObject* GetScriptHandlingObjectInternal() const override;
virtual bool InternalAllowXULXBL() override;

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше