These fixes are in preparation of making browser-chrome tests fail when there are unhandled Promise rejections.
MozReview-Commit-ID: JTMgC2XwzX2
--HG--
extra : rebase_source : 4d0b0465641b2286d01f872b0cf8052af5573939
extra : amend_source : 75dacab1ff06bcab2a05e6e744845b151f97d06c
extra : intermediate-source : 047e38fdb0c889e7e7dc0c2cd5a4e6dc6aa7fe22
extra : source : b59573695517b2a464f22e00bd3792c50dcf371a
DevTools are moving out of mozilla-central and m-c code should only rely on the
DevToolsShim that will remain available in m-c after the migration.
This changeset updates SessionStore.jsm to call the DevToolsShim instead of the
scratchpadmanager.
The actual underlying implementation is the same when devtools are installed and
no-ops when they are not.
MozReview-Commit-ID: Fv22TtjJiDw
--HG--
extra : rebase_source : eb051a1612598eb3ca11cff8be92f55f5cb3f7ca
This change means that any related http pages driven through content (window.open, links, etc.) will continue to be loaded in the file content process.
Same-origin loads via the UI will also remain in the file content process.
Cross-origin loads via the UI will cause a process switch.
History navigation will stay in the process, if it was originally loaded in that process.
This patch adds customizemode attribute data validation when saving tabs to disk.
MozReview-Commit-ID: 2GFXpApi0iQ
--HG--
extra : rebase_source : ce82001fbdabfda88621277fa750d60c8f1ccd6b
If the tab was resumed before, it could start playing any autoplay media without user's
permission after session restore.
MozReview-Commit-ID: C3DHIIsLtJA
--HG--
extra : rebase_source : 9517525aa242bff3150a902070544cf64c5ba6c1
While setTab does end up setting the label and icon, it also does completely different and more crucial things. This call really doesn't belong in updateTabLabelAndIcon.
MozReview-Commit-ID: 1ZSY17ThNx
--HG--
extra : rebase_source : 7406be1314e50665b2a4aa612916e93846ac32f1
While setTab does end up setting the label and icon, it also does completely different and more crucial things. This call really doesn't belong in updateTabLabelAndIcon.
MozReview-Commit-ID: 9HXYS0fXgRN
--HG--
extra : rebase_source : f11e283bdc487f8df4ba8013f420158b6f356dbe
restoreWindow only opens new tabs rather than re-use pre-existing tabs, so
there's no point in calling showTab anymore. hideTab also will not hide the
selected tab, so the "all tabs to be restored are hidden" case can't happen.
MozReview-Commit-ID: FzmRcjprkuN
--HG--
extra : rebase_source : 9e7bbdb4c56220b148636e332c4d518b46c71a37
This patch replaces FX_SESSION_RESTORE_CONTENT_COLLECT_DATA_LONGEST_OP_MS with
a more fine-grained data collection via a keyed histogram so that we can
determine which type of data collection we spend a lot of time on.
Additionally, it abandons sending telemetry data from the content to the parent
via custom messages and instead uses the Telemetry service directly. Thus it
also gets rid of a bug that currently overrides measurements for the same
histogram done quickly in succession
This patch replaces FX_SESSION_RESTORE_CONTENT_COLLECT_DATA_LONGEST_OP_MS with
a more fine-grained data collection via a keyed histogram so that we can
determine which type of data collection we spend a lot of time on.
Additionally, it abandons sending telemetry data from the content to the parent
via custom messages and instead uses the Telemetry service directly. Thus it
also gets rid of a bug that currently overrides measurements for the same
histogram done quickly in succession.
Bug 588482 made it possible to restore pinned tabs in windows before restoring the rest of the
tabs. Part of this involves extracting the pinned tab data from the last session, and make it
the default state to restore. The rest can be restored later.
If one of the pinned tabs in a window were selected, the code that was preparing the default
state for that window set the selection value by calculating the length of the tabs array
(before adding the selected one), and adding 2. Presumably, 1 count is because of the tab
we're about to add, and another count is due to how the "selected" value in SessionStore
is 1-indexed (where "0" means, "don't change the selection").
This is an off-by-one error though, since the tabs array length already cancels out the
need for the extra "1-index" difference. It is sufficient to just add 1 to the length of
the tabs array to calculate the selected value.
This appears to have been a bug for a while, but was covered up by the fact that the old
tab selection code exited early if the 0-indexed value of the selected tab was not within
the length of the tabs array. Bug 1351677 uncovered this bug by removing that second check.
This patch fixes the off-by-one error, and also puts a check back in to ensure that the tab
we're going to select is at a valid index.
MozReview-Commit-ID: 9WbbU0vUJHG
--HG--
extra : rebase_source : cd5f4432c23084b672a844da40879bf53e393596
FX_SESSION_RESTORE_COLLECT_DATA_LONGEST_OP_MS can go because that's exactly the same as FX_SESSION_RESTORE_COLLECT_DATA_MS now.
We can remove FX_SESSION_RESTORE_COLLECT_COOKIES_MS because that's just a flat line since bug 912717 landed.
Opening pages in a new tab might suffer an extra delay from e10s-multi because
the new process has to start up and then run all the process / frame scripts
before it can react on the request from the parent to load the first page.
There are two code paths. Either we start the tab with a remote browser and
then the RemoteWebNavigation will send the request. Or we start with a non-remote
browser and have to change the remoteness flag on it, and then the SessionStore
will send the request.
In each cases we start the timer on the parent side, send it with the message,
and when the child receives it it stops the timer and reports the measured delay.
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.
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
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.