Bug 1870512 - Remove top-level windows with WindowType::Popup. r=tnikkel,sessionstore-reviewers,dao

These are only used right now for XUL notifications. They are extremely
weird (I bet there's tons of code that assume that WindowType::Popup
corresponds to nsMenuPopupFrame), and afaict there's no good reason why
these have to be this way.

They no longer are on Linux (because Wayland doesn't support such
thing for example).

XUL alerts work fine with this patch on all platforms after some basic
testing.

The other usage of this for the gfx sanity test can use type=dialog.
Actually it can just be a toplevel, but that breaks the XUL skeleton UI.

Differential Revision: https://phabricator.services.mozilla.com/D196665
This commit is contained in:
Emilio Cobos Álvarez 2023-12-20 18:38:57 +00:00
parent 644a6bc997
commit 8d837fe97f
7 changed files with 7 additions and 34 deletions

View file

@ -80,19 +80,6 @@ const CHROME_FLAGS_MAP = [
// Do not inherit remoteness and fissionness from the previous session. // Do not inherit remoteness and fissionness from the previous session.
//[Ci.nsIWebBrowserChrome.CHROME_REMOTE_WINDOW, "remote", "non-remote"], //[Ci.nsIWebBrowserChrome.CHROME_REMOTE_WINDOW, "remote", "non-remote"],
//[Ci.nsIWebBrowserChrome.CHROME_FISSION_WINDOW, "fission", "non-fission"], //[Ci.nsIWebBrowserChrome.CHROME_FISSION_WINDOW, "fission", "non-fission"],
[Ci.nsIWebBrowserChrome.CHROME_WINDOW_POPUP, "popup"],
[
Ci.nsIWebBrowserChrome.CHROME_WINDOW_POPUP |
Ci.nsIWebBrowserChrome.CHROME_TITLEBAR,
"",
"titlebar=0",
],
[
Ci.nsIWebBrowserChrome.CHROME_WINDOW_POPUP |
Ci.nsIWebBrowserChrome.CHROME_WINDOW_CLOSE,
"",
"close=0",
],
[Ci.nsIWebBrowserChrome.CHROME_WINDOW_LOWERED, "alwayslowered"], [Ci.nsIWebBrowserChrome.CHROME_WINDOW_LOWERED, "alwayslowered"],
[Ci.nsIWebBrowserChrome.CHROME_WINDOW_RAISED, "alwaysraised"], [Ci.nsIWebBrowserChrome.CHROME_WINDOW_RAISED, "alwaysraised"],
// "chrome" and "suppressanimation" are always set. // "chrome" and "suppressanimation" are always set.

View file

@ -354,7 +354,7 @@ nsXULAlerts::ShowAlertWithIconURI(nsIAlertNotification* aAlert,
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<mozIDOMWindowProxy> newWindow; nsCOMPtr<mozIDOMWindowProxy> newWindow;
nsAutoCString features("chrome,dialog=yes,titlebar=no,popup=yes"); nsAutoCString features("chrome,dialog=yes,titlebar=no");
if (inPrivateBrowsing) { if (inPrivateBrowsing) {
features.AppendLiteral(",private"); features.AppendLiteral(",private");
} }

View file

@ -47,7 +47,6 @@ interface nsIWebBrowserChrome : nsISupports
// special cases // special cases
const unsigned long CHROME_WINDOW_MIN = 0x00004000; const unsigned long CHROME_WINDOW_MIN = 0x00004000;
const unsigned long CHROME_WINDOW_POPUP = 0x00008000;
// whether to open a new private window. CHROME_NON_PRIVATE_WINDOW // whether to open a new private window. CHROME_NON_PRIVATE_WINDOW
// forces the opened window to be non-private, and overrides // forces the opened window to be non-private, and overrides

View file

@ -425,7 +425,7 @@ SanityTest.prototype = {
PAGE_WIDTH + PAGE_WIDTH +
",height=" + ",height=" +
PAGE_HEIGHT + PAGE_HEIGHT +
",chrome,titlebar=0,scrollbars=0,popup=1", ",chrome,titlebar=0,scrollbars=0,dialog=1",
null null
); );

View file

@ -1963,10 +1963,6 @@ uint32_t nsWindowWatcher::CalculateChromeFlagsForSystem(
chromeFlags |= nsIWebBrowserChrome::CHROME_FISSION_WINDOW; chromeFlags |= nsIWebBrowserChrome::CHROME_FISSION_WINDOW;
} }
if (aFeatures.GetBoolWithDefault("popup", false, &presenceFlag)) {
chromeFlags |= nsIWebBrowserChrome::CHROME_WINDOW_POPUP;
}
/* OK. /* OK.
Normal browser windows, in spite of a stated pattern of turning off Normal browser windows, in spite of a stated pattern of turning off
all chrome not mentioned explicitly, will want the new OS chrome (window all chrome not mentioned explicitly, will want the new OS chrome (window
@ -1975,14 +1971,12 @@ uint32_t nsWindowWatcher::CalculateChromeFlagsForSystem(
to mean "OS' choice." */ to mean "OS' choice." */
// default titlebar and closebox to "on," if not mentioned at all // default titlebar and closebox to "on," if not mentioned at all
if (!(chromeFlags & nsIWebBrowserChrome::CHROME_WINDOW_POPUP)) {
if (!aFeatures.Exists("titlebar")) { if (!aFeatures.Exists("titlebar")) {
chromeFlags |= nsIWebBrowserChrome::CHROME_TITLEBAR; chromeFlags |= nsIWebBrowserChrome::CHROME_TITLEBAR;
} }
if (!aFeatures.Exists("close")) { if (!aFeatures.Exists("close")) {
chromeFlags |= nsIWebBrowserChrome::CHROME_WINDOW_CLOSE; chromeFlags |= nsIWebBrowserChrome::CHROME_WINDOW_CLOSE;
} }
}
if (aDialog && !aFeatures.IsEmpty() && !presenceFlag) { if (aDialog && !aFeatures.IsEmpty() && !presenceFlag) {
chromeFlags = nsIWebBrowserChrome::CHROME_DEFAULT; chromeFlags = nsIWebBrowserChrome::CHROME_DEFAULT;

View file

@ -37,10 +37,6 @@ const DISALLOWED = {
// "remote": // "remote":
// checked manually, since its default value will // checked manually, since its default value will
// depend on whether or not e10s is enabled by default. // depend on whether or not e10s is enabled by default.
popup: {
flag: Ci.nsIWebBrowserChrome.CHROME_WINDOW_POPUP,
defaults_to: false,
},
alwaysLowered: { alwaysLowered: {
flag: Ci.nsIWebBrowserChrome.CHROME_WINDOW_LOWERED, flag: Ci.nsIWebBrowserChrome.CHROME_WINDOW_LOWERED,
defaults_to: false, defaults_to: false,

View file

@ -567,9 +567,6 @@ nsresult nsAppShellService::JustCreateTopWindow(
? widget::WindowType::Dialog ? widget::WindowType::Dialog
: widget::WindowType::TopLevel; : widget::WindowType::TopLevel;
if (aChromeMask & nsIWebBrowserChrome::CHROME_WINDOW_POPUP)
widgetInitData.mWindowType = widget::WindowType::Popup;
if (aChromeMask & nsIWebBrowserChrome::CHROME_SUPPRESS_ANIMATION) if (aChromeMask & nsIWebBrowserChrome::CHROME_SUPPRESS_ANIMATION)
widgetInitData.mIsAnimationSuppressed = true; widgetInitData.mIsAnimationSuppressed = true;