Commit graph

230 commits

Author SHA1 Message Date
Tim Taubert
afed0705da Bug 912717 - Don't let SessionCookie collection jank the chrome process r=mikedeboer
Current state:
--------------

Session cookies - those that have no Expires or Max-Age directive, sent as a
header or set via document.cookie - are meant to live for the duration of a
session. SessionStore is a feature that aims to enable users to resume where
they left off last time they closed the browser. So SessionStore will persist
and restore those cookies that the cookie service only keeps in memory.

SessionCookies.jsm registers observers with the cookie service and is thus
notified of cookie additions, deletions, and modifications as-it-happens. It
has its own internal storage that we could easily serialize and write to disk
together with the rest of the session data.

The hangs shown in various profiles stem from the fact that since the inception
of SessionStore as an add-on around Firefox 2, cookies have been tacked to
windows. This means that whenever we collect session data for a specific
window (i.e. tabs, their shistory entries, etc.) we have to iterate *all* its
tabs and *all* their shistory entries to enumerate the hosts contained in that
window. We will then ask the internal cookie store in SessionCookies.jsm to
give us all cookies for these hosts and then store them together with the
window. This way we filter out cookies from tabs/hosts that have no active
documents (BFCache counts as "active").

Changes in this patch:
----------------------

Instead of trying to only retain cookies from “active” documents, i.e. those
contained somewhere in the shistory of a tab, we now simply save all session
cookies of the session. This will surely reduce user complaints about us
"logging them out" too fast because we discard cookies from tabs they
open only once in a while, although those definitely belong to the
browsing session.

Instead of storing the cookies per each window we now have a top-level
"cookies" attribute that is a list of cookies. These get restored whenever we
restore a session. Legacy window.cookies attributes will still be restored to
support older session formats for a while.

The DEFER_SESSION startup mode is active by default when a user choses not to
restore their whole session automatically but they still have one or more
pinned tabs. These pinned tabs are restored automatically and split off of the
rest of the session. The rest can be restored manually if the user chooses to
do so.

In the past, we here extracted and restored only the pinned tabs' cookies from
the last session. This filtering also works against how some sites (e.g.
Google) use session cookies. It also means we have to iterate all windows,
tabs, shistory entries, and cookies to find the data we want.

This patch changes our past behavior so that we now restore only pinned tabs
but all session cookies. So we don't have to filter, and pages will break less
likely. We hereby assume that a user having pinned tabs wants to continue their
browsing session partially, although without Firefox remembering the exact list
of tabs. Or they simply like starting off of a clean slate.
2017-04-07 14:41:38 +02:00
Mike Conley
32226bd237 Bug 1351677 - When restoring a window, swap the initially selected tab with the desired selected tab instead of tab switching. r=mikedeboer
When restoring a window, it's cheaper if we move the initially selected tab to the
index of the tab that's supposed to be selected in the restored state, rather than
switching to that tab.

If it turns out that moving that tab is not possible (if, for example, the user
context IDs of the two tabs to swap don't match, since the userContextIds are
set at tab construction time), then we fall back to tab switching.

MozReview-Commit-ID: L3qP40K5DaJ

--HG--
extra : rebase_source : 0954dac2f17af74418817ed45c5ab5dee7796511
2017-04-04 15:58:02 -04:00
Tim Taubert
890672d7f9 Bug 1351835 - Update PrivacyLevel.canSave() calls in SessionCookies.jsm r=mikedeboer
The first change we can make is to simplify the PrivacyLevel.canSave() method
itself as it only takes a single argument, `isHTTPS`. Callers shouldn't be
required to pass an object, they should simply pass a boolean.

The second change here is to cleanup SessionCookies.jsm that still passes the
old `isPinned` argument that's no longer needed. We can remove some house
keeping and simplify the cookie collection code.

