Commit Graph

283 Commits

Author SHA1 Message Date
Sandor Molnar
e73ab8eb7e Backed out 4 changesets (bug 1786048) for causing multiple failures. CLOSED TREE
Backed out changeset ae94135e68ef (bug 1786048)
Backed out changeset f505df8a481a (bug 1786048)
Backed out changeset 999a18d6f33e (bug 1786048)
Backed out changeset e71e8644b8a9 (bug 1786048)
2022-12-02 20:30:07 +02:00
Matthias Camenzind
8e1fad1ece Bug 1786048 - Part 2: Use layout device pixels for AppWindow primary content size. r=emilio
The getter used to return CSS pixels, while the setter expected layout
device pixels. The nsIDocShellTreeOwner documentation used to suggest that
CSS pixels are used for getters and setters of the primary content and
the root shell size. Only the getter for the primary content size
happend to match that documentation.

Differential Revision: https://phabricator.services.mozilla.com/D161944
2022-12-02 16:47:45 +00:00
Marian-Vasile Laza
dd80667326 Backed out 4 changesets (bug 1786048) for causing bc failures on browser_modal_resize.js. CLOSED TREE
Backed out changeset 318a2d2e6e39 (bug 1786048)
Backed out changeset 17a9990d6d19 (bug 1786048)
Backed out changeset 205f129c648a (bug 1786048)
Backed out changeset 0750c885a688 (bug 1786048)
2022-12-01 05:00:38 +02:00
Matthias Camenzind
e5c4c5d82a Bug 1786048 - Part 2: Use layout device pixels for AppWindow primary content size. r=emilio
The getter used to return CSS pixels, while the setter expected layout
device pixels. The nsIDocShellTreeOwner documentation used to suggest that
CSS pixels are used for getters and setters of the primary content and
the root shell size. Only the getter for the primary content size
happend to match that documentation.

Differential Revision: https://phabricator.services.mozilla.com/D161944
2022-11-30 19:37:16 +00:00
Jens Stutte
039755a238 Bug 1669836 - Bail out from modal dialog during shutdown. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D161038
2022-11-04 14:01:06 +00:00
Matthias Camenzind
aeaaf78870 Bug 1793605 - Flush layout in window.open calls with specified size. r=emilio
Without flushing the layout, new windows appear to the opener to
initially open at the size of the opener instead of the specified size.

We can flush the layout unconditionally when we have a specified size
where we otherwise would make sure that the frame loader has been
reflowed at least once.

Thanks to Emilio for providing the changes to avoid tokenizing the
window features twice.

Differential Revision: https://phabricator.services.mozilla.com/D158584
2022-10-14 16:35:49 +00:00
Pier Angelo Vendrame
84d4cdac44 Bug 1768907 - Part 1: Make browser.privatebrowsing.autostart a static pref. r=handyman,necko-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D157843
2022-09-22 00:26:17 +00:00
Nika Layzell
f83281029e Bug 1694993 - Part 7: Don't set LOAD_FLAGS_DISALLOW_INHERIT_PRINCIPAL for chrome windows, r=smaug
Depends on D155277

Differential Revision: https://phabricator.services.mozilla.com/D157514
2022-09-20 23:29:09 +00:00
Nika Layzell
be38cf1f2d Bug 1694993 - Part 6: Preserve precursor principal through LOAD_FLAGS_DISALLOW_INHERIT_PRINCIPAL, r=ckerschb,smaug
If we don't preserve the precursor principal in this case, we'll end up
doing an unnecessary process switch in some cases, which lead to a
test failure.

This patch also cleans up some logic around the first party origin
attribute with null principals, as the logic was only used in one place
and generally added some unnecessary complexity to NullPrincipal
itself.

Differential Revision: https://phabricator.services.mozilla.com/D155277
2022-09-20 23:29:08 +00:00
Nika Layzell
6efe4c402a Bug 1694993 - Part 4: Copy session storage before loading, and only for newly created windows, r=smaug
Previously we would copy session storage even if we were not opening a new
window, meaning that a targeted load could re-trigger a copy. This was not
specified in the standard so is being changed to only copy when a new window is
created. In addition, the copy was moved before navigaton starts, again for
more consistency with ordering for the standard, such that things like
`javascript:` URI loads will oberve the up-to-date session storage.

