Issue #2653 - Part 1: Initial cleanup of AppId and isolated mozbrowser.

This removes a lot of the plumbing for having the platform embed itself
through IPC which was required for B2G running the browser as both
shell and browser application.
This commit is contained in:
Moonchild 2024-11-17 20:39:45 +01:00 committed by roytam1
commit 7b6e3a2d4a
77 changed files with 295 additions and 1799 deletions

View file

@ -4485,7 +4485,7 @@ nsGlobalWindow::GetParentOuter()
}
nsCOMPtr<nsPIDOMWindowOuter> parent;
if (mDocShell->GetIsMozBrowserOrApp()) {
if (mDocShell->GetIsMozBrowser()) {
parent = AsOuter();
} else {
parent = GetParent();
@ -4543,7 +4543,7 @@ nsGlobalWindow::GetParent()
}
nsCOMPtr<nsIDocShell> parent;
mDocShell->GetSameTypeParentIgnoreBrowserAndAppBoundaries(getter_AddRefs(parent));
mDocShell->GetSameTypeParentIgnoreBrowserBoundaries(getter_AddRefs(parent));
if (parent) {
nsCOMPtr<nsPIDOMWindowOuter> win = parent->GetWindow();
@ -4662,9 +4662,9 @@ nsGlobalWindow::GetContentInternal(ErrorResult& aError, bool aUnprivilegedCaller
return domWindow.forget();
}
// If we're contained in <iframe mozbrowser> or <iframe mozapp>, then
// GetContent is the same as window.top.
if (mDocShell && mDocShell->GetIsInMozBrowserOrApp()) {
// If we're contained in <iframe mozbrowser>, then GetContent is the same as
// window.top.
if (mDocShell && mDocShell->GetIsInMozBrowser()) {
return GetTopOuter();
}
@ -7992,7 +7992,7 @@ nsGlobalWindow::ResizeToOuter(int32_t aWidth, int32_t aHeight, ErrorResult& aErr
* If caller is a browser-element then dispatch a resize event to
* the embedder.
*/
if (mDocShell && mDocShell->GetIsMozBrowserOrApp()) {
if (mDocShell && mDocShell->GetIsMozBrowser()) {
CSSIntSize size(aWidth, aHeight);
if (!DispatchResizeEvent(size)) {
// The embedder chose to prevent the default action for this
@ -8042,7 +8042,7 @@ nsGlobalWindow::ResizeByOuter(int32_t aWidthDif, int32_t aHeightDif,
* If caller is a browser-element then dispatch a resize event to
* parent.
*/
if (mDocShell && mDocShell->GetIsMozBrowserOrApp()) {
if (mDocShell && mDocShell->GetIsMozBrowser()) {
CSSIntSize size;
if (NS_FAILED(GetInnerSize(size))) {
return;
@ -9013,7 +9013,7 @@ nsGlobalWindow::CloseOuter(bool aTrustedCaller)
MOZ_RELEASE_ASSERT(IsOuterWindow());
if (!mDocShell || IsInModalState() ||
(IsFrame() && !mDocShell->GetIsMozBrowserOrApp())) {
(IsFrame() && !mDocShell->GetIsMozBrowser())) {
// window.close() is called on a frame in a frameset, on a window
// that's already closed, or on a window for which there's
// currently a modal dialog open. Ignore such calls.
@ -9034,14 +9034,13 @@ nsGlobalWindow::CloseOuter(bool aTrustedCaller)
return;
}
// Don't allow scripts from content to close non-app or non-neterror
// windows that were not opened by script.
// Don't allow scripts from content to close non-neterror windows that
// were not opened by script.
nsAutoString url;
nsresult rv = mDoc->GetURL(url);
NS_ENSURE_SUCCESS_VOID(rv);
if (!mDocShell->GetIsApp() &&
!StringBeginsWith(url, NS_LITERAL_STRING("about:neterror")) &&
if (!StringBeginsWith(url, NS_LITERAL_STRING("about:neterror")) &&
!mHadOriginalOpener && !aTrustedCaller) {
bool allowClose = mAllowScriptsToClose ||
Preferences::GetBool("dom.allow_scripts_to_close_windows", true);
@ -9489,7 +9488,7 @@ nsGlobalWindow::GetFrameElementOuter(nsIPrincipal& aSubjectPrincipal)
{
MOZ_RELEASE_ASSERT(IsOuterWindow());
if (!mDocShell || mDocShell->GetIsMozBrowserOrApp()) {
if (!mDocShell || mDocShell->GetIsMozBrowser()) {
return nullptr;
}
@ -9524,7 +9523,7 @@ nsGlobalWindow::GetRealFrameElementOuter()
}
nsCOMPtr<nsIDocShell> parent;
mDocShell->GetSameTypeParentIgnoreBrowserAndAppBoundaries(getter_AddRefs(parent));
mDocShell->GetSameTypeParentIgnoreBrowserBoundaries(getter_AddRefs(parent));
if (!parent || parent == mDocShell) {
// We're at a chrome boundary, don't expose the chrome iframe