SessionCookies.getHostsForWindow() that previously returned a map from hostnames
to a site's pinned status (tab.pinned) can now simply return a Set containing
all hostnames found in a window.
2017-03-30 13:57:42 +02:00
Tim Huang
08e052cb86 Bug 1330882 - Part 2: Disallow the session restore to modify window size when fingerprinting resistance is enabled. r=arthuredelstein,mikedeboer
MozReview-Commit-ID: F1Ray6c5dzq

--HG--
extra : rebase_source : ed299058bf6f926e5987468dcab518b110fd7220
2017-03-29 15:43:55 +08:00
Mike Conley
039c9ecb61 Bug 1096013 - Give selected tabs highest priority during restoration. r=mikedeboer
MozReview-Commit-ID: EtApFsDyB50

--HG--
extra : rebase_source : 37d0cc43801f434242b5c3a281c0ce293e1bbdff
2017-03-23 01:59:51 -04:00
Mike Conley
5fd41cbe9c Bug 1096013 - Show tab icons and titles as soon as possible instead of waiting for history restoration to complete. r=mikedeboer
MozReview-Commit-ID: EL8IcreTte2

--HG--
extra : rebase_source : cdaafcfdc4f827d4fd18a1011e3f2e91e4ed59c1
2016-04-20 17:24:24 -04:00
Sebastian Hengst
3ee0d8a59f Backed out changeset 21a926a8dffc (bug 1096013) for eslint failure at browser/components/sessionstore/SessionStore.jsm:2600:11. r=backout 2017-03-24 17:17:50 +01:00
Sebastian Hengst
d05ae51211 Backed out changeset eb6768c39156 (bug 1096013) 2017-03-24 17:17:22 +01:00
Mike Conley
cd02fdc739 Bug 1096013 - Give selected tabs highest priority during restoration. r=mikedeboer
MozReview-Commit-ID: EtApFsDyB50

--HG--
extra : rebase_source : 532341970ff567816d1ad5b94d2912747ef7efcd
2017-03-23 01:59:51 -04:00
Mike Conley
e61b08810d Bug 1096013 - Show tab icons and titles as soon as possible instead of waiting for history restoration to complete. r=mikedeboer
MozReview-Commit-ID: EL8IcreTte2

--HG--
extra : rebase_source : c5bdf040d285af9aed236741ee3b17495de7e588
2016-04-20 17:24:24 -04:00
Mike Conley
04de2908f0 Bug 1342849 - Don't do any notifications for newly added background tabs when restoring session. r=mikedeboer
MozReview-Commit-ID: K8YuBMrl9cX

--HG--
extra : rebase_source : f0c85dfe44e669ec550b24a4d70f6cc7553c2639
2017-03-22 01:17:11 -04:00
Jared Wein
a54eda04ca Bug 1348068 - Enable the key-spacing rule for eslint and fix the related issues. r=standard8
Running eslint with --fix didn't fix many of the issues. The majority here had to be fixed by hand but a significant majority of the issues were related to a few files that I was able to use find-and-replace with. I regret not making this in to separate commits of the hand-fixes and the fixes from --fix but I don't recall --fix fixing any of the issues.

MozReview-Commit-ID: ANyg2qfo3Qx

--HG--
extra : rebase_source : 61d2aa91bf9474af3d72a5dea41b25dca442c1b7
2017-03-21 14:29:43 -04:00
Mike Conley
5d82a3b36c Bug 1256472 - When restoring a window, initialize each browser tab as remote if possible. r=mikedeboer
Originally, we were forcing these restored background tabs to be non-remote by default.
This was because we didn't want them to show the crashed tab favicon nor show about:tabcrashed
if the user hadn't restored them before.

Bug 1241459 added infrastructure that makes it possible to put crashed background tabs into
the "restore on demand" state again, without showing about:tabcrashed or showing the crashed
tab favicon.

This means we should be able to restore tabs in the content process again which should take
some load off of the parent process during session restore, which is good for perceived
performance.

Note that if the content process does crash, the background tabs are then loaded in the parent
process. Restoring them on demand will then do the remoteness flip.

MozReview-Commit-ID: 1mWe0td6geB