Differential Revision: https://phabricator.services.mozilla.com/D154566
2022-09-20 23:29:07 +00:00
Nika Layzell
80464c0613 Bug 1694993 - Part 3: Rename some variables in nsWindowWatcher for clarity, r=smaug
The `newBC` and `newDocShell` variables were potentially confusing, as they
could also be existing windows selected by named targeting or the window
provider, so they have been renamed. Some other variables were also renamed for
consistency and clarity.

Differential Revision: https://phabricator.services.mozilla.com/D154565
2022-09-20 23:29:07 +00:00
Nika Layzell
71bdc7eff9 Bug 1694993 - Part 2: Explicitly select the principal for newly created windows in nsWindowWatcher, r=smaug
When opening a window with `noopener`, we will no longer inherit the
subject principal into the newly created window's initial about:blank
document, instead creating a new null principal.

This patch also makes the system/expanded principal -> null principal
translation happen earlier (it previously happened in
SetInitialPrincipalToSubject), so that it can be followed more easily
when reading the code.

Finally, the load started by nsWindowWatcher in new windows is updated
to specify `LOAD_FLAGS_DISALLOW_INHERIT_PRINCIPAL` when noopener is
specified such that the explicit about:blank load also cannot inherit
the subject principal.

This change does make it so that the global is not re-used between the
initial and loaded about:blank document, however this shouldn't be
visible due to `noopener` being specified, preventing any references to
the initial document from existing.

Noopener loads with `javascript:` URIs will be rejected early during the
load due to the mismatch between the triggering principal and the
initial about:blank document's principal.

Differential Revision: https://phabricator.services.mozilla.com/D154564
2022-09-20 23:29:06 +00:00
Nika Layzell
e43002e923 Bug 1694993 - Part 1: Be more explicit about principals used when creating pop-up windows, r=smaug
Previously we would pull this information frequently from the subject
principal, which is unreliable. With this new approach, we more explicitly pass
the principals around as-needed into where they're going to be used.

Some assertions about the subject principal were introduced to ensure that
assumptions made about chrome windows and the system principal are not
incorrect.

Differential Revision: https://phabricator.services.mozilla.com/D154563
2022-09-20 23:29:06 +00:00
Narcis Beleuzu
18df59b6c5 Backed out 5 changesets (bug 1694993) for bc failure on browser_cross_process_csp_inheritance.js
Backed out changeset 1d21d911b3e7 (bug 1694993)
Backed out changeset 3b412d5fbdcf (bug 1694993)
Backed out changeset c9585ce37fe5 (bug 1694993)
Backed out changeset 05d7cbbfe9e2 (bug 1694993)
Backed out changeset 3821545ab46b (bug 1694993)
2022-08-22 20:32:02 +03:00
Nika Layzell
2dd1f1bef3 Bug 1694993 - Part 4: Copy session storage before loading, and only for newly created windows, r=smaug
Previously we would copy session storage even if we were not opening a new
window, meaning that a targeted load could re-trigger a copy. This was not
specified in the standard so is being changed to only copy when a new window is
created. In addition, the copy was moved before navigaton starts, again for
more consistency with ordering for the standard, such that things like
`javascript:` URI loads will oberve the up-to-date session storage.

Depends on D154565

Differential Revision: https://phabricator.services.mozilla.com/D154566
2022-08-22 15:35:28 +00:00
Nika Layzell
2d921e2137 Bug 1694993 - Part 3: Rename some variables in nsWindowWatcher for clarity, r=smaug
The `newBC` and `newDocShell` variables were potentially confusing, as they
could also be existing windows selected by named targeting or the window
provider, so they have been renamed. Some other variables were also renamed for
consistency and clarity.

Depends on D154564

Differential Revision: https://phabricator.services.mozilla.com/D154565
2022-08-22 15:35:28 +00:00
Nika Layzell
4c0c47fb06 Bug 1694993 - Part 2: Explicitly select the principal for newly created windows in nsWindowWatcher, r=smaug
When opening a window with `noopener`, we will no longer inherit the
subject principal into the newly created window's initial about:blank
document, instead creating a new null principal.

This patch also makes the system/expanded principal -> null principal
translation happen earlier (it previously happened in
SetInitialPrincipalToSubject), so that it can be followed more easily
when reading the code.

Finally, the load started by nsWindowWatcher in new windows is updated
to specify `LOAD_FLAGS_DISALLOW_INHERIT_PRINCIPAL` when noopener is
specified such that the explicit about:blank load also cannot inherit
the subject principal.

