Commit Graph

672 Commits

Author SHA1 Message Date
Nika Layzell
e836c49649 Bug 1650089 - Part 1: Add a remoteTypeOverride option for about:blank loads triggered by chrome, r=annyG,kmag
After the changes in this bug, about:blank loads triggered by chrome will
finish in a "web" content process, as they have an untrusted null principal
without a precursor. In a few places throughout the codebase, however, we
perform about:blank loads with the explicit expectation that they do not change
processes. This new remoteTypeOverride option allows the intended final process
to be explicitly specified in this situation.

For security & simplicity reasons, this new attribute is limited to only be
usable on system-principal triggered loads of about:blank in toplevel browsing
contexts.

Differential Revision: https://phabricator.services.mozilla.com/D120671
2021-08-10 14:31:16 +00:00
Butkovits Atila
0d09646c51 Backed out 8 changesets (bug 1650089) for causing Xpcshell failures on test_ext_redirects.js. CLOSED TREE
Backed out changeset ee763318d378 (bug 1650089)
Backed out changeset 24d7898ec4bd (bug 1650089)
Backed out changeset bcdd2f5c9840 (bug 1650089)
Backed out changeset 24a5bd7f97dd (bug 1650089)
Backed out changeset 1b8b4e939e82 (bug 1650089)
Backed out changeset a7a4f37a5d72 (bug 1650089)
Backed out changeset 78c012d4b071 (bug 1650089)
Backed out changeset e870508c1ddc (bug 1650089)
2021-08-06 04:35:52 +03:00
Nika Layzell
c1e1efbbcb Bug 1650089 - Part 1: Add a remoteTypeOverride option for about:blank loads triggered by chrome, r=annyG,kmag
After the changes in this bug, about:blank loads triggered by chrome will
finish in a "web" content process, as they have an untrusted null principal
without a precursor. In a few places throughout the codebase, however, we
perform about:blank loads with the explicit expectation that they do not change
processes. This new remoteTypeOverride option allows the intended final process
to be explicitly specified in this situation.

For security & simplicity reasons, this new attribute is limited to only be
usable on system-principal triggered loads of about:blank in toplevel browsing
contexts.

Differential Revision: https://phabricator.services.mozilla.com/D120671
2021-08-06 00:10:56 +00:00
Doug Thayer
422c3e0585 Bug 1546847 - Backed out bug 1546847 and related revs r=Gijs
Differential Revision: https://phabricator.services.mozilla.com/D121898
2021-08-05 18:34:56 +00:00
Alexandru Michis
c8caa831d9 Backed out 7 changesets (bug 1650089) for causing xpcshell failures in test_ext_cookieBehaviors.js
Backed out changeset 336d6eb2fc15 (bug 1650089)
Backed out changeset 283ba29cdbeb (bug 1650089)
Backed out changeset c470e4c65117 (bug 1650089)
Backed out changeset 8fc2f428694d (bug 1650089)
Backed out changeset 37e5185dae14 (bug 1650089)
Backed out changeset a26afdc56d91 (bug 1650089)
Backed out changeset 32e207558b3d (bug 1650089)
2021-08-04 12:32:07 +03:00
Nika Layzell
56bfde27c5 Bug 1650089 - Part 1: Add a remoteTypeOverride option for about:blank loads triggered by chrome, r=annyG,kmag
After the changes in this bug, about:blank loads triggered by chrome will
finish in a "web" content process, as they have an untrusted null principal
without a precursor. In a few places throughout the codebase, however, we
perform about:blank loads with the explicit expectation that they do not change
processes. This new remoteTypeOverride option allows the intended final process
to be explicitly specified in this situation.

For security & simplicity reasons, this new attribute is limited to only be
usable on system-principal triggered loads of about:blank in toplevel browsing
contexts.

Differential Revision: https://phabricator.services.mozilla.com/D120671
2021-08-03 18:17:54 +00:00
Noemi Erli
dec3cca55f Backed out 7 changesets (bug 1650089) foe causing bustages in ProcessIsolation.cpp
Backed out changeset 4e73beb8872c (bug 1650089)
Backed out changeset 092451e931ce (bug 1650089)
Backed out changeset ca9ba60010c6 (bug 1650089)
Backed out changeset ee61b69ba556 (bug 1650089)
Backed out changeset 091c4efa36a7 (bug 1650089)
Backed out changeset dbdee40ef8a0 (bug 1650089)
Backed out changeset 54d12a4333a0 (bug 1650089)
2021-08-03 20:15:54 +03:00
Nika Layzell
0c2e579295 Bug 1650089 - Part 1: Add a remoteTypeOverride option for about:blank loads triggered by chrome, r=annyG,kmag
After the changes in this bug, about:blank loads triggered by chrome will
finish in a "web" content process, as they have an untrusted null principal
without a precursor. In a few places throughout the codebase, however, we
perform about:blank loads with the explicit expectation that they do not change
processes. This new remoteTypeOverride option allows the intended final process
to be explicitly specified in this situation.

