Commit graph

546 commits

Author SHA1 Message Date
Emilio Cobos Álvarez
03ade0a619 Bug 1753995 - Move devicePixelRatio getter from outer to inner window. r=smaug
It only pokes at the document's pres context, there's no need to
roundtrip through the outer window. No behavior change.

Differential Revision: https://phabricator.services.mozilla.com/D138019
2022-02-07 18:23:35 +00:00
Masayuki Nakano
71fc64caea Bug 1735745 - Make SelectionChangeEventDispatcher dispatch select event and selectchange event only when there may be corresponding event listeners r=smaug
`select` event on text controls now dispatched immediately before
`selectionchange`.  However, it needs to create `AsyncEventDispatcher` for
each.  This cost may not be expensive, but they are called really a lot even
if there is no corresponding event listener.

Therefore, this patch makes `nsPIDOMWindow` and `EventListenerManager` have
`MayHave*EventListeners` flag separately for each, and makes
`SelectionChangeEventDispatcher` does not try to do create
`AsyncEventDispatcher` when there is no corresponding event listener.

Differential Revision: https://phabricator.services.mozilla.com/D131750
2021-11-25 07:09:23 +00:00
Kagami Sascha Rosylight
11ebe98845 Bug 1741181 - Move lock counter to WindowInner r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D131975
2021-11-24 11:55:38 +00:00
Toshihito Kikuchi
599a77edff Bug 1734099 - Never unload tabs with active RTCPeerConnection instances. r=peterv,jesup
This patch makes sure the Tab Unloading feature does not unload tabs that have
active peer connections not to disrupt browsing experience based on WebRTC peer
connections.

To enable JS code to access the number of active peer connections, this patch
moves `nsPIDOMWindowInner::mTotalActivePeerConnections` to `WindowGlobalParent`.

Differential Revision: https://phabricator.services.mozilla.com/D128761
2021-11-18 22:59:12 +00:00
Masayuki Nakano
c84dfd928f Bug 1455514 - part 2: Add accessors and static helper methods to retrieve nsPIDOMWindowInner, nsPIDOMWindowOuter and nsPIWindowRoot r=smaug
Similar to the previous patch, there are a lot of QI from `EventTarget` to
window interfaces.  This patch adds them, but unfortunately,
`nsPIDOMWindowInner` and `nsPIDOMWindowOuter` do not inherit `EventTarget`
directly, and they are in a public header instead of their concrete classes
(`nsGlobalWindowInner` and `nsGlobalWindowOuter`).  So we cannot cast them
in `nsPIDOMWindow.h`, and it causes it's impossible to use the macros added
by the previous patch.

Differential Revision: https://phabricator.services.mozilla.com/D129782
2021-11-02 13:03:43 +00:00
alwu
b9abcddbc1 Bug 1733902 - part2 : use the new method to check if we should delay media from starting playback. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D128127
2021-11-01 22:26:40 +00:00
alwu
28430fb0d3 Bug 1733902 - part1 : create a new sync attribute on top-level browsing context for whether we should delay media from starting, and use it to replace the old attribute on outer windows. r=nika,emilio
Brief recap:
Before we have blocking autoplay, we had a feature which will delay media from start if the tab hasn't been visited by users, in order to prevent an unvisited background tab suddenly play sounds, which is annoying and might be unexpected to users.

In this patch:
The attribute we use to check whether we need to delay media is on the outer window, which is not Fission compatible if the top level window and its child windows are on the different process.

If the top level window has been visited, then all its child window should follow the same result. Therefore, we need to move the attribute to the browsing context in order to sync it across different windows.

Differential Revision: https://phabricator.services.mozilla.com/D128126
2021-11-01 22:26:40 +00:00
Karl Tomlinson
e91d1ff3ec Bug 1732410 wait for focus before proceeding for enumerateDevices() Promises r=jib,nika
https://github.com/w3c/mediacapture-main/pull/574

Focus on browser chrome widgets is accepted provided the tab is fully active
and foreground.
https://github.com/w3c/mediacapture-main/issues/752#issuecomment-742036800

Differential Revision: https://phabricator.services.mozilla.com/D127051
2021-10-11 20:44:39 +00:00
Edgar Chen
3aeb8d0b4b Bug 1730117 - Part 2: Make EnterModalState suppress event handling for the nested in-process documents; r=smaug
This also makes nsIDOMWindowUtils::SuppressEventHandling work properly.