This change does make it so that the global is not re-used between the
initial and loaded about:blank document, however this shouldn't be
visible due to `noopener` being specified, preventing any references to
the initial document from existing.

Noopener loads with `javascript:` URIs will be rejected early during the
load due to the mismatch between the triggering principal and the
initial about:blank document's principal.

Depends on D154563

Differential Revision: https://phabricator.services.mozilla.com/D154564
2022-08-22 15:35:27 +00:00
Nika Layzell
8b31eed19f Bug 1694993 - Part 1: Be more explicit about principals used when creating pop-up windows, r=smaug
Previously we would pull this information frequently from the subject
principal, which is unreliable. With this new approach, we more explicitly pass
the principals around as-needed into where they're going to be used.

Some assertions about the subject principal were introduced to ensure that
assumptions made about chrome windows and the system principal are not
incorrect.

Differential Revision: https://phabricator.services.mozilla.com/D154563
2022-08-22 15:35:27 +00:00
Olli Pettay
a4189cae8a Bug 1777572, opener going away while opening a new window should not affect csp behavior, r=nika
Differential Revision: https://phabricator.services.mozilla.com/D151767
2022-07-20 21:51:27 +00:00
Emilio Cobos Álvarez
bcabeab0f8 Bug 1773813 - Incorporate OS zoom factor in window sizing calculations. r=tnikkel
In bug 1773342 I made OS text scale factor behave like a full zoom
factor which applies to all pages (including the browser chrome). That's
generally straight forward but it makes some callsites that use unzoomed
CSS coordinates misbehave (or behave correctly accidentally actually in
some other cases).

The main fix here is making
nsIBaseWindow::UnscaledDevicePixelsPerCSSPixel() and
nsIScreen::GetDefaultCSSScaleFactor() account for OS zoom as necessary.
However, I also went through the relevant code and cleaned it up to use
typed units and operations when possible.

The setup means:

 * nsIWidget::GetDefaultScale() doesn't account for OS full zoom.
 * nsIBaseWindow and nsIScreen does.

These are the places where this should matter and stuff can get
confused, but this works surprisingly well for all callers (except one
nsDeviceContext one which we use only for PuppetWidget and we can
remove by falling back to 1.0 like all other widgets until the update
comes).

Differential Revision: https://phabricator.services.mozilla.com/D149033
2022-06-14 15:01:52 +00:00
Norisz Fay
994a679882 Backed out changeset da5c71190673 (bug 1773813) for causing build bustages CLOSED TREE 2022-06-14 15:13:58 +03:00
Emilio Cobos Álvarez
bbb4f4acce Bug 1773813 - Incorporate OS zoom factor in window sizing calculations. r=tnikkel
In bug 1773342 I made OS text scale factor behave like a full zoom
factor which applies to all pages (including the browser chrome). That's
generally straight forward but it makes some callsites that use unzoomed
CSS coordinates misbehave (or behave correctly accidentally actually in
some other cases).

The main fix here is making
nsIBaseWindow::UnscaledDevicePixelsPerCSSPixel() and
nsIScreen::GetDefaultCSSScaleFactor() account for OS zoom as necessary.
However, I also went through the relevant code and cleaned it up to use
typed units and operations when possible.

The setup means:

 * nsIWidget::GetDefaultScale() doesn't account for OS full zoom.
 * nsIBaseWindow and nsIScreen does.

These are the places where this should matter and stuff can get
confused, but this works surprisingly well for all callers (except one
nsDeviceContext one which we use only for PuppetWidget and we can
remove by falling back to 1.0 like all other widgets until the update
comes).

Differential Revision: https://phabricator.services.mozilla.com/D149033
2022-06-14 11:37:25 +00:00
Andrew McCreight
e6b3b777a0 Bug 1152440, part 2 - Only declare one variable per line in SizeOpenedWindow. r=smaug
Also remove a closing */ that snuck in somehow.

Differential Revision: https://phabricator.services.mozilla.com/D147745
2022-05-31 13:31:14 +00:00
Andrew McCreight
d5abf42f68 Bug 1152440, part 1 - Replace 0 with nullptr in nsWindowWatcher.cpp. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D147744
2022-05-31 13:31:13 +00:00
Edgar Chen
96dc2e3250 Bug 1746448; r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D143483
2022-04-20 15:37:47 +00:00
Emilio Cobos Álvarez
1d3d68c79f Bug 1755134 - Tweak full zoom handling to match our pre-existing behavior.
MANUAL PUSH: Trivial-ish orange fix CLOSED TREE
2022-02-17 23:07:33 +01:00
Emilio Cobos Álvarez
d314336f6d Bug 1755134 - Fix a typo to fix browser_new_sized_window.js failures.
MANUAL PUSH: Trivial orange fix CLOSED TREE
2022-02-17 22:52:29 +01:00
Emilio Cobos Álvarez
a53d3515de Bug 1755134 - Fix calculation of window position and size on window.open(). r=jfkthame
Compute x and y on desktop pixels based on the old screen and use CSS
pixels for the rest.

