Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(41)

Issue 10850010: Make session restore understand that tabs have multiple SessionStorageNamespaces. (Closed)

Created:
8 years, 4 months ago by awong
Modified:
7 years, 5 months ago
CC:
chromium-reviews, marja+watch_chromium.org, nasko
Visibility:
Public.

Description

Make session restore understand that tabs have multiple SessionStorageNamespaces. Also teaches session restore to just skip malfomed session storage association commands. It seems overkill to quit the whole restore just because of one bad namespace. In session restore, we associated write out the full association of (tab, session storage persistent id, partition_id). On restore, before reconstituting the session storage, we parse the partition_id and check that it still exists skipping the serialized session storage if it has been destroyed during session restore. BUG=85121

Patch Set 1 : Fix link error. #

Patch Set 2 : Add U-pipe through all the layers to put IsValidStorageParitionId() near where partition ids are cr… #

Patch Set 3 : Unittest using jam's new PRE_ method #

Total comments: 13

Patch Set 4 : Rebased, with test robustified. #

Total comments: 1

Patch Set 5 : rebased #

Patch Set 6 : merged with ToT #

Patch Set 7 : attempt to fix unittsets. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+239 lines, -115 lines) Patch
M chrome/browser/extensions/isolated_app_browsertest.cc View 1 2 3 4 5 6 4 chunks +69 lines, -0 lines 0 comments Download
M chrome/browser/sessions/session_restore.cc View 1 2 3 4 5 7 chunks +29 lines, -13 lines 0 comments Download
M chrome/browser/sessions/session_restore_browsertest.cc View 1 2 3 4 5 1 chunk +26 lines, -12 lines 0 comments Download
M chrome/browser/sessions/session_service.h View 1 2 3 4 5 1 chunk +2 lines, -1 line 0 comments Download
M chrome/browser/sessions/session_service.cc View 1 2 3 4 5 6 5 chunks +47 lines, -26 lines 0 comments Download
M chrome/browser/sessions/session_types.h View 1 2 3 4 2 chunks +3 lines, -2 lines 0 comments Download
M chrome/browser/sessions/tab_restore_service.h View 1 2 3 4 5 2 chunks +3 lines, -2 lines 0 comments Download
M chrome/browser/sessions/tab_restore_service.cc View 1 2 3 4 5 4 chunks +5 lines, -5 lines 0 comments Download
M chrome/browser/sessions/tab_restore_service_delegate.h View 1 2 3 4 5 2 chunks +3 lines, -4 lines 0 comments Download
M chrome/browser/ui/browser_tab_restore_service_delegate.h View 1 2 3 4 5 1 chunk +2 lines, -2 lines 0 comments Download
M chrome/browser/ui/browser_tab_restore_service_delegate.cc View 1 2 3 4 5 3 chunks +5 lines, -5 lines 0 comments Download
M chrome/browser/ui/browser_tabrestore.h View 1 2 3 4 5 3 chunks +3 lines, -3 lines 0 comments Download
M chrome/browser/ui/browser_tabrestore.cc View 1 2 3 4 5 2 chunks +4 lines, -18 lines 0 comments Download
M chrome/test/base/in_process_browser_test.h View 1 2 3 4 5 6 1 chunk +1 line, -0 lines 0 comments Download
M content/browser/browser_context.cc View 1 2 3 4 5 6 4 chunks +29 lines, -20 lines 0 comments Download
M content/browser/storage_partition_impl.cc View 1 2 3 4 5 6 1 chunk +1 line, -0 lines 0 comments Download
M content/public/browser/browser_context.h View 1 2 3 4 5 1 chunk +7 lines, -2 lines 0 comments Download

Messages