--HG--
extra : rebase_source : ea872b615ebe3d8639b214bfafc5e358ba6e65fd
2017-03-14 10:01:38 -04:00
Mike Conley
6b9cc68a36 Bug 1256472 - Add a reason to the restoreTabContent function and message. r=Gijs,mikedeboer
This helps differentiate restorations that were caused by navigateAndRestore, as opposed
to SessionStore having set state via setBrowserState, setWindowState, or setTabState.

MozReview-Commit-ID: DEEbKLh7f7p

--HG--
extra : rebase_source : c48ab225d17128041ccbde4e5cc8c87899166b9e
2017-03-14 09:55:54 -04:00
Sebastian Hengst
fa3375c4ed Backed out changeset ba60dcd190ad (bug 1256472) for leaks in browser_windowStateContainer.js. r=backout 2017-03-16 17:24:01 +01:00
Sebastian Hengst
7345d89cab Backed out changeset 27f5fcaca7fa (bug 1256472) 2017-03-16 17:22:23 +01:00
Mike Conley
a04621c4a8 Bug 1256472 - When restoring a window, initialize each browser tab as remote if possible. r=mikedeboer
Originally, we were forcing these restored background tabs to be non-remote by default.
This was because we didn't want them to show the crashed tab favicon nor show about:tabcrashed
if the user hadn't restored them before.

Bug 1241459 added infrastructure that makes it possible to put crashed background tabs into
the "restore on demand" state again, without showing about:tabcrashed or showing the crashed
tab favicon.

This means we should be able to restore tabs in the content process again which should take
some load off of the parent process during session restore, which is good for perceived
performance.

Note that if the content process does crash, the background tabs are then loaded in the parent
process. Restoring them on demand will then do the remoteness flip.

MozReview-Commit-ID: 1mWe0td6geB

--HG--
extra : rebase_source : 5e1dbbaf0e1fb641bd43f821980ab5dff7272b04
2017-03-14 10:01:38 -04:00
Mike Conley
9ce53ecd28 Bug 1256472 - Add a reason to the restoreTabContent function and message. r=Gijs,mikedeboer
This helps differentiate restorations that were caused by navigateAndRestore, as opposed
to SessionStore having set state via setBrowserState, setWindowState, or setTabState.

MozReview-Commit-ID: DEEbKLh7f7p

--HG--
extra : rebase_source : 7fa68acf1ffd85f28af2be9c00f2ef65b21375f6
2017-03-14 09:55:54 -04:00
Carsten "Tomcat" Book
8fd069a1f2 Merge mozilla-central to autoland 2017-03-14 14:27:38 +01:00
Mark Banner
c26710ebe4 Bug 1311347 - Enable eslint of browser/components/sessionstore/. Manual fixes. r=jaws
MozReview-Commit-ID: AupJNLZJ2Ye

--HG--
extra : rebase_source : b9113d1ca913d399ca4e831f3c381e8fa45847bd
2017-03-13 10:32:03 +00:00
Mark Banner
4acba13973 Bug 1311347 - Enable eslint of browser/components/sessionstore/. Autofix changes. r=jaws
MozReview-Commit-ID: 5LKHbcmjSy

--HG--
extra : rebase_source : d7e4571dae5c5770c7908579d7634419382d78e2
2017-03-10 19:51:20 +00:00
Michael Layzell
f083c8ec83 Bug 1345857 - Clone TabData entries when restoring tabs, r=mikedeboer
MozReview-Commit-ID: BhAbhSHgXWt
2017-03-13 18:57:07 -04:00
Sebastian Hengst
5a87040be3 Backed out changeset 5e4c135cb424 (bug 1345857) for failing at least marionette (test_refresh_firefox.py TestFirefoxRefresh.testReset), functional-ui and browser-chrome. r=backout on a CLOSED TREE 2017-03-13 19:21:03 +01:00
Michael Layzell
f838a81893 Bug 1345857 - Clone TabData entries when restoring tabs, r=mikedeboer
MozReview-Commit-ID: BhAbhSHgXWt
2017-03-13 13:25:01 -04:00
Matheus Longaray
63f7e2e323 Bug 1343056 - Take userTypedValue into account when saving tabs to disk. r=mikedeboer
This patch adds userTypedValue data validation when saving tabs to disk

