Bug 65611 - Add firstPartyOrigin parameter to WebStorageNamespace::createStorageArea
Summary: Add firstPartyOrigin parameter to WebStorageNamespace::createStorageArea
Status: RESOLVED INVALID
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit Misc. (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified All
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-08-03 05:26 PDT by Marja Hölttä
Modified: 2011-08-23 00:27 PDT (History)
5 users (show)

See Also:


Attachments
Proposed patch for the first round of WebKit modifications (8.99 KB, patch)
2011-08-03 05:37 PDT, Marja Hölttä
no flags Details | Formatted Diff | Diff
Proposed patch for the first round of WebKit modifications (8.98 KB, patch)
2011-08-03 06:01 PDT, Marja Hölttä
no flags Details | Formatted Diff | Diff
Patch (11.46 KB, patch)
2011-08-03 06:57 PDT, Marja Hölttä
no flags Details | Formatted Diff | Diff
Patch (11.56 KB, patch)
2011-08-03 07:08 PDT, Marja Hölttä
no flags Details | Formatted Diff | Diff
Patch (11.49 KB, patch)
2011-08-04 01:11 PDT, Marja Hölttä
no flags Details | Formatted Diff | Diff
Patch (11.49 KB, patch)
2011-08-04 01:12 PDT, Marja Hölttä
no flags Details | Formatted Diff | Diff
Patch. (12.03 KB, patch)
2011-08-05 09:49 PDT, Marja Hölttä
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Marja Hölttä 2011-08-03 05:26:28 PDT
In Chrome, we'd like to grant scripts the right to use permanent or session-only localStorage based on their origin and the first-party origin of the page.

For this, we'd need to modify the signature of WebStorageNamespace::createStorageArea():

Now:
virtual WebStorageArea* createStorageArea(const WebString& origin) = 0;

We'd like to have:
virtual WebStorageArea* createStorageArea(const WebString& origin, const WebString& firstPartyOrigin) = 0;

I'd like to carry out the modifications in the following order:

1) Modifications in WebKit
- Add the two-parameter version of WebStorageNamespace::createStorageArea, provide an implementation (in WebStoragenamespaceImpl.cpp) which just delegates to the one-parameter version.
- Provide an implementation to the one-parameter version of WebStorageNamespace::createStorageArea which just delegates to the two-parameter version. This way it's enough if a subclass implements either the one-parameter version or the two-parameter version.
- Add the second parameter to StorageNamespace::storageArea(), StorageNamespaceImpl::storageArea(), StorageNamespaceProxy::storageArea() and WebStorageNamespaceImpl::createStorageArea().
- Modify DOMWindow to use the two-parameter version of storageArea().

2) Modifications in Chromium
- Modify the RendererWebStorageNamespaceImpl (inherits WebStorageNamespace) to overwrite the two-parameter version of createStorageArea instead of the one-parameter version.

3) Modifications in WebKit
- Remove the one-parameter version of WebStorageNamespace::createStorageArea, make the two-parameter version pure virtual and remove the implementation.
Comment 1 Marja Hölttä 2011-08-03 05:37:55 PDT
Created attachment 102770 [details]
Proposed patch for the first round of WebKit modifications
Comment 2 Marja Hölttä 2011-08-03 06:01:12 PDT
Created attachment 102773 [details]
Proposed patch for the first round of WebKit modifications
Comment 3 Marja Hölttä 2011-08-03 06:57:50 PDT
Created attachment 102779 [details]
Patch
Comment 4 WebKit Review Bot 2011-08-03 06:59:58 PDT
Attachment 102779 [details] did not pass style-queue:

Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'Source/WebCore/ChangeLog', u'Source/WebCor..." exit_code: 1

Source/WebKit/chromium/ChangeLog:1:  ChangeLog entry has no bug number  [changelog/bugnumber] [5]
Source/WebCore/ChangeLog:1:  ChangeLog entry has no bug number  [changelog/bugnumber] [5]
Total errors found: 2 in 11 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 5 Marja Hölttä 2011-08-03 07:08:47 PDT
Created attachment 102781 [details]
Patch
Comment 6 Darin Adler 2011-08-03 12:28:08 PDT
Comment on attachment 102781 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=102781&action=review

> Source/WebCore/storage/StorageNamespaceImpl.h:49
> -        virtual PassRefPtr<StorageArea> storageArea(PassRefPtr<SecurityOrigin>);
> +        virtual PassRefPtr<StorageArea> storageArea(PassRefPtr<SecurityOrigin> prpOrigin, PassRefPtr<SecurityOrigin> prpFirstPartyOrigin);

The names here should not have a prp prefix.
Comment 7 jochen 2011-08-03 12:31:56 PDT
Comment on attachment 102781 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=102781&action=review

As the patch touches WebKit/chromium, you'll need to add fishd@chromium.org as reviewer

> Source/WebCore/ChangeLog:6
> +        Reviewed by NOBODY (OOPS!).

this line should come first in the changelog entry

> Source/WebKit/chromium/ChangeLog:6
> +        Reviewed by NOBODY (OOPS!).

same here
Comment 8 Marja Hölttä 2011-08-04 01:11:39 PDT
Created attachment 102880 [details]
Patch
Comment 9 Marja Hölttä 2011-08-04 01:12:57 PDT
Created attachment 102881 [details]
Patch
Comment 10 Marja Hölttä 2011-08-04 01:21:21 PDT
Darin Fischer: could you review this patch, please? It modifies WebKit/chromium.
Comment 11 Darin Fisher (:fishd, Google) 2011-08-04 10:37:24 PDT
Comment on attachment 102881 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=102881&action=review

> Source/WebKit/chromium/public/WebStorageNamespace.h:71
> +    virtual WebStorageArea* createStorageArea(const WebString& origin, const WebString& firstPartyOrigin);

i think it would make sense to switch over to passing WebSecurityOrigin instead of WebString.
it is often better to expose WebSecurityOrigin instead of raw strings.  when createStorageArea
was first created, we probably didn't yet have WebSecurityOrigin or the discipline to pass it
around instead of raw strings.
Comment 12 Marja Hölttä 2011-08-05 09:49:44 PDT
Created attachment 103080 [details]
Patch.
Comment 13 Marja Hölttä 2011-08-23 00:27:11 PDT
It turned out this is not needed, after all. Resolving as invalid.