For security & simplicity reasons, this new attribute is limited to only be
usable on system-principal triggered loads of about:blank in toplevel browsing
contexts.

Differential Revision: https://phabricator.services.mozilla.com/D120671
2021-08-03 15:39:33 +00:00
Doug Thayer
1099a0fe75 Bug 1546847 - Cache tab icons in worker to avoid serialization r=kashav
Read this as a first step. It's the easiest first step I could think of to
both reduce the quantity of stuff we serialize and ship to the worker as
well as to spread it out over multiple messages.

Anyway, the motivation is pretty simple. Taking a look at a session store
file on disk, a giant chunk of it is base64 encoded tab icons. I suspect
that in many cases these are not distinct. For my session store it's about
90% the same repeated searchfox icon over and over.

So what I did was I changed the "image" property of the tab to be a reference
into a deduplicated cache of objects (in this case strings). Whenever the tab
icon changes, we drop a reference to its cache entry and add a reference to a
new or existing entry. Each time a cache entry is added or deleted, we send
a message to the worker to update its own copy of the cache. This does
represent a memory hit, since the cache is maintained on the worker as well as
the main thread, but I think it's going to be minor, and it's only in one
process. Given the deduplication there is the possibility of an overall
reduction in memory use? This needs more testing.

Once it comes time to write the session data to disk, we send the payload with
"image" entries referencing IDs in the cache. When the worker gets the message
to write, it adds its internal cache to the object, which it then serializes
to JSON and writes to disk as usual.

When reading the data off disk, we take the cache items that had been written
and we slowly populate the worker's internal cache with them (to not overload
during startup with a giant message). And when populating tab icons of tabs in
the tab strip, we look up the image in the main thread copy of the cache. Also,
if we cannot find the entry, we assume that the image is just the raw
representation of the image. This ensures that we interpret a sessionstore file
from prior to this patch correctly.

Additionally, since we have the cache duplicated on both threads, if the worker
gets terminated for some reason, we rehydrate it with the snapshot of the cache
from when we noticed it was a problem.

I suspect some tests will need to be updated, or maybe many tests. However I
wanted to throw this patch past someone with more knowledge of the session
store's inner workings before throwing a bunch of time at that.

Differential Revision: https://phabricator.services.mozilla.com/D114196
2021-08-02 16:17:30 +00:00
Dorel Luca
0ec812b2f0 Backed out 5 changesets (bug 1650089) for Browser-chrome failures in browser/components/originattributes/test/browser/browser_firstPartyIsolation_aboutPages.js. CLOSED TREE
Backed out changeset 26ddad079ad3 (bug 1650089)
Backed out changeset 5ae2b2641484 (bug 1650089)
Backed out changeset c5d267a1907c (bug 1650089)
Backed out changeset d9eeca699dec (bug 1650089)
Backed out changeset 8bb303f6831a (bug 1650089)
2021-07-29 05:53:31 +03:00
Nika Layzell
9e235a6989 Bug 1650089 - Part 1: Add a remoteTypeOverride option for about:blank loads triggered by chrome, r=annyG,kmag
After the changes in this bug, about:blank loads triggered by chrome will
finish in a "web" content process, as they have an untrusted null principal
without a precursor. In a few places throughout the codebase, however, we
perform about:blank loads with the explicit expectation that they do not change
processes. This new remoteTypeOverride option allows the intended final process
to be explicitly specified in this situation.

For security & simplicity reasons, this new attribute is limited to only be
usable on system-principal triggered loads of about:blank in toplevel browsing
contexts.

Differential Revision: https://phabricator.services.mozilla.com/D120671
2021-07-29 01:40:19 +00:00
Antonin LOUBIERE
7a92a54c90 Bug 490136 - fix last tab re-opening after the close with session restore. r=Gijs
If one closes the last tab with the session restore enabled, it will re-open after restart.
Fix that by closing completely the tabs before the stop of the browser.

