Bug 1646582 - Remove DOM(Inner)WindowID from nsIWebProgress. r=nika

Differential Revision: https://phabricator.services.mozilla.com/D80128
This commit is contained in:
Matt Woodrow 2020-06-23 01:23:57 +00:00
Родитель 899c6f8198
Коммит 79562a2ca1
12 изменённых файлов: 19 добавлений и 130 удалений

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

@ -47,16 +47,6 @@ NS_IMETHODIMP BrowsingContextWebProgress::GetDOMWindow(
return NS_ERROR_NOT_AVAILABLE;
}
NS_IMETHODIMP BrowsingContextWebProgress::GetDOMWindowID(
uint64_t* aDOMWindowID) {
return NS_ERROR_NOT_AVAILABLE;
}
NS_IMETHODIMP BrowsingContextWebProgress::GetInnerDOMWindowID(
uint64_t* aInnerDOMWindowID) {
return NS_ERROR_NOT_AVAILABLE;
}
NS_IMETHODIMP BrowsingContextWebProgress::GetIsTopLevel(bool* aIsTopLevel) {
*aIsTopLevel = true;
return NS_OK;

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

@ -3748,16 +3748,19 @@ nsresult BrowserChild::PrepareProgressListenerData(
NS_ENSURE_SUCCESS(rv, rv);
aWebProgressData->loadType() = loadType;
uint64_t outerDOMWindowID = 0;
uint64_t innerDOMWindowID = 0;
// The DOM Window ID getters here may throw if the inner or outer windows
// aren't created yet or are destroyed at the time we're making this call
// but that isn't fatal so ignore the exceptions here.
Unused << aWebProgress->GetDOMWindowID(&outerDOMWindowID);
aWebProgressData->outerDOMWindowID() = outerDOMWindowID;
Unused << aWebProgress->GetInnerDOMWindowID(&innerDOMWindowID);
aWebProgressData->innerDOMWindowID() = innerDOMWindowID;
nsCOMPtr<mozIDOMWindowProxy> window;
rv = aWebProgress->GetDOMWindow(getter_AddRefs(window));
if (NS_SUCCEEDED(rv) && window) {
if (nsCOMPtr<nsPIDOMWindowOuter> outer =
nsPIDOMWindowOuter::From(window)) {
if (nsPIDOMWindowInner* inner = outer->GetCurrentInnerWindow()) {
aWebProgressData->innerDOMWindowID() = inner->WindowID();
}
}
}
}
nsCOMPtr<nsIChannel> channel = do_QueryInterface(aRequest);

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

@ -2868,12 +2868,11 @@ void BrowserParent::ReconstructWebProgressAndRequest(
nsCOMPtr<nsIWebProgress> webProgress;
if (aWebProgressData) {
webProgress = new RemoteWebProgress(
aManager, aWebProgressData->outerDOMWindowID(),
aWebProgressData->innerDOMWindowID(), aWebProgressData->loadType(),
aWebProgressData->isLoadingDocument(), aWebProgressData->isTopLevel());
webProgress = new RemoteWebProgress(aManager, aWebProgressData->loadType(),
aWebProgressData->isLoadingDocument(),
aWebProgressData->isTopLevel());
} else {
webProgress = new RemoteWebProgress(aManager, 0, 0, 0, false, false);
webProgress = new RemoteWebProgress(aManager, 0, false, false);
}
webProgress.forget(aOutWebProgress);

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

@ -106,7 +106,6 @@ struct WebProgressData
bool isTopLevel;
bool isLoadingDocument;
uint32_t loadType;
uint64_t outerDOMWindowID;
uint64_t innerDOMWindowID;
};

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

@ -26,18 +26,6 @@ NS_IMETHODIMP RemoteWebProgress::Init(nsIWebProgress* aManager,
return NS_OK;
}
NS_IMETHODIMP RemoteWebProgress::Update(uint64_t aOuterDOMWindowID,
uint64_t aInnerDOMWindowID,
uint32_t aLoadType,
bool aIsLoadingDocument) {
mOuterDOMWindowID = aOuterDOMWindowID;
mInnerDOMWindowID = aInnerDOMWindowID;
mLoadType = aLoadType;
mIsLoadingDocument = aIsLoadingDocument;
return NS_OK;
}
NS_IMETHODIMP RemoteWebProgress::AddProgressListener(
nsIWebProgressListener* aListener, uint32_t aNotifyMask) {
if (mManager) {
@ -64,17 +52,6 @@ NS_IMETHODIMP RemoteWebProgress::GetDOMWindow(mozIDOMWindowProxy** aDOMWindow) {
return NS_ERROR_NOT_AVAILABLE;
}
NS_IMETHODIMP RemoteWebProgress::GetDOMWindowID(uint64_t* aDOMWindowID) {
*aDOMWindowID = mOuterDOMWindowID;
return NS_OK;
}
NS_IMETHODIMP RemoteWebProgress::GetInnerDOMWindowID(
uint64_t* aInnerDOMWindowID) {
*aInnerDOMWindowID = mInnerDOMWindowID;
return NS_OK;
}
NS_IMETHODIMP RemoteWebProgress::GetIsTopLevel(bool* aIsTopLevel) {
NS_ENSURE_ARG_POINTER(aIsTopLevel);
*aIsTopLevel = mIsTopLevel;

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

@ -22,18 +22,13 @@ class RemoteWebProgress final : public nsIRemoteWebProgress {
RemoteWebProgress()
: mManager(nullptr),
mOuterDOMWindowID(0),
mInnerDOMWindowID(0),
mLoadType(0),
mIsLoadingDocument(false),
mIsTopLevel(false) {}
RemoteWebProgress(nsIWebProgress* aManager, uint64_t aOuterDOMWindowID,
uint64_t aInnerDOMWindowID, uint32_t aLoadType,
RemoteWebProgress(nsIWebProgress* aManager, uint32_t aLoadType,
bool aIsLoadingDocument, bool aIsTopLevel)
: mManager(aManager),
mOuterDOMWindowID(aOuterDOMWindowID),
mInnerDOMWindowID(aInnerDOMWindowID),
mLoadType(aLoadType),
mIsLoadingDocument(aIsLoadingDocument),
mIsTopLevel(aIsTopLevel) {}
@ -43,8 +38,6 @@ class RemoteWebProgress final : public nsIRemoteWebProgress {
nsCOMPtr<nsIWebProgress> mManager;
uint64_t mOuterDOMWindowID;
uint64_t mInnerDOMWindowID;
uint32_t mLoadType;
bool mIsLoadingDocument;
bool mIsTopLevel;

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

@ -493,9 +493,8 @@ void WindowGlobalParent::NotifyContentBlockingEvent(
return;
}
nsCOMPtr<nsIWebProgress> webProgress =
new RemoteWebProgress(manager, OuterWindowId(), InnerWindowId(), 0,
false, BrowsingContext()->IsTopContent());
nsCOMPtr<nsIWebProgress> webProgress = new RemoteWebProgress(
manager, 0, false, BrowsingContext()->IsTopContent());
Unused << managerAsListener->OnContentBlockingEvent(webProgress, aRequest,
event.value());

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

@ -14,17 +14,4 @@ interface nsIRemoteWebProgress : nsIWebProgress {
*/
void init(in nsIWebProgress aManager,
in boolean aIsTopLevel);
/**
* Update the RemoteWebProgress with values from the content process.
*
* @param aOuterWindowID The outer window ID.
* @param aInnerWindowID The inner window ID.
* @param aLoadType The load type.
* @param aIsLoadingDocument Whether or not a document is being loaded.
*/
void update(in uint64_t aOuterWindowID,
in uint64_t aInnerWindowID,
in uint32_t aLoadType,
in boolean aIsLoadingDocument);
};

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

@ -284,14 +284,8 @@ NS_IMETHODIMP TabListener::OnStateChange(nsIWebProgress* aWebProgress,
return NS_OK;
}
// The DOM Window ID getter here may throw if the inner or outer windows
// aren't created yet or are destroyed at the time we're making this call
// but that isn't fatal so ignore the exceptions here.
uint64_t DOMWindowID = 0;
Unused << aWebProgress->GetDOMWindowID(&DOMWindowID);
nsCOMPtr<nsPIDOMWindowOuter> window = do_GetInterface(mDocShell);
NS_ENSURE_TRUE(window, NS_ERROR_FAILURE);
if (DOMWindowID != window->WindowID()) {
nsCOMPtr<nsIWebProgress> webProgress = do_QueryInterface(mDocShell);
if (webProgress != aWebProgress) {
return NS_OK;
}

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

@ -71,20 +71,6 @@ nsBrowserStatusFilter::GetDOMWindow(mozIDOMWindowProxy** aResult) {
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsBrowserStatusFilter::GetDOMWindowID(uint64_t* aResult) {
*aResult = 0;
MOZ_ASSERT_UNREACHABLE("nsBrowserStatusFilter::GetDOMWindowID");
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsBrowserStatusFilter::GetInnerDOMWindowID(uint64_t* aResult) {
*aResult = 0;
MOZ_ASSERT_UNREACHABLE("nsBrowserStatusFilter::GetInnerDOMWindowID");
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsBrowserStatusFilter::GetIsTopLevel(bool* aIsTopLevel) {
*aIsTopLevel = false;

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

@ -980,42 +980,6 @@ nsDocLoader::GetDOMWindow(mozIDOMWindowProxy** aResult) {
return CallGetInterface(this, aResult);
}
NS_IMETHODIMP
nsDocLoader::GetDOMWindowID(uint64_t* aResult) {
*aResult = 0;
nsCOMPtr<mozIDOMWindowProxy> window;
nsresult rv = GetDOMWindow(getter_AddRefs(window));
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsPIDOMWindowOuter> piwindow = nsPIDOMWindowOuter::From(window);
NS_ENSURE_STATE(piwindow);
*aResult = piwindow->WindowID();
return NS_OK;
}
NS_IMETHODIMP
nsDocLoader::GetInnerDOMWindowID(uint64_t* aResult) {
*aResult = 0;
nsCOMPtr<mozIDOMWindowProxy> window;
nsresult rv = GetDOMWindow(getter_AddRefs(window));
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsPIDOMWindowOuter> outer = nsPIDOMWindowOuter::From(window);
NS_ENSURE_STATE(outer);
nsPIDOMWindowInner* inner = outer->GetCurrentInnerWindow();
if (!inner) {
// If we don't have an inner window, return 0.
return NS_OK;
}
*aResult = inner->WindowID();
return NS_OK;
}
NS_IMETHODIMP
nsDocLoader::GetIsTopLevel(bool* aResult) {
nsCOMPtr<nsIDocShell> docShell = do_QueryInterface(this);

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

@ -137,8 +137,6 @@ interface nsIWebProgress : nsISupports
* Indicates that there is no associated DOM window.
*/
readonly attribute mozIDOMWindowProxy DOMWindow;
readonly attribute uint64_t DOMWindowID;
readonly attribute uint64_t innerDOMWindowID;
/**
* Indicates whether DOMWindow.top == DOMWindow.