Total messages: 23 (0 generated)
awong
Scott, could you look at the session restore changes? Charlie, could you look at the ...
8 years, 4 months ago (2012-08-03 01:29:03 UTC) #1
sky
I sent you some comments in your other review. Is this ready for review now? ...
8 years, 4 months ago (2012-08-03 16:55:05 UTC) #2
awong
Hi Scott, Yes, I think this is ready for review now. One major problem though...I ...
8 years, 4 months ago (2012-08-04 01:32:11 UTC) #3
marja
https://chromiumcodereview.appspot.com/10850010/diff/6004/chrome/browser/sessions/session_service.cc File chrome/browser/sessions/session_service.cc (right): https://chromiumcodereview.appspot.com/10850010/diff/6004/chrome/browser/sessions/session_service.cc#newcode1287 chrome/browser/sessions/session_service.cc:1287: continue; // If the storage is corrupt, just ignore ...
8 years, 4 months ago (2012-08-06 14:38:34 UTC) #4
sky
On 2012/08/04 01:32:11, awong wrote: > Hi Scott, > > Yes, I think this is ...
8 years, 4 months ago (2012-08-06 14:41:18 UTC) #5
sky
I only looked at the chrome side of things, which LGTM https://chromiumcodereview.appspot.com/10850010/diff/6004/chrome/browser/ui/browser_tab_restore_service_delegate.h File chrome/browser/ui/browser_tab_restore_service_delegate.h (right): ...
8 years, 4 months ago (2012-08-06 14:44:08 UTC) #6
marja
https://chromiumcodereview.appspot.com/10850010/diff/6004/chrome/browser/sessions/session_service.cc File chrome/browser/sessions/session_service.cc (right): https://chromiumcodereview.appspot.com/10850010/diff/6004/chrome/browser/sessions/session_service.cc#newcode1287 chrome/browser/sessions/session_service.cc:1287: continue; // If the storage is corrupt, just ignore ...
8 years, 4 months ago (2012-08-06 14:53:21 UTC) #7
Charlie Reis
The current IsValidStoragePartitonId LGTM, and I agree with moving it to StoragePartition later. https://chromiumcodereview.appspot.com/10850010/diff/6004/chrome/browser/prefs/pref_service_browsertest.cc File ...
8 years, 4 months ago (2012-08-06 23:28:11 UTC) #8
awong
Comments addressed. Disabled the actual deep check for session restore for now since Marja's change ...
8 years, 4 months ago (2012-08-07 00:38:48 UTC) #9
michaeln
https://chromiumcodereview.appspot.com/10850010/diff/6006/chrome/browser/sessions/session_service.cc File chrome/browser/sessions/session_service.cc (right): https://chromiumcodereview.appspot.com/10850010/diff/6006/chrome/browser/sessions/session_service.cc#newcode609 chrome/browser/sessions/session_service.cc:609: tab->web_contents()->GetController().GetSessionStorageNamespaceMap(); Looks like namespaces for isolated-apps can be added ...
8 years, 4 months ago (2012-08-08 22:29:30 UTC) #10
awong
On 2012/08/08 22:29:30, michaeln wrote: > https://chromiumcodereview.appspot.com/10850010/diff/6006/chrome/browser/sessions/session_service.cc > File chrome/browser/sessions/session_service.cc (right): > > https://chromiumcodereview.appspot.com/10850010/diff/6006/chrome/browser/sessions/session_service.cc#newcode609 > ...
8 years, 4 months ago (2012-08-22 22:35:51 UTC) #11
michaeln
> I think I finally understand your comment Michael. If you patch in my latest ...
8 years, 3 months ago (2012-08-27 18:36:41 UTC) #12
awong
Reviving this CL. Marja, Sky, I'm going to need some guidance here. Initially I thought ...
8 years, 3 months ago (2012-09-11 21:23:43 UTC) #13
sky
I haven't been following session storage enough to offer guidance. You'll have to explain it ...
8 years, 3 months ago (2012-09-11 23:05:36 UTC) #14
awong
The redux is this: SessionStorage is a per-tab concept. Each tab has a set of ...
8 years, 3 months ago (2012-09-11 23:27:15 UTC) #15
awong
ping... Marja, Scott, any thoughts? We've only got a few days left before m23, and ...
8 years, 3 months ago (2012-09-12 23:39:01 UTC) #16
sky
Sorry, I've been samped too. Thanks for the explanation, that clarifies things. If the ssn ...
8 years, 3 months ago (2012-09-13 00:34:50 UTC) #17
marja(google)
Hi, sorry for late reply, and thanks for describing the isolated page thing, it's a ...
8 years, 3 months ago (2012-09-13 07:25:00 UTC) #18
awong
I could create a new notification I guess, but that feels heavy weight. What about ...
8 years, 3 months ago (2012-09-13 07:39:17 UTC) #19
marja(google)
Yeah, using CreateUpdateTabNavigationCommand would work, too. It's quite redundant to have the SSN in every ...
8 years, 3 months ago (2012-09-13 07:49:07 UTC) #20
sky
I'm assuming the SSN is smallish. Is that not the case? -Scott On Thu, Sep ...
8 years, 3 months ago (2012-09-13 16:03:43 UTC) #21
awong
The SSN's persistent ID, which is what would be written to disk is a GUID. ...
8 years, 3 months ago (2012-09-14 00:31:08 UTC) #22
sky
8 years, 3 months ago (2012-09-14 02:15:00 UTC) #23
Adding to UpdateTabNavigationCommand is fine by me. If you have time
to change for 23, go for it.

  -Scott