Differential Revision: https://phabricator.services.mozilla.com/D125615
2021-09-22 14:50:56 +00:00
Sandor Molnar
8bb72e737f Backed out 2 changesets (bug 1730117) for causing wpt failures in no_window_open_when_term_nesting_level_nonzero. CLOSED TREE
Backed out changeset bafc4ddc87f6 (bug 1730117)
Backed out changeset 27a1d92e550c (bug 1730117)
2021-09-21 18:00:06 +03:00
Edgar Chen
1b679a7b3f Bug 1730117 - Part 2: Make EnterModalState suppress event handling for the nested in-process documents; r=smaug
This also makes nsIDOMWindowUtils::SuppressEventHandling work properly.

Differential Revision: https://phabricator.services.mozilla.com/D125615
2021-09-21 11:39:46 +00:00
Butkovits Atila
a3bbc4c745 Backed out 2 changesets (bug 1730117) for causing failures at test_suppressed_events_nested_iframe.html. CLOSED TREE
Backed out changeset 649984f4a939 (bug 1730117)
Backed out changeset 37a35b6b54b4 (bug 1730117)
2021-09-21 00:38:17 +03:00
Edgar Chen
97e68450e6 Bug 1730117 - Part 2: Make EnterModalState suppress event handling for the nested in-process documents; r=smaug
This also makes nsIDOMWindowUtils::SuppressEventHandling work properly.

Differential Revision: https://phabricator.services.mozilla.com/D125615
2021-09-20 19:23:52 +00:00
Kagami Sascha Rosylight
86a6ba4bda Bug 1723050 - Part 2: Replace typedef by using in dom/base/ r=edgar
Differential Revision: https://phabricator.services.mozilla.com/D121294
2021-08-02 14:40:41 +00:00
Emilio Cobos Álvarez
d973da3734 Bug 1710887 - Make modal state handling in window.print() more reliable. r=smaug
If afterprint removes the window we're printing, we'd call
LeaveModalState() without a top window, and never leave the modal state.

Differential Revision: https://phabricator.services.mozilla.com/D115007
2021-05-12 19:26:20 +00:00
Peter Van der Beken
d2466bf821 Bug 1696158 - Move CanSavePresentation to the parent process. Store count of processes with active peer connections per top-level WC in the parent. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D110232
2021-04-19 14:50:55 +00:00
smolnar
84a0543987 Backed out 8 changesets (bug 1696158) for causing multiple failures. CLOSED TREE
Backed out changeset 09c598c8fd29 (bug 1696158)
Backed out changeset 02f956c26901 (bug 1696158)
Backed out changeset b61a3a324cce (bug 1696158)
Backed out changeset 95810ed7f1e5 (bug 1696158)
Backed out changeset 4f93a7b61496 (bug 1696158)
Backed out changeset c80c55b56f2a (bug 1696158)
Backed out changeset 11627c409882 (bug 1696158)
Backed out changeset b98b4316a510 (bug 1696158)
2021-04-19 17:04:08 +03:00
Peter Van der Beken
2d271a5ac3 Bug 1696158 - Move CanSavePresentation to the parent process. Store count of processes with active peer connections per top-level WC in the parent. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D110232
2021-04-19 12:39:19 +00:00
Emilio Cobos Álvarez
266a613a4a Bug 1702033 - Remove some dead audio volume-related code in nsPIDOMWindow. r=alwu
Differential Revision: https://phabricator.services.mozilla.com/D110296
2021-03-30 19:38:02 +00:00
Olli Pettay
dd5347ded5 Bug 1698549 - Call FireDelayedDOMEvents when restoring a bfcached page, r=peterv
The test isn't testing anything mApplicationCache related, since appcache is basically
no-op code.

Depends on D107930

Differential Revision: https://phabricator.services.mozilla.com/D108487
2021-03-21 21:46:25 +00:00
Emilio Cobos Álvarez
a8f3c5d571 Bug 1699259 - Add a ChromeOnly FocusOptions.preventFocusRing to opt out of focus ring heuristics. r=edgar,Gijs
This seems easier than making those heuristics work across processes
somehow.

Differential Revision: https://phabricator.services.mozilla.com/D108931
2021-03-20 14:49:01 +00:00
Alexandru Michis
c3da6488ee Backed out changeset f588378316fd (bug 1699259) for causing mochitest failures in test_focusrings.xhtml
CLOSED TREE
2021-03-20 03:10:02 +02:00
Emilio Cobos Álvarez
9d854aa834 Bug 1699259 - Add a ChromeOnly FocusOptions.preventFocusRing to opt out of focus ring heuristics. r=edgar,Gijs
This seems easier than making those heuristics work across processes
somehow.

