Граф коммитов

98 Коммитов

Автор SHA1 Сообщение Дата
Tom Schuster 2536630f8b Bug 1818250 - Add ShouldResistFingerprinting to WindowContext. r=nika
Differential Revision: https://phabricator.services.mozilla.com/D172271
2023-03-20 18:52:25 +00:00
Andreas Farre 95de092629 Bug 1745645 - Set the value for HasActivePeerConnections early. r=peterv
Differential Revision: https://phabricator.services.mozilla.com/D165400
2022-12-22 16:53:54 +00:00
Olli Pettay 93acdfad59 Bug 1777574, automate CC zone handling, r=mccr8
Differential Revision: https://phabricator.services.mozilla.com/D155084
2022-09-07 11:22:51 +00:00
Sean Feng 712dda078c Bug 1750034 - Remove lazyload telemetry related code r=emilio
We have decided to use 600px in all directions, there's no need
to keep the telemetry stuff around.

Differential Revision: https://phabricator.services.mozilla.com/D155879
2022-08-30 16:00:11 +00:00
Sean Feng 011405bf32 Bug 1785227 - Consider all browsing context as non-synthetic when we don't want to hide image document for <object> and <embed> r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D154997
2022-08-18 20:04:59 +00:00
Andreas Farre 4b493b6a30 Bug 1595491 - Part 1: Make <embed> and <object> behave more like <iframe>. r=smaug,emilio
By making image loading in <embed> and <object> behave more like when
an <iframe> loads an image, we can make sure that the synthetic
document generated is process switched if the image is cross
origin. This is done by making image loading in nsObjectLoadingContent
follow the document loading path.

We also make sure that we pass the image size back to the embedder
element to not get stuck with the intrinsic size.

To avoid named targeting being able to target these synthetic
documents, as well as showing up in `Window.frames` and being counted
in `Window.length`, we keep a filtered list of non-synthetic browsing
contexts for that use-case.

This feature is controlled by two prefs:

* browser.opaqueResponseBlocking.syntheticBrowsingContext

  This triggers the creation of synthetic documents for images loaded
  in <object> or embed.

* browser.opaqueResponseBlocking.syntheticBrowsingContext.filter

  This turns on the filtering of synthetic browsing contexts in named
  targeting, `Window.length` and `Window.frames`.

Differential Revision: https://phabricator.services.mozilla.com/D148117
2022-08-16 16:42:58 +00:00
Mirko Brodesser b90b8d0110 Bug 1744524: part 2) Add `WindowContext::GetUserGestureStart` and remove `WindowContext::LastUserGestureTimeStamp`. r=edgar
Preparation for part 3).

The return type of `GetUserGestureStart` is a class, the return type of
`LastUserGestureTimeStamp` a `double`. Hence using the former is safer.

Differential Revision: https://phabricator.services.mozilla.com/D148758
2022-06-16 14:43:40 +00:00
Edgar Chen b838774cf3 Bug 1766582 - Expose last user gesture timestamp; r=sgalich,smaug
Differential Revision: https://phabricator.services.mozilla.com/D144590
2022-04-27 08:26:56 +00:00
Nika Layzell 05dc5e0d76 Bug 1754037 - Part 3c: Automatically update all ParamTraits implementations, r=ipc-reviewers,media-playback-reviewers,bryce,mccr8
Automatically generated rewrites of all ParamTraits and IPDLParamTraits
implementations in-tree to use IPC::Message{Reader,Writer}.

Differential Revision: https://phabricator.services.mozilla.com/D140004
2022-03-04 15:39:41 +00:00
Toshihito Kikuchi baa43db813 Bug 1743663 - Remove windowContext.hasActivePeerConnections. r=peterv
TabUnloader.jsm can directly call windowGlobal.hasActivePeerConnections(),
so windowContext.hasActivePeerConnections is not needed.

Differential Revision: https://phabricator.services.mozilla.com/D132654
2021-12-16 16:14:13 +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
Nika Layzell c525c65ff8 Bug 1722880 - Part 1: Add IsInBFCache to WindowContext, and make it non-SHIP compatible, r=smaug,necko-reviewers,dragana
This field will be useful to JS code such as JSWindowActors which need to be
able to detect when their WindowContext is no longer active.

