Commit graph

1865 commits

Author SHA1 Message Date
Tim Huang
8f6d9f30c3 Bug 1351084 - Making the TabState.jsm collecting 'iconLoadingPrincipal' from browser.mIconLoadingPrincipal. r=mikedeboer
The browser.contentPrincpal will report a null prinicpal instead of the actual
content principal if the tab is not loaded. So the SessionStore will collect a
wrong principal for the 'iconLoadingPrincipal', and it will use this wrong
principal to load favicon when session restoring.

To fix this problem, this patch makes the TabState.jsm to collect
'iconLoadingPrincipal' from browser.mIconLoadingPrincipal which will be the
correct principal for loading favicon.

MozReview-Commit-ID: AYUbHFKaG8v

--HG--
extra : rebase_source : 3e2333f18c221d415bd0e26bc416a841344cef2c
2017-03-29 10:46:01 +08:00
Carsten "Tomcat" Book
3a762886de Merge mozilla-central to mozilla-inbound 2017-04-07 15:33:03 +02:00
Tim Taubert
4da3a7f72e Bug 912717 - Tiny follow-up to fix ESLint bustage caused by a test file r=bustage 2017-04-07 15:09:46 +02:00
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
Mark Banner
92c422a2d6 Bug 1342459 - Add a rule to automatically detect ContentTask.spawn and inject the relevant globals. r=mossop
This reduces the amount of places where we need to specify the mozilla/frame-script environment. It does have
the side effect of allowing those globals in the whole file, but that is what specifying the environment would
do, and this is also for mochitest test files only.

MozReview-Commit-ID: 1LLFbn6fFJR

--HG--
extra : rebase_source : 82a6934d90bbbbd25f91b7b06bf4f9354e38865a
2017-04-05 10:00:25 +01:00
Joel Maher
16ec3a15a0 Bug 1341980 - Intermittent browser/components/sessionstore/test/browser_819510_perwindowpb.js - disable on osx. r=gbrown
MozReview-Commit-ID: J3IL8cHAmau
2017-04-06 07:29:53 -04:00
Wes Kocher
264adb55c2 Merge m-c to autoland, a=merge 2017-04-05 14:20:01 -07:00
Tim Taubert
63d25c5647 Bug 1353533 - Don't create maps for non-session cookies when reloading all cookies r=mikedeboer
When initializing the service in SessionCookies.jsm,
SessionCookies._reloadCookies() currently iterates all cookies held by the
coookie service and calls _updateCookie() to add them. _updateCookie() however
is supposed to deal with cookie modifications, including session cookies being
converted to longer-lived ones, and thus handles deletion too.

This patch ensures a fast startup path by ignoring cookie deletion, we only
ever need to add new session cookies when initializing on startup. It also
changes the "cookie added" notification handler to ignore deletion.

Additionally, CookieStore.delete() is a little more intelligent now and avoids
the creation of maps only to find out the cookie didn't exist after all.
2017-04-05 16:05:46 +02:00
Mike Conley
e80d1e033b Bug 1351677 - Fix a race in browser_394759_purge.js. r=mikedeboer
MozReview-Commit-ID: J1z8Y5Zbwgz

--HG--
extra : rebase_source : 31cbee03b926e60f914ad2f9914ebd9bd6953c4f
2017-04-04 16:02:06 -04:00
Mike Conley
56cf3663de Bug 1351677 - Update browser_remoteness_flip_on_restore test to account for initial tab swapping. r=mikedeboer
MozReview-Commit-ID: 152bkpjVsPv

--HG--
extra : rebase_source : e32116c6f3baef212bc366a758cde6ad8b0494c5
2017-04-04 16:01:28 -04: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
Will Wang
9ab097c6ac Bug 1305950 - Don't collect/save the session when the user is idle. r=mdeboer
This patch includes:
- (By Yoric) Don't collect/save the session when the user is idle;r=mdeboer
- Add a test for the behavior of state writing in idle/active mode