Differential Revision: https://phabricator.services.mozilla.com/D108931
2021-03-19 23:10:35 +00:00
harry
036ded43ac Bug 1699506 - Part 1 - Add a NSTitlebarAccessoryViewController to ToolbarWindow to track when the titlebar is shown in fullscreen. r=mac-reviewers,mstange
Differential Revision: https://phabricator.services.mozilla.com/D106846
2021-03-18 20:20:39 +00:00
Emilio Cobos Álvarez
52e3823a9c Bug 1699154 - Tweak focusring heuristics for script focus. r=edgar
What we implemented before this patch was basically what the heuristics
in the spec said, which used to be normative:

  https://drafts.csswg.org/selectors/#the-focus-visible-pseudo

That has become non-normative and there's ongoing discussion on what
should happen for cases like this in:

  https://github.com/w3c/csswg-drafts/issues/5885
  https://github.com/web-platform-tests/wpt/pull/27806

There seems to be agreement on that WPT issue on cases like this one, so
let's make it work.

Differential Revision: https://phabricator.services.mozilla.com/D108805
2021-03-18 19:53:38 +00:00
Nika Layzell
27ff2d45df Bug 1697927 - Part 1: Only expose HadOriginalOpener on BrowsingContext, r=farre
Differential Revision: https://phabricator.services.mozilla.com/D108860
2021-03-18 16:15:17 +00:00
smolnar
b2e94b592b Backed out changeset 74ab7aa60b1a (bug 1699154) for causing reftest failures. CLOSED TREE 2021-03-18 18:39:44 +02:00
Emilio Cobos Álvarez
b892d58030 Bug 1699154 - Tweak focusring heuristics for script focus. r=edgar
What we implemented before this patch was basically what the heuristics
in the spec said, which used to be normative:

  https://drafts.csswg.org/selectors/#the-focus-visible-pseudo

That has become non-normative and there's ongoing discussion on what
should happen for cases like this in:

  https://github.com/w3c/csswg-drafts/issues/5885
  https://github.com/web-platform-tests/wpt/pull/27806

There seems to be agreement on that WPT issue on cases like this one, so
let's make it work.

Differential Revision: https://phabricator.services.mozilla.com/D108805
2021-03-18 15:08:31 +00:00
smolnar
8b8afdb266 Backed out changeset 1c8b807651b8 (bug 1699154) for causing mochitest failures in test_focusrings.xhtml CLOSED TREE 2021-03-18 15:46:51 +02:00
Emilio Cobos Álvarez
1cad7af959 Bug 1699154 - Tweak focusring heuristics for script focus. r=edgar
What we implemented before this patch was basically what the heuristics
in the spec said, which used to be normative:

  https://drafts.csswg.org/selectors/#the-focus-visible-pseudo

That has become non-normative and there's ongoing discussion on what
should happen for cases like this in:

  https://github.com/w3c/csswg-drafts/issues/5885
  https://github.com/web-platform-tests/wpt/pull/27806

There seems to be agreement on that WPT issue on cases like this one, so
let's make it work.

Differential Revision: https://phabricator.services.mozilla.com/D108805
2021-03-18 12:34:31 +00:00
Olli Pettay
bba6b348ae Bug 1689601, nested freeze/thaw, r=peterv
Non-SHIP bfcache seems to be rather complicated here, since it needs to explicitly store inner windows and what not.
SHIP should be able to handle this in a simpler way.
It is possible that some ordering needs still tweaking.

Differential Revision: https://phabricator.services.mozilla.com/D105360
2021-03-02 12:13:20 +00:00
Mihai Alexandru Michis
87f481bf9a Backed out 16 changesets (bug 1689601) for causing cpp bustages in nsFrameLoader.
CLOSED TREE

Backed out changeset 6e5523a7210d (bug 1689601)
Backed out changeset 745eaa468c74 (bug 1689601)
Backed out changeset a594bd02b8b6 (bug 1689601)
Backed out changeset 0c5fe977ced6 (bug 1689601)
Backed out changeset 2fca23521891 (bug 1689601)
Backed out changeset 334aeb627855 (bug 1689601)
Backed out changeset 2b2081a15d67 (bug 1689601)
Backed out changeset 307bde43cc96 (bug 1689601)
Backed out changeset 04aadec67ce2 (bug 1689601)
Backed out changeset 701eccb34772 (bug 1689601)
Backed out changeset 278db692aa8b (bug 1689601)
Backed out changeset c261c243a64d (bug 1689601)
Backed out changeset 7e8022e5696a (bug 1689601)
Backed out changeset 6138bfc6c08d (bug 1689601)
Backed out changeset 63295b3a62d0 (bug 1689601)
Backed out changeset 6d02e59ddc51 (bug 1689601)
2021-03-02 13:15:10 +02:00
Olli Pettay
9a08f751a4 Bug 1689601, nested freeze/thaw, r=peterv
Non-SHIP bfcache seems to be rather complicated here, since it needs to explicitly store inner windows and what not.
SHIP should be able to handle this in a simpler way.
It is possible that some ordering needs still tweaking.