Differential Revision: https://phabricator.services.mozilla.com/D124098
2021-09-03 15:26:13 +00:00
Nika Layzell b40ab34831 Bug 1728605 - Part 2: Rename misleading {Window,Browsing}Context::IsCached, r=smaug
This method actually tracks whether the context is current, so it has been
renamed, and the behaviour has been inverted.

Depends on D124210

Differential Revision: https://phabricator.services.mozilla.com/D124211
2021-09-02 14:15:04 +00:00
Andi-Bogdan Postelnicu f07c975367 Bug 1519636 - Reformat recent changes to the Google coding style. r=necko-reviewers,emilio
Updated with clang-format version 12.0.0 (taskcluster-FZRqPXamQIOU_i4hF0cAcg)

Differential Revision: https://phabricator.services.mozilla.com/D117905
2021-06-17 11:00:22 +00:00
Kris Maglione ae436f55ec Bug 1646560: Part 2 - Move allowJavascript and friends from DocShell to BrowsingContext and WindowContext. r=jdescottes,nika,geckoview-reviewers,devtools-backward-compat-reviewers,agi
This is slightly complicated by the fact that the editor code wants to be able
to set this from the content process, so we really need separate
BrowsingContext and WindowContext flags, the latter of which can be set by the
owning process.

Differential Revision: https://phabricator.services.mozilla.com/D114899
2021-06-15 04:40:11 +00:00
Nika Layzell fa0ba706bb Bug 1699626 - Downgrade mWindowGlobalChild to a weak pointer, r=smaug
Theoretically this change shouldn't be necessary, however frequent
intermittents suggest that there are still cases where holding a strong
reference here can lead to memory leaks.

Differential Revision: https://phabricator.services.mozilla.com/D109445
2021-03-24 14:11:49 +00:00
Nika Layzell 0f7f0e91a0 Bug 1675820 - Part 4: Track WindowGlobalChild in WindowContext, r=kmag
This allows for the WindowGlobalChild getter in WindowContext to be acquired
more efficiently without performing hashtable lookups, and should generally
simplify things.

The patch also removes the unnecessary XRE_IsContentProcess assertions, and
removes the global hashtable for tracking WindowGlobalChild instances which is
no longer necessary.

Differential Revision: https://phabricator.services.mozilla.com/D108120
2021-03-18 19:24:50 +00:00
Simon Giesecke ad01a10a3b Bug 1634281 - Use nsTHashMap instead of nsDataHashtable. r=xpcom-reviewers,necko-reviewers,jgilbert,nika,valentin
Note that this patch only transforms the use of the nsDataHashtable type alias
to a directly equivalent use of nsTHashMap. It does not change the specification
of the hash key type to make use of the key class deduction that nsTHashMap
allows for in some cases. That can be done in a separate step, but requires more
attention.

Differential Revision: https://phabricator.services.mozilla.com/D106008
2021-03-10 10:47:47 +00:00
Simon Giesecke 4f75368dcb Bug 1691913 - Rename nsBaseHashtable::GetOrInsert(With) to LookupOrInsert(With). r=xpcom-reviewers,necko-reviewers,jgilbert,dragana,nika
The functions should be called "Lookup" rather than "Get" because they return
a DataType& (rather than UserDataType).

Differential Revision: https://phabricator.services.mozilla.com/D105472
2021-02-26 09:11:45 +00:00
Nika Layzell 25d1d214ab Bug 1691410 - Add support for reverting racy changes in CanSet, r=kmag
In some cases, a content process may think they should be able to make a change
to a synced field, but in the meantime something in the parent process has
changed and the change can no longer be applied. This was the cause of a number
of issues around the in-flight process ID, and can cause issues such as crashes
if the CanSet method was made too strict.

