Bug 27318

Summary: Allow LocalStorage to be enabled without enabling SessionStorage
Product: WebKit Reporter: Jeremy Orlow <jorlow>
Component: New BugsAssignee: Jeremy Orlow <jorlow>
Status: RESOLVED FIXED    
Severity: Normal CC: abarth
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
Attachments:
Description Flags
v1
fishd: review-
v2
abarth: review-
v3 abarth: review+

Jeremy Orlow
Reported 2009-07-15 14:45:35 PDT
Allow LocalStorage to be enabled without enabling SessionStorage at runtime. There is a settings class setting for localStorage, but not for sessionStorage. We want to be able to test one of these features without necessarily enabling the other. I think the solution is to add a sessionStorageEnabled flag that defaults to true. Chromium can then opt-out.
Attachments
v1 (3.52 KB, patch)
2009-07-15 14:55 PDT, Jeremy Orlow
fishd: review-
v2 (4.19 KB, patch)
2009-07-16 15:33 PDT, Jeremy Orlow
abarth: review-
v3 (4.50 KB, patch)
2009-07-16 17:17 PDT, Jeremy Orlow
abarth: review+
Jeremy Orlow
Comment 1 2009-07-15 14:55:42 PDT
Created attachment 32815 [details] v1 Allow LocalStorage to be enabled without enabling SessionStorage at runtime. There is a settings class setting for localStorage, but not for sessionStorage. We want to be able to test one of these features without necessarily enabling the other.
Darin Fisher (:fishd, Google)
Comment 2 2009-07-15 22:00:51 PDT
Comment on attachment 32815 [details] v1 > Index: WebCore/page/DOMWindow.cpp > =================================================================== > --- WebCore/page/DOMWindow.cpp (revision 45916) > +++ WebCore/page/DOMWindow.cpp (working copy) > @@ -552,6 +552,9 @@ Storage* DOMWindow::sessionStorage() con > return 0; > > Document* document = m_frame->document(); > + Settings* settings = document->settings(); > + if (!settings || !settings->sessionStorageEnabled()) You should just use page->settings() here which cannot be null. Otherwise, looks good to me.
Jeremy Orlow
Comment 3 2009-07-16 15:33:31 PDT
Created attachment 32897 [details] v2 Cleaned up the way we access the settings per Darin F.
Adam Barth
Comment 4 2009-07-16 17:02:38 PDT
Comment on attachment 32897 [details] v2 Looks good, but two nits: > - Document* document = m_frame->document(); > + Settings* settings = page->settings(); > + if (!settings->sessionStorageEnabled()) > + return 0; If settings isn't used by the rest of this function, then you don't need to make a variable for it. > , m_localStorageEnabled(false) > + , m_sessionStorageEnabled(true) Why do these have different defaults?
Jeremy Orlow
Comment 5 2009-07-16 17:09:38 PDT
(In reply to comment #4) > (From update of attachment 32897 [details]) > Looks good, but two nits: > > > - Document* document = m_frame->document(); > > + Settings* settings = page->settings(); > > + if (!settings->sessionStorageEnabled()) > > + return 0; > > If settings isn't used by the rest of this function, then you don't need to > make a variable for it. I'll change it. > > , m_localStorageEnabled(false) > > + , m_sessionStorageEnabled(true) > > Why do these have different defaults? LocalStorage is off by default for security reasons since it allows you to write information to the disk. It makes sense for it to require an explicit opt-in. SessionStorage has always been on in the past, so it seems wrong to change its default. In addition, I don't think it's controversial at all in terms of security. The only reason we want to turn it off in Chromium is because it's currently broken and LocalStorage is a higher priority for us.
Jeremy Orlow
Comment 6 2009-07-16 17:17:31 PDT
Created attachment 32905 [details] v3 We now do page->settings()-> rather than saving page->settings() to a local variable. I also updated the change log to explain why SessionStorage is on by default.
Adam Barth
Comment 7 2009-07-16 17:20:10 PDT
Comment on attachment 32905 [details] v3 Looks great. Thanks for the explanation.
Adam Barth
Comment 8 2009-07-16 17:42:47 PDT
Committing to http://svn.webkit.org/repository/webkit/trunk ... M WebCore/ChangeLog M WebCore/page/DOMWindow.cpp M WebCore/page/Settings.cpp M WebCore/page/Settings.h Committed r46001
Note You need to log in before you can comment on or make changes to this bug.