Differential Revision: https://phabricator.services.mozilla.com/D118270
2021-07-21 10:28:02 +00:00
Sandor Molnar
6dce466046 Backed out changeset da1412413022 (bug 490136) for causing bc failures in sessionstore/test/browser_625016. CLOSED TREE 2021-07-20 20:04:22 +03:00
Antonin LOUBIERE
2836aef3d9 Bug 490136 - fix last tab re-opening after the close with session restore. r=Gijs
If one closes the last tab with the session restore enabled, it will re-open after restart.
Fix that by closing completely the tabs before the stop of the browser.

Differential Revision: https://phabricator.services.mozilla.com/D118270
2021-07-20 10:42:48 +00:00
Anny Gakhokidze
33a3d37016 Bug 1692749 - Skip superfluous about:blank load when duplicating a tab, r=kashav,extension-reviewers,kmag
When we duplicate a tab, we don't need to have about:blank load in it, because
we are going to use restore mechanism to copy data into the new tab. If we
don't skip the superfluous load, the restoring process might race with the
loading of about:blank, and sometimes we might try to destroy the
WindowGlobalChild actor just as SessionStore is trying to restore docshell
capabilities for that tab resulting in a rejected promise in _restoreHistory
and `_restoreHistoryComplete` not getting called.

Differential Revision: https://phabricator.services.mozilla.com/D119313
2021-07-08 22:31:52 +00:00
Marian-Vasile Laza
f6e8cad90d Backed out changeset 41171ae56f5e (bug 1692749) for causing bc failures on browser_searchMode_sessionStore.js. CLOSED TREE 2021-07-08 02:37:31 +03:00
Anny Gakhokidze
fc48a089ea Bug 1692749 - Skip superfluous about:blank load when duplicating a tab, r=kashav,extension-reviewers,kmag
When we duplicate a tab, we don't need to have about:blank load in it, because
we are going to use restore mechanism to copy data into the new tab. If we
don't skip the superfluous load, the restoring process might race with the
loading of about:blank, and sometimes we might try to destroy the
WindowGlobalChild actor just as SessionStore is trying to restore docshell
capabilities for that tab resulting in a rejected promise in _restoreHistory
and `_restoreHistoryComplete` not getting called.

Differential Revision: https://phabricator.services.mozilla.com/D119313
2021-07-07 22:08:46 +00:00
Kashav Madan
3b6f8b305d Bug 1703692 - Update SessionStore and TabState{,Cache} functions to take a permanentKey, r=nika
Differential Revision: https://phabricator.services.mozilla.com/D118541
2021-06-26 20:25:29 +00:00
Kashav Madan
a1f3331643 Bug 1703692 - Store the latest embedder's permanent key on CanonicalBrowsingContext, r=nika,mccr8
And include it in Session Store flushes to avoid dropping updates in case the
browser is unavailable.

Differential Revision: https://phabricator.services.mozilla.com/D118385
2021-06-26 20:25:29 +00:00
Dorel Luca
c293dee662 Backed out 3 changesets (bug 1703692) for Browser-chrome failures in browser/components/sessionstore/test/browser_broadcast.js. CLOSED TREE
Backed out changeset fe5703d7b580 (bug 1703692)
Backed out changeset eec4a4138ca7 (bug 1703692)
Backed out changeset 6745b363a745 (bug 1703692)
2021-06-26 10:09:23 +03:00
Kashav Madan
d3a7f8a79a Bug 1703692 - Update SessionStore and TabState{,Cache} functions to take a permanentKey, r=nika
Differential Revision: https://phabricator.services.mozilla.com/D118541
2021-06-26 05:49:12 +00:00
Kashav Madan
bb26572412 Bug 1703692 - Store the latest embedder's permanent key on CanonicalBrowsingContext, r=nika,mccr8
And include it in Session Store flushes to avoid dropping updates in case the
browser is unavailable.

Differential Revision: https://phabricator.services.mozilla.com/D118385
2021-06-26 05:49:12 +00:00
Iulian Moraru
6f300817be Backed out 3 changesets (bug 1703692) for causing bc failures on multiple files.
Backed out changeset a199dfd8ce8d (bug 1703692)
Backed out changeset 599a0a99ded9 (bug 1703692)
Backed out changeset 14fe807e6be4 (bug 1703692)
2021-06-25 00:43:23 +03:00
Kashav Madan
7728d0686d Bug 1703692 - Update SessionStore and TabState{,Cache} functions to take a permanentKey, r=nika
Differential Revision: https://phabricator.services.mozilla.com/D118541
2021-06-24 20:26:14 +00:00
Kashav Madan
bc90a488f7 Bug 1703692 - Store the latest embedder's permanent key on CanonicalBrowsingContext, r=nika,mccr8
And include it in Session Store flushes to avoid dropping updates in case the
browser is unavailable.