Differential Revision: https://phabricator.services.mozilla.com/D105360
2021-03-02 09:44:13 +00:00
Emilio Cobos Álvarez
ba7c09d55d Bug 1689155 - Don't necessarily show outlines on refocus. r=edgar
Preserve the last state of when we focused the element in that window,
if the focus method is unknown.

Depends on D104861

Differential Revision: https://phabricator.services.mozilla.com/D104863
2021-02-15 19:08:42 +00:00
Mihai Alexandru Michis
02101824c8 Backed out 2 changesets (bug 1689155) for causing bc failures in browser_outline_refocus.js
CLOSED TREE

Backed out changeset bf4ed0fa612b (bug 1689155)
Backed out changeset 78a47c967db3 (bug 1689155)
2021-02-15 19:40:05 +02:00
Emilio Cobos Álvarez
c804929923 Bug 1689155 - Don't necessarily show outlines on refocus. r=edgar
Preserve the last state of when we focused the element in that window,
if the focus method is unknown.

Differential Revision: https://phabricator.services.mozilla.com/D104863
2021-02-15 12:41:23 +00:00
Emilio Cobos Álvarez
635e3580e3 Bug 1655967 - Move serviceWorkersTestingEnabled to BrowsingContext. r=nika
Differential Revision: https://phabricator.services.mozilla.com/D103757
2021-02-03 10:38:43 +00:00
Paul Zuehlcke
547f195fc5 Bug 1679512 - Move contentBlockingAllowListPrincipal to WindowGlobalParent. r=timhuang,nika
We only use the contentBlockingAllowListPrincipal for excluding sites from content
blocking for top level documents. We don't need it in the content process and should
not compute it for every document.

Differential Revision: https://phabricator.services.mozilla.com/D100781
2021-01-14 20:37:35 +00:00
Bryce Seager van Dyk
3c358eec6e Bug 1675360 - Shutdown MediaKeys when parent inner window is destroyed rather than document. r=karlt
Rework the MediaKeys class to shutdown when its parent inner window is destroyed
rather than the document it's created in. This is done to mitigate the case
where a MediaKeys is created in an about:blank document that has not yet
undergone its async load (i.e. blank document that will stay blank, blank
documents loading to other pages will still clobber their keys on load). This
specifically addresses cases where sites could create an iframe, not wait for
load, create a MediaKeys in the iframe, and then find the keys had become
unusable.

This is achieved by associating MediaKeys instances with their inner window and
having the window notify keys when a window is going to be destroyed. I decided
to use this approach rather than have MediaKeys observe for window destruction
for a few reasons:
- The keys would need to support weak references to use the observer service in
  the desired way. Implementing this interface on the MediaKeys adds a
  non-trivial level of complexity and means the keys would implement the WeakPtr
  interface (already in place prior to this patch) and also the NS weak
  reference interface, which I found confusing.
- If the inner window stores pointers to MediaKeys created in it, it can be self
  aware of if EME activity is taking place within it. The allows us to better
  identify EME activity in documents. Historically one of the ways we'd
  determined EME activity by checking if media elements have MediaKeys attached,
  but this had lead to issues where if MediaKeys are created but not attached
  to a media element we overlook them. With this patch's changes, we can also
  have a document check its inner window to see if there are any MediaKeys. This
  patch uses this to extend our check to avoid bfcaching pages with EME content.
- There appears to be prior art using a similar approach for audio contexts and
  peer connections, which I assume is sensible and I'm not reinventing the wheel
  by following.

Differential Revision: https://phabricator.services.mozilla.com/D98641
2020-12-10 01:03:27 +00:00
Steven MacLeod
6cd960cfb3 Bug 1585070 - move nsPIDOMWindowOuter::mIsActive to BrowsingContext. r=kmag
A new `BrowsingContext` field has been added to track the active
browser window for the `:-moz-window-inactive` pseudoclass. This
field takes the place of `nsPIDOMWindowOuter::mIsActive`.

With this change `:-moz-window-inactive` is now fission compatible.