When the user is not actively using the computer, webpages may still
perform changes that require (re)writing to sessionstore, e.g.  updating
Session Cookies or DOM Session Storage, or refreshing, etc. Before
this patch, a single active page can require us to
recollect/serialize/write the entire Session Restore file every 15
seconds even when the user is not in front of the computer.

We expect that, when the user is not in front of the computer, changes
are not critical and don't need to be saved as often. We now adopt the
following strategy:

- when the user has been away for (by default) 15 seconds, finish any
  pending collect/write, then increase the collect/write buffering
  delay to (by default) 1h

- when the user returns, reschedule any pending 1h collect/write as a
  (by default) 15 seconds collect/write, then proceed with (by
  default) 15 seconds collect/write delays.

--HG--
extra : histedit_source : b7ea6a6fbfee2f3a2bddeaa69b6446d7544c2585
2017-03-31 11:38:01 +08:00
Kevin Jones
c72ef4be47 Bug 1352183 - Preserve lazy browsers' lazy state when closing the window. r=dao 2017-04-04 13:34:26 +02:00
Dão Gottwald
1719c11783 Backed out changeset 438624f92fbc 2017-03-31 19:03:42 +02:00
Kevin Jones
7b230dd9fb Bug 1352183 - Preserve lazy browsers' lazy state when closing the window. r=dao 2017-03-31 18:45:08 +02:00
Tim Taubert
ff47acdd0e Bug 1352365 - Remove duplicate PrivacyLevel checks in SessionCookies.jsm r=mikedeboer
PrivacyLevel checks currently allow to disable storing secure cookies and any
cookies belonging to an HTTPS host, or completely disable storing cookies. We
call PrivacyLevel.canSave() for every host found in the shistory of a given
window's tabs. We then call it again for every cookie when retrieving all
cookies stored for a given host.

The two different privacy checks exist because in the past an HTTP site could
send a secure cookie too. Since Firefox 52 this isn’t possible anymore, only
HTTPS sites can send secure cookies. So as soon as nsICookie.isSecure=true
we know the site was loaded over TLS.

That means there are the following scenarios:

[PRIVACY_LEVEL=NONE] (default)
We store all cookies.

[PRIVACY_LEVEL=FULL]
We store no cookies at all.

[PRIVACY_LEVEL=ENCRYPTED]
HTTP site sends cookie: Store.
HTTP site sends secure cookie: Can't happen since Fx52
HTTPS site sends cookie: Store. The site is HTTPS but we should store the
cookie anyway because the "Secure" directive is missing. That means the
site wants us to send it for HTTP requests too.
HTTPS site sends secure cookie: Don't store.

This allows us to simplify the code and remove the per-host PrivacyLevel
checks. Checking nsICookie.isSecure is enough to tell whether we want
to keep a cookie or not.
2017-03-31 11:54:18 +02: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
Wes Kocher
914dd4b76c Merge inbound to m-c a=merge 2017-03-28 13:30:56 -07:00
milindl
6109edd9bd Bug 1247201 - yield on tests using removeDataFromDomain,r=mak
This changeset changes tests using ForgetAboutSite.removeDataFromDomain
to yield on it, since now it is a Task

MozReview-Commit-ID: 72OEYoO1avd

--HG--
extra : rebase_source : 9ea8cc06493c3e965d260dc9377461ff29fe572a
2017-03-17 14:29:48 +05:30
Geoff Brown
117eae5d10 Bug 1284312 - Skip browser_819510_perwindowpb.js on win64 for persistent intermittent failures; r=jmaher 2017-03-28 08:15:12 -06:00
Jan Henning
8da83bac15 Bug 1265818 - Part 4 - Test that scroll positions for previous session history entries are restored on Desktop. r=mikedeboer
This extends the existing the existing scroll position test by navigating to a second page and then checking that after closing and restoring that tab, the scroll position is restored not only for the current history entry, but after going back as well.

MozReview-Commit-ID: Ddig1Mfo5rz

--HG--
extra : rebase_source : 20bdc1f116b27f7386a9b7d1cdc0ad383b21b99c
2017-02-19 22:17:28 +01:00
Jan Henning
6d4628844f Bug 1265818 - Part 3 - Store and restore the LayoutHistoryState through SessionHistoy.jsm. r=mikedeboer
Since a LayoutHistoryState is basically just a collection of PresStates, we just save each PresState we can find and then later restore it.