Differential Revision: https://phabricator.services.mozilla.com/D118385
2021-06-24 20:26:13 +00:00
Kashav Madan
61b1f1a622 Bug 1696815 - Wait for the _restoreHistory() promise before firing SSTabRestored, r=annyG
Differential Revision: https://phabricator.services.mozilla.com/D118501
2021-06-23 16:15:51 +00:00
Kashav Madan
0795de2ffe Bug 1696815 - Handle browser.loadURI() calls that happen before the browser is fully restored, r=annyG,nika,zombie
Differential Revision: https://phabricator.services.mozilla.com/D118101
2021-06-23 16:15:51 +00:00
Alexandru Michis
8d8a297193 Backed out 2 changesets (bug 1696815) for causing bc failures in browser_ext_tabs_discard_reversed.js
CLOSED TREE

Backed out changeset b52bf621dbe4 (bug 1696815)
Backed out changeset ca4535b8d3aa (bug 1696815)
2021-06-23 02:09:45 +03:00
Kashav Madan
df28ff8395 Bug 1696815 - Wait for the _restoreHistory() promise before firing SSTabRestored, r=annyG
Differential Revision: https://phabricator.services.mozilla.com/D118501
2021-06-22 19:58:42 +00:00
Kashav Madan
d6c17ef6fa Bug 1696815 - Handle browser.loadURI() calls that happen before the browser is fully restored, r=annyG,nika,zombie
Differential Revision: https://phabricator.services.mozilla.com/D118101
2021-06-22 19:58:42 +00:00
Kashav Madan
9778a93dc8 Bug 1716444 - Don't do final tab state flush for replaced contexts, r=farre,annyG
If we're destroying the frame loader of a replaced browsing context we'll end up
firing browser-shutdown-tabstate-updated for a tab that wasn't actually closed.

This results in us cleaning up Session Store state earlier than expected, which
means we drop future updates to SessionStoreInternal._closedTabs.

Fixes browser_sessionHistory.js, browser_async_remove_tab.js, and possibly
browser_491168.js for SHIP+BFCache.

Differential Revision: https://phabricator.services.mozilla.com/D117944
2021-06-16 14:05:53 +00:00
Andreas Farre
b9e6293b00 Bug 1705689 - Don't update the tab state if the browsing context has been replaced. r=kashav
Differential Revision: https://phabricator.services.mozilla.com/D117266
2021-06-14 13:48:49 +00:00
Anny Gakhokidze
f50e5a2271 Bug 1709136 - Part 1: Remove the explicit remoteness switch that happens during the restore process, r=nika,kashav
Differential Revision: https://phabricator.services.mozilla.com/D116209
2021-06-11 20:12:10 +00:00
Kashav Madan
8e1b580c53 Bug 1715264 - Cleanup how Session Store collects SessionHistory, r=farre
This does a few things:

1. Removes the `aImmediately` flag from the RequestSHistoryUpdate path, and
   moves that responsibility to SessionStore
1. Simplifies how and when SessionStore calls SessionHistory.collectFromParent()
1. Attempts to clean-up SessionStore's SHistoryListener (again)

Differential Revision: https://phabricator.services.mozilla.com/D117230
2021-06-10 14:30:59 +00:00
Andreas Farre
7f00bb04af Bug 1710004 - Part 3: Restore session storage from the parent process. r=kashav,asuth
Depends on D116007

Differential Revision: https://phabricator.services.mozilla.com/D116213
2021-06-08 13:42:33 +00:00
Kashav Madan
fd8c06b448 Bug 1706445 - Stop loading content-sessionStore.js for SHIP, r=nika
Differential Revision: https://phabricator.services.mozilla.com/D116147
2021-06-01 20:06:47 +00:00
Kashav Madan
3ea6f755ce Bug 1706445 - Handle isFinal updates through native code, r=nika
Replaces the `isFinal` bit with a "browser-shutdown-tabstate-updated" observer
notification, which is fired after all frames in the document are flushed.

Differential Revision: https://phabricator.services.mozilla.com/D116146
2021-06-01 20:06:47 +00:00
Kashav Madan
b37ae426cb Bug 1706445 - Merge the two TabState.update() paths, r=nika
This will make it easier to handle isFinal updates.