Use well-typed units to prevent silly mistakes to the extent possible.

Differential Revision: https://phabricator.services.mozilla.com/D138646
2022-02-17 16:22:57 +00:00
Nika Layzell
0ac9d7016c Bug 1744352 - Part 1: Ensure we set InitialSandboxFlags when opening or replacing toplevel BrowsingContexts, r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D138209
2022-02-09 17:50:51 +00:00
Butkovits Atila
61617d602a Backed out 2 changesets (bug 1744352) for causing failures at test_javascript_sandboxed_popup.html. CLOSED TREE
Backed out changeset 1a7d29ce984c (bug 1744352)
Backed out changeset b3a8f99f0044 (bug 1744352)
2022-02-09 17:53:32 +02:00
Nika Layzell
1a923f1aee Bug 1744352 - Part 1: Ensure we set InitialSandboxFlags when opening or replacing toplevel BrowsingContexts, r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D138209
2022-02-09 14:44:51 +00:00
Gijs Kruitbosch
7b8f825961 Bug 1544167 - end drag sessions when creating dialog chrome windows, r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D132955
2021-12-20 11:06:36 +00:00
Csoregi Natalia
77cf6412d0 Backed out changeset c738cce970b5 (bug 1544167) for causing permafailures on /browser_popup_condition.js. CLOSED TREE 2021-12-20 04:54:58 +02:00
Gijs Kruitbosch
dc8909ad02 Bug 1544167 - end drag sessions when creating dialog chrome windows, r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D132955
2021-12-08 00:50:44 +00:00
Tooru Fujisawa
688a5da5c5 Bug 1701001 - Part 2: Add "is popup" field to browsing context. r=smaug
Add BrowsingContext::FieldValues.mIsPopupRequested, and pass "is popup"
value calculated before opening window/tab to BrowsingContext::CreateDetached.

Other code path that is unrelated to content-priv window.open uses the
default value false.

Differential Revision: https://phabricator.services.mozilla.com/D129411
2021-11-06 01:19:14 +00:00
Tooru Fujisawa
2023605d86 Bug 1701001 - Part 1: Standardize the condition for opening popup from window.open. r=smaug
Removed "width" feature from the popup condition, and removed related parameters
(aWidthSpecified, and aSizeSpec) from functions.

Also added "popup" feature that explicitly specify whether to request popup or
not.
This is only for content context, and it behaves differently than existing
"popup" feature for chrome context that makes the window no-style.

Differential Revision: https://phabricator.services.mozilla.com/D129410
2021-11-06 01:19:14 +00:00
Tooru Fujisawa
38c2b7620d Bug 1737832 - Simplify the chromeFlag calculation in window.open for nsGlobalWindowOuter::Print and nsDocShell::PerformRetargeting. r=smaug
This simplifies the chromeFlag calculation for:
  * chrome-priv case, by removing not-fully-chrome-priv case
  * content case, by removing presenceFlag calculation
both by removing the special case for
nsGlobalWindowOuter::Print and nsDocShell::PerformRetargeting,
that has chrome caller but no chrome parent.

Code path for nsGlobalWindowOuter::Print and nsDocShell::PerformRetargeting
now uses the content case instead of the chrome-priv case, but the resulting
flag doesn't change (CHROME_ALL) for those 2 consumers.

Differential Revision: https://phabricator.services.mozilla.com/D129530
2021-11-06 01:19:13 +00:00
Marian-Vasile Laza
1ad5e0f00b Backed out 4 changesets (bug 1737832, bug 1701001) for causing geckoview failures on noopener-noreferrer-BarProp.window.html. CLOSED TREE
Backed out changeset ff439d9c0391 (bug 1701001)
Backed out changeset b0e47b1f4d39 (bug 1701001)
Backed out changeset 0e2ca3cc650e (bug 1701001)
Backed out changeset 712b897cbc76 (bug 1737832)
2021-11-06 02:44:46 +02:00
Tooru Fujisawa
4b4b4f1547 Bug 1701001 - Part 2: Add "is popup" field to browsing context. r=smaug
Add BrowsingContext::FieldValues.mIsPopupRequested, and pass "is popup"
value calculated before opening window/tab to BrowsingContext::CreateDetached.