This patch introduces a new possible return type from `CanSet` which allows
requesting a `Revert`. A reverted field change will either be cancelled at the
source (if the CanSet fails in the setting process), or will be cancelled by
sending a new transaction back to the source process reverting the change to
ensure consistency.

In addition, some additional logging is added which made it easier to locate the
underlying bug and verify the correctness of the change.

The current primary use-case for this new feature is the CurrentInnerWindowId
field which can be updated by the previous process' docshell after the parent
process has already performed a switch to a new process. This can lead to the
current WindowContext being inaccurate for a BrowsingContext in some edge cases
as we allow the flawed set due the in-flight process ID matching.

This patch changes the logic to no longer check the in-flight process ID, and
instead revert any changes to the CurrentInnerWindowId field coming from a
process which is not currently active in the BrowsingContext.

No tests were added as it is very timing-sensitive, and difficult to create the
specific scenario, however without these changes my patch for bug 1663757
consistently causes geckoview-junit crashes due to currentWindowGlobal being
incorrect.

Differential Revision: https://phabricator.services.mozilla.com/D105553
2021-02-20 03:55:06 +00:00
Sean Feng 93ae22d5b9 Bug 1692350 - Implement a telemetry probe to collect page load data for documents that use lazyload r=emilio,chutten
Differential Revision: https://phabricator.services.mozilla.com/D104912
2021-02-17 22:25:02 +00:00
Mihai Alexandru Michis 8d0efc214f Backed out changeset 6a0dcd8f4e3e (bug 1692350) for causing crashes in WindowContext.
CLOSED TREE
2021-02-17 21:02:59 +02:00
Sean Feng 7917a71b50 Bug 1692350 - Implement a telemetry probe to collect page load data for documents that use lazyload r=emilio,chutten
Differential Revision: https://phabricator.services.mozilla.com/D104912
2021-02-17 17:17:52 +00:00
Andreas Farre 78e800dabe Bug 1612147 - Don't store FeaturePolicy in BrowsingContext. r=smaug
Syncing the container FeaturePolicy across BrowsingContext is actually
a bit more heavy-handed than necessary. We only ever need a container
FeaturePolicy when inheriting a FeaturePolicy in exactly the document
the container contains. Not every process that the tree the container
is a part of. So instead of storing a FeaturePolicy in a synced field,
we manually send it to the correct WindowGlobalChild (which
corresponds to a document) and retrieve it from there.

Differential Revision: https://phabricator.services.mozilla.com/D61479
2021-01-14 11:15:24 +00:00
Razvan Maries d5566c5ebf Backed out changeset 7d10fe1f2f2e (bug 1684490) for causing bug 1685106. a=backout DONTBUILD 2021-01-05 17:59:54 +02:00
Emilio Cobos Álvarez b1477d11d2 Bug 1684490 - Make some BrowsingContext/WindowContext asserts DIAGNOSTIC_ASSERTS. r=edgar
These would've caught the issue a lot sooner.