On Thu, Sep 13, 2012 at 5:30 PM, Albert J. Wong (王重傑)
<ajwong@chromium.org> wrote:
> The SSN's persistent ID, which is what would be written to disk is a GUID.
> So it's a 128-bits of hex with 4 dash...36 chars I think?
>
> Is that's small enough to be added to UpdateTabNavigationCommand?
>
> If it is, do we care enough about this to try rush a patch in that would
> switch from SessionStorageAssociateCommand to UpdateTabNavigationCommand in
> m23?
>
> -Albert
>
>
> On Thu, Sep 13, 2012 at 9:03 AM, Scott Violet <sky@chromium.org> wrote:
>>
>> I'm assuming the SSN is smallish. Is that not the case?
>>
>>   -Scott
>>
>> On Thu, Sep 13, 2012 at 12:38 AM, Albert J. Wong (王重傑)
>> <ajwong@chromium.org> wrote:
>> > I could create a new notification I guess, but that feels heavy weight.
>> >
>> > What about Scott's idea about adding the SSN mapping into the
>> > CreateUpdateTabNavigationCommand?  On restore, we'd need to collapse all
>> > of
>> > them to find the right set of SSN persistent IDs, but maybe that's not
>> > too
>> > bad?  In terms of session restore log size growth, we'd add one extra
>> > copy
>> > of the persistent ID per UpdateTabNavigationCommand. In this
>> > configuration,
>> > the SessionStorageAssociateCommand would no longer be needed.
>> >
>> > Thoughts?
>> >
>> > -Albert
>> >
>> > On Thu, Sep 13, 2012 at 12:24 AM, Marja Hölttä <marja@google.com> wrote:
>> >>
>> >> Hi, sorry for late reply, and thanks for describing the isolated page
>> >> thing, it's a lot clearer now.
>> >>
>> >> I don't know the answer to the problem though.
>> >>
>> >> Is there a way for you to notice when a tab gets a new SSN? Maybe send
>> >> a notification when that happens?
>> >>
>> >> Marja
>> >>
>> >> On 13 September 2012 01:38, Albert J. Wong (王重傑) <ajwong@chromium.org>
>> >> wrote:
>> >> > ping...
>> >> >
>> >> > Marja, Scott, any thoughts?  We've only got a few days left before
>> >> > m23,
>> >> > and
>> >> > if there's a chance I can preemptively fix the formatting of the
>> >> > Storage
>> >> > Associate command by adding another field like I did below, I'd love
>> >> > to
>> >> > do
>> >> > that now.
>> >> >
>> >> > However, I don't have confidence that such a change would fix the
>> >> > issue
>> >> > described in my last e-mail.
>> >> >
>> >> > -Albert
>> >> >
>> >> >
>> >> > On Tue, Sep 11, 2012 at 4:26 PM, Albert J. Wong (王重傑)
>> >> > <ajwong@chromium.org>
>> >> > wrote:
>> >> >>
>> >> >> The redux is this:
>> >> >>
>> >> >> SessionStorage is a per-tab concept.  Each tab has a set of
>> >> >> "SessionStorageNamespace" (SSN) objects.  These SSNs map an origin
>> >> >> to a
>> >> >> Dictionary of Key-value pairs.
>> >> >>
>> >> >> In the simplest case (no isolated sites), two navigation entries
>> >> >> whose
>> >> >> top-level frames are in the same origin will see the same dictionary
>> >> >> of
>> >> >> key-value pairs.  In the no isolation case, you could make the
>> >> >> assumption
>> >> >> that a single Tab has one SSN associated with it for the lifetime of
>> >> >> the
>> >> >> tab.  The currently committed code relies on constraint implicitly
>> >> >> by
>> >> >> logging the Tab -> SSN relation when it receives
>> >> >> NOTIFICATION_TAB_PARENTED.
>> >> >>
>> >> >> The Isolation Sites feature we are adding
>> >> >> (http://www.chromium.org/developers/design-documents/isolated-sites)
>> >> >> complicates matters because it allows us to specify that different
>> >> >> parts of
>> >> >> an origin should get a different set of persistent state.  For
>> >> >> example,
>> >> >> we
>> >> >> might want to specify that the following URL pattern should NOT be
>> >> >> able
>> >> >> to
>> >> >> share cookies, session storage, etc. with your normal web browsing.
>> >> >>
>> >> >>   http://www.chase.com/login/*  -- we define via an extensions that
>> >> >> this
>> >> >> goes to StoragePartition "A"
>> >> >>
>> >> >> In this setup an XSS vulnerability in, for example,
>> >> >> http://www.chase.com/help will be useless in attacking
>> >> >> http://www.chase.com/login.  For SessonStorage specifically, if
>> >> >> http://www.chase.com/login executed
>> >> >>
>> >> >>    window.sessionStorage.setItem("auth", "secret");
>> >> >>
>> >> >> and then http://www.chase.com/help tried to read it back using
>> >> >> window.sessionStorage.getItem("auth"), the getItem() call would
>> >> >> return
>> >> >> nothing because the two pages are being serviced by different
>> >> >> StoragePartitions.
>> >> >>
>> >> >> The implication here is that a tab can now have multiple
>> >> >> SessionStorageNamespaces. It will gain a new one every time it
>> >> >> navigates the
>> >> >> top-level frame to an isolated site.  Now NOTIFICATION_TAB_PARENTED
>> >> >> can
>> >> >> no
>> >> >> longer sufficiently know all the SSNs that a tab might eventually
>> >> >> have
>> >> >> and
>> >> >> on restore, any isolated sites would suddenly lose their storage.
>> >> >>
>> >> >> I'm not quite sure where's the best place to record the additional
>> >> >> tab
>> >> >> ->
>> >> >> SSN associations.  If we did it once per navigation entry commit, I
>> >> >> worry
>> >> >> that the commit log will become very noisy.  Also, we'd likely have
>> >> >> duplicate associations since, unless we adding extra accounting,
>> >> >> there's no
>> >> >> currently no way to know if a SSN has been written into the session
>> >> >> restore
>> >> >> log.
>> >> >>
>> >> >> Does that build a full enough picture?  If not, maybe we should chat
>> >> >> over
>> >> >> VC?
>> >> >>
>> >> >> -Albert
>> >> >>
>> >> >>
>> >> >> On Tue, Sep 11, 2012 at 4:05 PM, Scott Violet <sky@chromium.org>
>> >> >> wrote:
>> >> >>>
>> >> >>> I haven't been following session storage enough to offer guidance.
>> >> >>> You'll have to explain it in more detail for me to be able to offer
>> >> >>> any input.
>> >> >>>
>> >> >>>   -Scott
>> >> >>>
>> >> >>> On Tue, Sep 11, 2012 at 2:23 PM,  <ajwong@chromium.org> wrote:
>> >> >>> > Reviving this CL. Marja, Sky, I'm going to need some guidance
>> >> >>> > here.
>> >> >>> >
>> >> >>> > Initially I thought this would be a simple extension of the
>> >> >>> > current
>> >> >>> > SessionStorageAssociate command.  However, as Michael pointed
>> >> >>> > out,
>> >> >>> > doesn't
>> >> >>> > work
>> >> >>> > because new SSNs are created depending on what navigation entries
>> >> >>> > are
>> >> >>> > committed.
>> >> >>> >  NOTIFICATION_TAB_PARENTED is no longer sufficient for recording
>> >> >>> > all
>> >> >>> > the
>> >> >>> > associations.
>> >> >>> >
>> >> >>> > Do either of you know what the right notification is?
>> >> >>> >
>> >> >>> > -Albert
>> >> >>> >
>> >> >>> >
>> >> >>> > On 2012/08/27 18:36:41, michaeln wrote:
>> >> >>> >>
>> >> >>> >> > I think I finally understand your comment Michael.  If you
>> >> >>> >> > patch
>> >> >>> >> > in
>> >> >>> >> > my
>> >> >>> >
>> >> >>> > latest
>> >> >>> >>
>> >> >>> >> > CL, you'll see my log message only ever shows that we have 1
>> >> >>> >> > SSN
>> >> >>> >> > in
>> >> >>> >> > the
>> >> >>> >> > tab.
>> >> >>> >
>> >> >>> >
>> >> >>> >> > This is probably due to exactly what you said -- the new SSNs
>> >> >>> >> > are
>> >> >>> >> > never
>> >> >>> >> written
>> >> >>> >> > to the journal.
>> >> >>> >
>> >> >>> >
>> >> >>> >> Yup, not what you wanted probably.
>> >> >>> >
>> >> >>> >
>> >> >>> >> > What's the right solution here?  Should I add a new
>> >> >>> >> > notification
>> >> >>> >> > for
>> >> >>> >> > when a
>> >> >>> >> > session storage namespace is created?  That seems heavy
>> >> >>> >> > weight...
>> >> >>> >
>> >> >>> >
>> >> >>> >> I don't know much about the session save/restore system, but
>> >> >>> >> *something*
>> >> >>> >> is
>> >> >>> >> being logged per tab navigation so the url to load into that tab
>> >> >>> >> is
>> >> >>> >> known
>> >> >>> >> at
>> >> >>> >> restore time, and the history of urls in that tab is also known
>> >> >>> >> at
>> >> >>> >> restore
>> >> >>> >
>> >> >>> > time
>> >> >>> >>
>> >> >>> >> to support navigating back (and forward) after having restored.
>> >> >>> >> The
>> >> >>> >> new
>> >> >>> >> navigation entries are added incrementally (well i'm guessing,
>> >> >>> >> like
>> >> >>> >> i
>> >> >>> >> said
>> >> >>> >> i
>> >> >>> >> don't know much about that stuff). Maybe we could also
>> >> >>> >> incrementally
>> >> >>> >> add
>> >> >>> >> associations to isolated SSNs coincident with new navigation
>> >> >>> >> entries.
>> >> >>> >
>> >> >>> >
>> >> >>> >> Maybe each navigation entry should have a strong association
>> >> >>> >> with a
>> >> >>> >> particular
>> >> >>> >> 'storage partition'?
>> >> >>> >
>> >> >>> >
>> >> >>> >
>> >> >>> >
>> >> >>> > https://chromiumcodereview.appspot.com/10850010/
>> >> >>
>> >> >>
>> >> >
>> >
>> >
>
>

Powered by Google App Engine
This is Rietveld 408576698