MozReview-Commit-ID: A6WpdelseHn

--HG--
extra : rebase_source : 21c2929ed64ff5ef046ea65664af78cdad517786
2017-03-25 15:32:36 +01:00
Mike Conley
132aa6c7f2 Bug 1348613 - Only use sync message for SessionStore:restoreHistoryComplete for non-remote tabs. r=mikedeboer
MozReview-Commit-ID: IuOtKpudDTU

--HG--
extra : rebase_source : 9cd70dd4d6bd2807742e2e84da0c4cc7cc2a2f35
2017-03-27 12:56:38 -04:00
Mike Conley
3715be2910 Bug 1348613 - Make SessionStore:restoreTabContentStarted message always async. r=mikedeboer
MozReview-Commit-ID: 8TwPFUbXluW

--HG--
extra : rebase_source : b450809f61d7acb4e83788895bc77adafabfde86
2017-03-27 12:15:50 -04:00
Mike Conley
e5f75b2640 Bug 1096013 - Add a test that ensures that we don't lose the favicon for background tabs that crash. r=mikedeboer
MozReview-Commit-ID: BoF62uPSfUC

--HG--
extra : rebase_source : 5549eaa87adcf93b81dbebc6e7e69c3ab5fc0e78
2017-03-24 10:26:49 -04: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
Joel Maher
48d7c50fac Bug 1211084 - Intermittent e10s browser_async_remove_tab.js. disable on debug. r=mikedeboer
MozReview-Commit-ID: BxYvy8WswY1
2017-03-24 09:50:49 -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
Mark Banner
bd625e4e9f Bug 1347712 - Change the testing configurations into ESLint configurations within eslint-plugin-mozilla - automatically update .eslintrc.js test config files for new config locations. r=jaws
MozReview-Commit-ID: LH0CQOPfoe6

--HG--
extra : rebase_source : 83eaf40c5cbb5e25cfb3f3b5afadf4fbf0422c92
2017-03-20 12:36:37 +01: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
Joel Maher
e3484be3f7 Bug 1167933 - Intermittent e10s browser_async_flushes.js- disable on debug. r=mikedeboer
MozReview-Commit-ID: 357NSaMFLqc
2017-03-17 16:39:23 -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
Blake Kaplan
2782e4e4b4 Bug 1346286 - Remove CPOWs from browser_history_persist.js r=Felipe
MozReview-Commit-ID: 22fQbSgMzQM

--HG--
extra : rebase_source : 440fde61df0a652f0e045068d12ab6ef7ecf281a
2017-03-09 14:30:30 -08:00
Blake Kaplan
66ff3b755f Bug 1346286 - Remove CPOWs from browser_911547.js. r=Felipe
MozReview-Commit-ID: 3Y5K84X2EIe

--HG--
extra : rebase_source : 3ef4c073a92ab580d0baa1caa0a1cd14e5bec160
2017-03-09 11:36:28 -08:00
Blake Kaplan
1a97f71604 Bug 1346286 - Remove CPOWs from browser_500328.js. r=Felipe
MozReview-Commit-ID: 2Ok956Ec2ub

--HG--
extra : rebase_source : 19bc7673818ac49ceb47958bcf7e654a02fabbdb
2017-03-08 17:07:57 -08:00
Blake Kaplan
2a88902832 Bug 1346286 - Remove CPOWs from browser_687710_2.js. r=Felipe
MozReview-Commit-ID: Au09j3DGveY

--HG--
extra : rebase_source : 73eb360b97af7e7175446f1790c562427d48f6ad
2017-03-07 18:09:42 -08:00
Blake Kaplan
928a1b69e2 Bug 1346286 - Remove CPOWs from browser_739805.js. r=Felipe
MozReview-Commit-ID: I2wWOxSbdsD

--HG--
extra : rebase_source : 5563ca8f20ae229ce6191e9a149046a0be7da268
2017-03-07 16:38:13 -08: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