Differential Revision: https://phabricator.services.mozilla.com/D86422
2020-11-20 15:16:58 +00:00
Noemi Erli
60669a2ed8 Backed out changeset 18448a7ebf82 (bug 1585070) for causing failures in test_cocoa_window_focus.html CLOSED TREE 2020-11-17 06:09:50 +02:00
Steven MacLeod
2c4c433439 Bug 1585070 - move nsPIDOMWindowOuter::mIsActive to BrowsingContext. r=kmag
A new `BrowsingContext` field has been added to track the active
browser window for the `:-moz-window-inactive` pseudoclass. This
field takes the place of `nsPIDOMWindowOuter::mIsActive`.

With this change `:-moz-window-inactive` is now fission compatible.

Differential Revision: https://phabricator.services.mozilla.com/D86422
2020-11-16 22:37:51 +00:00
Emilio Cobos Álvarez
a33ff60406 Bug 1676843 - Make innerWidth/innerHeight return the actual CSS size rather than a rounded version of it. r=heycam
On Nightly, for now. This allows websites to get the real viewport size.

The rounded size has caused problems in the past (see bug 1648298 / bug
1648265), and changing it would be ideal.

I told the CSSWG that we can experiment with this on Nightly to
alleviate (or prove) compat concerns, in which case we'd need to use a
different solution, see https://github.com/w3c/csswg-drafts/issues/5260.

Differential Revision: https://phabricator.services.mozilla.com/D96826
2020-11-13 12:44:01 +00:00
Masayuki Nakano
0f46ae6a8e Bug 1668134 - part 2: Make nsPIDOMWindowInner have an API to know whether a node is (was) in the window has been observed by web apps with a mutation observer r=smaug
There is similar API in `Document`, but they indicate whether a node has been
observed by any mutation receiver, not only by `MutationObserver` of JS.
However, I'd like to know the percentage of web apps which use
`MutationObserver`, but not use `beforeinput` events.  Therefore, this patch
adds similar API into `nsPIDOMWindowInner` as same as `beforeinput` and
ignores `MutationObserver`s which are created by chrome script and addons.

Differential Revision: https://phabricator.services.mozilla.com/D92547
2020-10-08 02:25:35 +00:00
Masayuki Nakano
8c5fa85517 Bug 1668134 - part 1: Make nsPIDOMWindowInner have an API to know whether the window or its descendants has had beforeinput event listeners r=smaug
When `HTMLEditor` instances are destroyed, I'd like to collect how much
instances are worked with `beforeinput` event listeners.  Before adding such
telemetry probe, this patch adds methods to set/get whether a `beforeinput`
event listener has had added or not to `nsPIDOMWindowInner`.

Differential Revision: https://phabricator.services.mozilla.com/D92546
2020-10-08 02:25:35 +00:00
Masayuki Nakano
ec2e1c9705 Bug 1669133 - Get rid of pref to disable text event in the default group and telemetry for it r=smaug
The telemetry probe was added in bug 1506434, and it's not necessary anymore
because of the event in the default group was completely disabled in
bug 1288640 (Gecko 65).

Therefore, we can get rid of the pref, and we can take back a room for a
bool member in `nsPIDOMWindowInner` for new telemetry probes which need
to know whether a specific event listener has been added or not.

Depends on D92395

Differential Revision: https://phabricator.services.mozilla.com/D92397
2020-10-05 11:17:17 +00:00
Karl Tomlinson
9e13b21300 Bug 1646601 move fully active predicate to nsPIDOMWindowInner r=farre
Depends on D90216

Differential Revision: https://phabricator.services.mozilla.com/D90217
2020-09-15 22:13:22 +00:00
Kris Maglione
c2c6945169 Bug 1650257: Part 2 - Abort SetNewDocument() if ancestors are discarded/cached. r=nika,smaug,sg
Differential Revision: https://phabricator.services.mozilla.com/D87486
2020-08-31 18:51:56 +00:00
Dorel Luca
dcd1938a78 Backed out changeset 178fa7e29bb6 (bug 1585070) for Browser-chrome failures in general/browser_windowactivation.js. CLOSED TREE 2020-08-12 20:10:46 +03:00
Steven MacLeod
05066e9e52 Bug 1585070 - move nsPIDOMWindowOuter::mIsActive to BrowsingContext. r=farre
A new `BrowsingContext` field, `isActiveBrowserWindow`, has been added
to track the active browser window for the `:-moz-window-inactive`
pseudoclass. This field takes the place of
`nsPIDOMWindowOuter::mIsActive`.

With this change `:-moz-window-inactive` is now fission compatible.

Differential Revision: https://phabricator.services.mozilla.com/D86422
2020-08-11 12:53:57 +00:00