MozReview-Commit-ID: EltANtbDfqe

--HG--
extra : rebase_source : f1e6b9a3afecfbdacd66716b335695a3bcad255e
2017-03-02 21:24:13 +01:00
jordan9769
5761e9b0d1 Bug 1311347 - Enable eslint of browser/components/sessionstore/. Initial changes by Sourav, updated by Standard8. r=jaws
MozReview-Commit-ID: 4RFxoV8SkIa

--HG--
extra : rebase_source : 96b24b172cfa957489df37943171ddae07145e84
2016-10-28 02:48:50 +05:30
Matheus Longaray
4e111ff76c Bug 1323987 - Keep saving about:blank and about:newtab to disk. r=mikedeboer
This patch creates a new method that verifies if the tab state we're passed is
something we should keep to be reopened at session restore. This is used when
we are saving the current session state to disk. This method is very similar to
_shouldSaveTabState, however, "about:blank" and "about:newtab" tabs will still
be saved to disk.

MozReview-Commit-ID: 70zKFeUG9uQ

--HG--
extra : rebase_source : 994412066334f7a1e85707a011225d7c5b65c319
2017-01-09 19:35:31 +01:00
Mike Conley
170479eb55 Bug 1336230 - Rename macsuppressanimation and CHROME_MAC_SUPPRESS_ANIMATION to be platform agnostic. r=jimm
MozReview-Commit-ID: HWyrm1lVwdY

--HG--
extra : rebase_source : ed8d71d9187a8afff0d3ca65641b335337e20f9d
2017-02-03 16:04:33 -05:00
Christoph Kerschbaumer
5049be70f6 Bug 1307736 - Store triggeringPrincipal with all history entries. r=mdeboer 2017-01-27 11:19:27 +01:00
Kris Maglione
8b86d759bf Bug 1321706: Fix race in closed window handling. r=mikedeboer
MozReview-Commit-ID: KszEE0I7w7e

--HG--
extra : rebase_source : 66ae7bdaf58f041c14224c0196e77a4234af828c
2017-01-11 14:20:27 -08:00
Mike Conley
ae5eef41a2 Bug 1327210 - Make sure we can flip remoteness on a customizemode tab if the user somehow finds a way of navigating away. r=dao
A check for the customizemode attribute was added to SessionStore.restoreTabContent
back when we removed the about:customizing preloading hackery in bug 1014185. This
was added to prevent the extra work of unnecessarily restoring the content for a
tab that was in customize mode (since the content is actually hidden).

However, there are ways for a user to attempt to browse away from customize mode
in the current tab - for example, going to their Home page with Alt-Home. When
we do this in e10s mode, we do a "remoteness flip" to make the hidden about:blank
browser be remote, which causes us to go through the SessionStore machinery to
do the session swap to the new remote browser. The problem is when we hit the
restoreTabContent part - we hit the condition where the customizemode attribute
is set to true, and then we bail out, which means we never finish the swap. We're,
at this point, in a half-restored state that never resolves.

This patch makes it so that in restoreTabContent, if loadArguments is not null (so
we've been given arguments on where to send the browser _next_ on top of its newly
restored history), we don't skip just because the customizemode attribute is set.

MozReview-Commit-ID: HwW7y2EKJvn