Differential Revision: https://phabricator.services.mozilla.com/D116145
2021-06-01 20:06:47 +00:00
Anny Gakhokidze
f97d657a0f Bug 1703326 - Stop relying on ContentSessionStore for SessionStore:crashedTabRevived, r=kashav
Differential Revision: https://phabricator.services.mozilla.com/D113425
2021-05-12 19:33:47 +00:00
Kashav Madan
eac70e8972 Bug 1702055 - Ensure SSTabRestoring is only fired once per browser, r=nika
A previous patch made it so we'd fire this after the full restore finished, but
some consumers expect this event prior to the completion of the load.

Differential Revision: https://phabricator.services.mozilla.com/D114001
2021-05-03 18:16:41 +00:00
Kashav Madan
3bfc3cb594 Bug 1702055 - Move the "restore DocShell state" process out of ContentSessionStore, r=nika
This also makes it so that we will never fire SSTabRestored without first having
sent the associated SSTabRestoring event.

Differential Revision: https://phabricator.services.mozilla.com/D110335
2021-05-03 18:16:41 +00:00
Kashav Madan
e583ecfaab Bug 1702055 - Include the SessionStore epoch in "SessionStore:flush" messages, r=nika
With the removal of the SessionStore:RestoreDocShellState message, the epoch
will no longer be updated otherwise, so we should include it in the Flush
message to ensure that messages are not being dropped.

Differential Revision: https://phabricator.services.mozilla.com/D110334
2021-05-03 18:16:40 +00:00
Kashav Madan
556162f994 Bug 1702055 - Replace CallRestoreTabContentComplete with a Promise, r=nika
This should help avoid message ordering issues in the next patches. To ensure
that we're not firing events too early, we now do a "full" restore even if we
don't have form or scroll data, including for about:blank URIs.

This also moves all restore state on the CanonicalBrowsingContext into a
separate `mRestoreState` struct.

Differential Revision: https://phabricator.services.mozilla.com/D110333
2021-05-03 18:16:40 +00:00
Butkovits Atila
80c415a4fc Backed out 4 changesets (bug 1702055) for causing failures on /browser_UsageTelemetry_private_and_restore.js. CLOSED TREE
Backed out changeset af21e2d8324e (bug 1702055)
Backed out changeset ff67df9befe5 (bug 1702055)
Backed out changeset b5f0638dcbc4 (bug 1702055)
Backed out changeset bffaa2c203b3 (bug 1702055)
2021-04-28 04:42:09 +03:00
Kashav Madan
ed25699760 Bug 1702055 - Only call setInitialTabTitle() if the label hasn't yet been set, r=nika
With the new "restore docshell state" codepath, we may be calling
updateTabLabelAndIcon() later than we did before, which means we may have
already set the tab label (in tabbrowser.init()), and it's incorrect to override
that label value with the session history entry's title.

Differential Revision: https://phabricator.services.mozilla.com/D111456
2021-04-27 19:54:58 +00:00
Kashav Madan
5032f65750 Bug 1702055 - Move the "restore DocShell state" process out of ContentSessionStore.jsm, r=nika
This also makes it so that we will never fire SSTabRestored without first having
sent the associated SSTabRestoring event.

Differential Revision: https://phabricator.services.mozilla.com/D110335
2021-04-27 19:54:57 +00:00
Kashav Madan
f163b81676 Bug 1702055 - Ensure that ContentSessionStore's epoch is updated for tab flushes, r=nika
With the removal of the SessionStore:RestoreDocShellState message, the epoch
will no longer be updated otherwise, so we should include it in the Flush
message to ensure that messages are not being dropped.

Differential Revision: https://phabricator.services.mozilla.com/D110334
2021-04-27 19:54:57 +00:00
Kashav Madan
079d321f9d Bug 1702055 - Replace CallRestoreTabContentComplete with a Promise, r=nika
This should help avoid message ordering issues in the next patches. To ensure
that we're not firing events too early, we now do a "full" restore even if we
don't have form or scroll data, including for about:blank URIs.

This also moves all restore state on the CanonicalBrowsingContext into a
separate `mRestoreState` struct.

Differential Revision: https://phabricator.services.mozilla.com/D110333
2021-04-27 19:54:56 +00:00
Kashav Madan
e7ef1c3516 Bug 1705547 - Null check the SessionHistory object before attempting to collect, r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D112290
2021-04-16 12:02:17 +00:00
Kashav Madan
e520e16620 Bug 1700963 - Stop relying on the "SessionStore:addSHistoryListener" message, r=nika
We now create the listener after receiving a "browsing-context-did-set-embedder"
and destroy it after receiving "browsing-context-discarded".

Differential Revision: https://phabricator.services.mozilla.com/D110337
2021-04-14 23:36:10 +00:00