gecko-dev/docshell
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
..
base Bug 1691410 - Add support for reverting racy changes in CanSet, r=kmag 2021-02-20 03:55:06 +00:00
build Bug 1524836 - Move new HTML about:config page from browser to toolkit. r=fluent-reviewers,preferences-reviewers,geckoview-reviewers,Gijs,agi 2021-01-26 00:27:56 +00:00
resources/content Bug 1654103: Standardize on Black for Python code in `mozilla-central`. 2020-10-26 18:34:53 +00:00
shistory Bug 1672873 - Use BuildClonedMessageDataForChild to send cloneable data in SessionHistoryInfo. r=peterv 2021-02-15 16:52:26 +00:00
test Bug 1691595: Move evictAllContentViewers test code to SpecialPowers. r=peterv 2021-02-18 21:04:12 +00:00
moz.build Bug 1654103: Standardize on Black for Python code in `mozilla-central`. 2020-10-26 18:34:53 +00:00