Other code path that is unrelated to content-priv window.open uses the
default value false.

Differential Revision: https://phabricator.services.mozilla.com/D129411
2021-11-05 23:07:40 +00:00
Tooru Fujisawa
b55930f157 Bug 1701001 - Part 1: Standardize the condition for opening popup from window.open. r=smaug
Removed "width" feature from the popup condition, and removed related parameters
(aWidthSpecified, and aSizeSpec) from functions.

Also added "popup" feature that explicitly specify whether to request popup or
not.
This is only for content context, and it behaves differently than existing
"popup" feature for chrome context that makes the window no-style.

Differential Revision: https://phabricator.services.mozilla.com/D129410
2021-11-05 23:07:40 +00:00
Tooru Fujisawa
c8a91c525d Bug 1737832 - Simplify the chromeFlag calculation in window.open for nsGlobalWindowOuter::Print and nsDocShell::PerformRetargeting. r=smaug
This simplifies the chromeFlag calculation for:
  * chrome-priv case, by removing not-fully-chrome-priv case
  * content case, by removing presenceFlag calculation
both by removing the special case for
nsGlobalWindowOuter::Print and nsDocShell::PerformRetargeting,
that has chrome caller but no chrome parent.

Code path for nsGlobalWindowOuter::Print and nsDocShell::PerformRetargeting
now uses the content case instead of the chrome-priv case, but the resulting
flag doesn't change (CHROME_ALL) for those 2 consumers.

Differential Revision: https://phabricator.services.mozilla.com/D129530
2021-11-05 23:07:40 +00:00
Sandor Molnar
f3e00231c0 Backed out 2 changesets (bug 1731597) for causing multiple wpt failures. CLOSED TREE
Backed out changeset 48cc3daf8201 (bug 1731597)
Backed out changeset db878c07f32a (bug 1731597)
2021-10-29 05:32:59 +03:00
Nika Layzell
8c0e559ca6 Bug 1731597 - Part 2: Stop relying on GetPrimaryRemoteTab when opening popups, r=annyG
Differential Revision: https://phabricator.services.mozilla.com/D126994
2021-10-28 22:25:28 +00:00
Tooru Fujisawa
2c2facfee0 Bug 1720615 - Stop collecting telemetry for popup condition of window.open. r=smaug
This reverts bug 1710010 change.

Differential Revision: https://phabricator.services.mozilla.com/D120954
2021-08-02 01:12:38 +00:00
Nika Layzell
112f34573e Bug 1586830 - Part 1: Ensure IsInitialDocument is set earlier and consistently on WindowGlobalParent, r=smaug
This makes sure to clear and set the value more consistently when replacing
documents within a WindowGlobal, and makes sure to include the relevant flag in
the initializer.

In addition, the place where the flag is set is moved ahead to happen before
the call to `Embed` so that the information is ready before the window is
created.

Differential Revision: https://phabricator.services.mozilla.com/D119815
2021-07-14 15:51:20 +00:00
Tooru Fujisawa
0731a9aa4b Bug 1710010 - Collect telemetry for popup condition of window.open. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D118448
2021-06-23 04:19:40 +00:00
Kris Maglione
94b09497de Bug 1702678: Handle corner case when opener window is closed from a nested event loop during open. r=nika
Differential Revision: https://phabricator.services.mozilla.com/D111179
2021-05-07 03:00:13 +00:00
Sandor Molnar
9644eccd27 Backed out changeset 761fdc9f84d2 (bug 1702678) for causing assertion failures in windowwatcher/nsWindowWatcher. CLOSED TREE 2021-05-07 05:31:41 +03:00
Kris Maglione
459d168ec2 Bug 1702678: Handle corner case when opener window is closed from a nested event loop during open. r=nika
Differential Revision: https://phabricator.services.mozilla.com/D111179
2021-05-07 01:25:32 +00:00
Dorel Luca
10eb98bd92 Backed out changeset 0672855335bc (bug 1702678) for Mochitest failures in toolkit/components/windowwatcher/nsWindowWatcher.cpp. CLOSED TREE 2021-05-05 02:01:05 +03:00