Differential Revision: https://phabricator.services.mozilla.com/D100579
2021-01-04 20:54:15 +00:00
Narcis Beleuzu d7a6d44ef2 Backed out 2 changesets (bug 1684490) as per emilio`s request
Backed out changeset 1f44b3e9ec62 (bug 1684490)
Backed out changeset 7ad6088bb2c2 (bug 1684490)
2021-01-04 23:51:15 +02:00
Emilio Cobos Álvarez d6fde576a9 Bug 1684490 - Make some BrowsingContext/WindowContext asserts DIAGNOSTIC_ASSERTS. r=edgar DONTBUILD
These would've caught the issue a lot sooner.

Differential Revision: https://phabricator.services.mozilla.com/D100579
2021-01-04 20:54:15 +00:00
Andi-Bogdan Postelnicu 8dcc17a525 Bug 1683532 - Make `docshell` buildable outside of `unified-build` environment. r=sg
Differential Revision: https://phabricator.services.mozilla.com/D100205
2021-01-04 14:18:37 +00:00
Dimi Lee 1507ffef24 Bug 1582499 - P1. Add isLocalIP to WindowContext r=nika
When a user clicks a form, the password manager popups a warning when the
form is not in a secure context. However, there is an exception when
a form is in an iframe. When both the url of the iframe and the top-level
are both local ip addresses, we consider it is safe.

This patch adds isLocalIP to WindowContext and WindowGlobalActor.webidl
so password manager can identify whether the top-level url is a local ip
address under fission.

Differential Revision: https://phabricator.services.mozilla.com/D99041
2020-12-10 20:45:54 +00:00
Emilio Cobos Álvarez 4fd5d13610 Bug 1680721 - Grant a single iframe without user interaction to top windows. r=smaug,johannh
Only for top windows because for nested iframes they could get around
this without being noticed by reloading themselves which is not great.

Differential Revision: https://phabricator.services.mozilla.com/D98775
2020-12-08 10:15:18 +00:00
Simon Giesecke 971b645fe3 Bug 1660470 - Add missing include directives/forward declarations. r=nika
Differential Revision: https://phabricator.services.mozilla.com/D87865
2020-11-23 16:21:38 +00:00
Johann Hofmann fc8398626e Bug 1650095 - Part 2 - Implement SessionHistoryEntry::Get/SetHasUserInteraction. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D93346
2020-11-18 11:51:00 +00:00
Sylvestre Ledru d9cd198ba1 Bug 1519636 - Reformat recent changes to the Google coding style r=andi,necko-reviewers,dragana
# ignore-this-changeset

Differential Revision: https://phabricator.services.mozilla.com/D92459
2020-10-06 16:12:00 +00:00
julianwels 341416588c Bug 1653026 - Added HTTPS-Only Mode upgrade info to browser UI state. r=mattwoodrow,necko-reviewers,dragana
Differential Revision: https://phabricator.services.mozilla.com/D86566
2020-10-06 00:34:55 +00:00
Brindusan Cristian 2a9b39efce Backed out 2 changesets (bug 1653026) for mochitest failures at WindowGlobalParent.cpp. CLOSED TREE
Backed out changeset 54c69c99b241 (bug 1653026)
Backed out changeset e70649f78910 (bug 1653026)
2020-10-03 10:49:04 +03:00
julianwels 30a6225652 Bug 1653026 - Added HTTPS-Only Mode upgrade info to browser UI state. r=mattwoodrow,necko-reviewers,dragana
Differential Revision: https://phabricator.services.mozilla.com/D86566
2020-10-03 01:22:19 +00:00
Emilio Cobos Álvarez 584d9d8e68 Bug 1668156 - Fix some IntersectionObserver edge cases, and enable the assertion for good. r=hiro
This patch fixes two issues, described below:

First, the GetTopLevelDocument function was looking at the browsing
context tree. It should look at the window context tree, as looking at
the browsing context tree means that if you're in a discarded or
about-to-get-discarded document, you can end up with a document from a
different tree. Computing intersections between those of course makes no
sense and triggers the assertion we're enabling.

Second, this patch fixes an issue when you have fission enabled, and a
setup such as:

  A1 -> B1 -> A2

If you try to use IntersectionObserver from A2 with the implicit root,
we'd end up with:

  * rootRect: A1's root scrollport rect (this is fine, because it's only
              used to compute the root margin and bounds and so on, not
              to compute geometry).

  * rootFrame: A1's root scroll frame (this is _not_ fine, see below).

Then, we'd try to map rects from A2's target to A1's viewport, and we
can't really do that sensibly with the existing nsLayoutUtils functions,
because we're not accounting for all the OOP iframe transforms that may
be going on. This also triggers the assertion that this patch enables in
same-origin-grand-child-iframe.sub.html.

To fix it, for the A2 case, use the same code that we have for other OOP
iframes. The test tweaks fails with fission enabled without the patch
(because we don't account for the OOP iframe clip).

Differential Revision: https://phabricator.services.mozilla.com/D92089
2020-10-01 22:41:55 +00:00
alwu 37f127c8f3 Bug 1652108 - part2 : modify `page_had_media_count` to `in_page_count` r=nika,bryce
We would like to remove `page_had_media_count` and use a new probe `in_page_count` to record the total number of top level content documents using media.

Therefore, we would rename WindowContext's `DocTreeHadAudibleMedia` to `DocTreeHadMedia` in order to support the new usage.

In the future, if we want to know something like "the percentage of media element is being used for MSE/EME?", then this scalar can be the base and used to calculate the answser.

Differential Revision: https://phabricator.services.mozilla.com/D83225
2020-09-24 21:41:10 +00:00
Kris Maglione 6f26095043 Bug 1646573: Part 1 - Fix GetInProcessParent usage in WindowShouldMatchActiveTab. r=zombie,nika
Differential Revision: https://phabricator.services.mozilla.com/D90334
2020-09-22 17:41:34 +00:00
Kris Maglione fb3a9daf66 Bug 1655866: Part 2 - Move HasBeforeUnload flag to WindowContext. r=nika
Differential Revision: https://phabricator.services.mozilla.com/D88315
2020-09-21 22:40:51 +00:00
Kris Maglione b050c2c657 Bug 1650257: Part 3 - Remove obsolete diagnostic crash annotations and assertions. r=nika
Differential Revision: https://phabricator.services.mozilla.com/D87487
2020-08-31 18:51:54 +00:00
alwu 75773fa092 Bug 1634494 - part1 : store the active media session context Id on WindowContext. r=chunmin,farre
We determine which media session is active media session in chrome process, but the media session in content process doesn't know the detail.

This patch would store the active session context Id on the top level WindowContext, so that media session in content process can know if it's an active context or not, which helps to trigger the action handler only on active media session, after changing our propagation mechanism in following patches.

Differential Revision: https://phabricator.services.mozilla.com/D88106
2020-08-27 14:11:05 +00:00
Andrew McCreight d914048012 Bug 1659825 - Null check gWindowContexts in WindowContext::Discard(). r=nika
If we're after shutdown, then this variable will have been cleared.
This is the remaining use that was failing to do a null check, and
it was manifesting as a very low-volume crash.

Differential Revision: https://phabricator.services.mozilla.com/D87503
2020-08-18 21:46:07 +00:00
Edgar Chen b2ef530476 Bug 1611961 - Move UserActivationState from BrowsingContext to WindowContext; r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D83126
2020-08-17 11:02:34 +00:00
Kris Maglione 05de051e4a Bug 1650257: Also set NewWindowBCIsTop annotation in parent. r=nika
Differential Revision: https://phabricator.services.mozilla.com/D87111
2020-08-14 19:16:45 +00:00
Jean-Yves Avenard 358cef5d1a Bug 1646539 - Part 3. Fix compilation. r=farre
BrowserContext is only fast declared here.
To avoid having to include the full header, move it out of the header.

Differential Revision: https://phabricator.services.mozilla.com/D86904
2020-08-13 07:16:11 +00:00
Andreas Farre 2f88f75c98 Bug 1646539 - Part 2: Add field on WindowContext tracking popup permission. r=nika
Popup permissions initialized with the result of checking if the
constructing WindowContext's principal is allowed to open a popup. The
field is updated for all WindowContexts sharing a principal whenever
the popup permission for that nsIPrincipal changes.

Differential Revision: https://phabricator.services.mozilla.com/D86378
2020-08-12 15:38:12 +00:00
Steven MacLeod b329c4ff4c Bug 1646547 - fix ScriptLoader::ReadyToExecuteParserBlockingScripts stopping at OOP ancestors. r=kmag
`ReadyToExecuteParserBlockingScripts` was walking the ancestor chain but
would stop if it hit an OOP ancestor. With this change we walk the
`WindowContext` tree instead, so that we may skip over OOP ancestors
and continue checking all in process ancestors.

Differential Revision: https://phabricator.services.mozilla.com/D86436
2020-08-09 23:50:35 +00:00
Kris Maglione 6dc4123fea Bug 1646519: Fix GetInProcessTopInternal usage in GetZone. r=nika
Differential Revision: https://phabricator.services.mozilla.com/D80092
2020-08-07 22:02:02 +00:00