--HG--
extra : rebase_source : 73dfebae4f0399905a8146545618e62826817df0
2017-01-10 13:56:15 -05:00
Samael Wang
1e9e35e6e1 Bug 1323651 - Rename Partial/GroupedSessionHistory to Partial/GroupedSHistory. r=ehsan
MozReview-Commit-ID: G2GW4ZPIfH3
2016-12-22 16:06:50 +08:00
Vedant Sareen
9fe2fdf0cb Bug 1323134 - Stop setting the crop attribute on tabs. r=dao 2016-12-18 19:09:27 +01:00
Matheus Longaray
e6b68c3ab4 Bug 1306294 - Filters out not worth-saving tabs from session state. r=mikedeboer
--HG--
extra : amend_source : f68d04558cad4c72c9dbdef661dd6158c8a5a403
2016-12-06 03:30:00 -05:00
Michael Layzell
14a9005e68 Bug 1318767 - Part 1: When performing SessionRestore on a GroupedSHistory tab, ensure that it reverts to a complete SHistory state before restoring, r=mikedeboer
MozReview-Commit-ID: 2zNXDtkx3bs
2016-11-24 10:45:00 +08:00
Bob Silverberg
8e649a473a Bug 1308061 - Implement sessionstore-closed-objects-changed event, r=mikedeboer
MozReview-Commit-ID: 7pBrvAhVQHP

--HG--
extra : rebase_source : 94e2784e733806a181175a163586fc354476a6f2
2016-11-25 10:32:08 -05:00
Bob Owen
4f48f9317d Bug 1147911 Part 2: Add a remote type property and use it to drive the process switching in frontend code. r=gijs, r=jryans, r=mikedeboer 2016-11-24 15:08:30 +00:00
Sebastian Hengst
4240700f13 Backed out changeset 5b26ae9afaea (bug 1147911) 2016-11-23 18:33:10 +01:00
Bob Owen
67d3ea6af8 Bug 1147911 Part 2: Add a remote type property and use it to drive the process switching in frontend code. r=gijs, r=jryans, r=mikedeboer 2016-11-23 13:36:57 +00:00
Carsten "Tomcat" Book
838bd84f47 Backed out changeset 4b75d4672954 (bug 1306294) for bc5 test failures 2016-11-23 12:44:02 +01:00
Matheus Longaray
253c6de341 Bug 1306294 - "Restarting browser while Simplify Page mode on, restores 2 new empty tabs". r=mdeboer 2016-11-22 06:30:00 +08:00
Michael Layzell
054becaed7 Bug 1310771 - Part 3: Add support to SessionStore for recording history for GroupedSHistories, r=mikedeboer
MozReview-Commit-ID: Ffq7h3zRUm3
2016-11-18 16:00:43 -05:00
Sebastian Hengst
5fca81c6e4 Backed out changeset 5cffb4645bc0 (bug 1147911) 2016-11-18 00:58:52 +01:00
Bob Owen
8c7b20c42d Bug 1147911 Part 2: Add a remote type property and use it to drive the process switching in frontend code. r=gijs, r=jryans, r=mikedeboer 2016-11-17 15:48:52 +00:00
Michael Layzell
16da45d78b Bug 1317705 - Pass aRestoreImmediately through to SessionStoreInternal, r=Yoric a=kwierso CLOSED TREE
MozReview-Commit-ID: ENRssR9Wmun
2016-11-15 12:02:23 -08:00
Wes Kocher
87e69af608 Backed out changeset 100920157ed0 (bug 1317705) for bc4 failures a=backout 2016-11-15 11:33:15 -08:00
Michael Layzell
363b71590c Bug 1317705 - Pass aRestoreImmediately through to SessionStoreInternal, r=Yoric
MozReview-Commit-ID: ENRssR9Wmun
2016-11-15 11:32:42 -05:00
Kevin Jones
0eaa912893 Bug 1315222 - Rename the TabBrowserCreated event to TabBrowserInserted. r=dao 2016-11-05 09:01:11 +01:00
Wes Kocher
df5dbf81cc Merge central to inbound a=merge 2016-11-02 17:31:08 -07:00
Geoff Brown
ef3f1323fa Bug 1313397 - Move browser/components/sessionstore/Utils.jsm to toolkit/modules; r=mikedeboer
--HG--
rename : browser/components/sessionstore/Utils.jsm => toolkit/modules/sessionstore/Utils.jsm
2016-11-02 10:56:20 -06:00