WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED INVALID
88412
StorageAreaProxy::canAccessStorage should cache the permissions.
https://bugs.webkit.org/show_bug.cgi?id=88412
Summary
StorageAreaProxy::canAccessStorage should cache the permissions.
Marja Hölttä
Reported
2012-06-06 06:56:00 PDT
StorageAreaProxy::canAccessStorage should cache the permissions.
Attachments
Patch
(2.68 KB, patch)
2012-06-06 07:00 PDT
,
Marja Hölttä
no flags
Details
Formatted Diff
Diff
Patch
(4.37 KB, patch)
2012-06-06 07:54 PDT
,
Marja Hölttä
no flags
Details
Formatted Diff
Diff
tlc
(5.47 KB, patch)
2012-06-14 18:37 PDT
,
Michael Nordman
no flags
Details
Formatted Diff
Diff
tlc
(6.51 KB, patch)
2012-06-14 18:40 PDT
,
Michael Nordman
no flags
Details
Formatted Diff
Diff
tlc
(6.51 KB, patch)
2012-06-15 14:32 PDT
,
Michael Nordman
no flags
Details
Formatted Diff
Diff
tlc
(6.53 KB, patch)
2012-06-21 19:39 PDT
,
Michael Nordman
no flags
Details
Formatted Diff
Diff
Show Obsolete
(5)
View All
Add attachment
proposed patch, testcase, etc.
Marja Hölttä
Comment 1
2012-06-06 07:00:08 PDT
Created
attachment 146015
[details]
Patch
jochen
Comment 2
2012-06-06 07:14:39 PDT
Comment on
attachment 146015
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=146015&action=review
> Source/WebKit/chromium/ChangeLog:3 > + StorageAreaProxy::canAccessStorage should cache the permissions.
prefix with [chromium] please
> Source/WebKit/chromium/src/StorageAreaProxy.h:31 > +#include <map>
don't use stl map but <wtf/HashMap.h>
> Source/WebKit/chromium/src/StorageAreaProxy.h:78 > + mutable std::map<Frame*, bool> m_canAccessStorageCache;
I wonder whether we should instead add a boolean to WebFrameImpl canAccessStorage
Marja Hölttä
Comment 3
2012-06-06 07:54:22 PDT
Created
attachment 146032
[details]
Patch
Marja Hölttä
Comment 4
2012-06-06 07:55:35 PDT
Comment on
attachment 146015
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=146015&action=review
>> Source/WebKit/chromium/ChangeLog:3 >> + StorageAreaProxy::canAccessStorage should cache the permissions. > > prefix with [chromium] please
Done
>> Source/WebKit/chromium/src/StorageAreaProxy.h:31 >> +#include <map> > > don't use stl map but <wtf/HashMap.h>
Removed this
>> Source/WebKit/chromium/src/StorageAreaProxy.h:78 >> + mutable std::map<Frame*, bool> m_canAccessStorageCache; > > I wonder whether we should instead add a boolean to WebFrameImpl canAccessStorage
Added.
jochen
Comment 5
2012-06-06 08:06:52 PDT
this patch looks good to me, thx
Michael Nordman
Comment 6
2012-06-06 10:57:23 PDT
Comment on
attachment 146032
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=146032&action=review
> Source/WebKit/chromium/src/WebFrameImpl.cpp:1408 > + m_canAccessStorage = !permissionClient || permissionClient->allowStorage(this, localStorage);
is the answer ever different for local vs session storage?
jochen
Comment 7
2012-06-06 11:01:51 PDT
Comment on
attachment 146032
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=146032&action=review
>> Source/WebKit/chromium/src/WebFrameImpl.cpp:1408 >> + m_canAccessStorage = !permissionClient || permissionClient->allowStorage(this, localStorage); > > is the answer ever different for local vs session storage?
hum, no, but we show different notifications. Also, it's an implementation detail outside of webkit, so we should probably cache both results
jochen
Comment 8
2012-06-06 11:01:54 PDT
Comment on
attachment 146032
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=146032&action=review
>> Source/WebKit/chromium/src/WebFrameImpl.cpp:1408 >> + m_canAccessStorage = !permissionClient || permissionClient->allowStorage(this, localStorage); > > is the answer ever different for local vs session storage?
hum, no, but we show different notifications. Also, it's an implementation detail outside of webkit, so we should probably cache both results
Marja Hölttä
Comment 9
2012-06-06 13:22:25 PDT
Comment on
attachment 146032
[details]
Patch Ahh, this was wrong, I'll fix the patch.
Michael Nordman
Comment 10
2012-06-07 10:16:27 PDT
Comment on
attachment 146032
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=146032&action=review
>>>> Source/WebKit/chromium/src/WebFrameImpl.cpp:1408 >>>> + m_canAccessStorage = !permissionClient || permissionClient->allowStorage(this, localStorage); >>> >>> is the answer ever different for local vs session storage? >> >> hum, no, but we show different notifications. Also, it's an implementation detail outside of webkit, so we should probably cache both results > > hum, no, but we show different notifications. Also, it's an implementation detail outside of webkit, so we should probably cache both results
hold on, if this setting can be different per-origin, webframeimpl is probably not a good place to cache this value since the frame can navigate from document to document in different origins. the storageareaproxy class is probably the best place for this cached value. instances of that class are per-document. while the methods of that class take a Frame* as input, in practice, the Frame* param value presented to a StorageAreaProxy instance will be the same value on each call. maybe something like this... class StorageAreaProxy { bool canAccess(frame) { if (frame != m_cachedCanAccessSettingForFrame) { m_cachedCanAccessSetting = get value out of frame and such; m_cachedCanAccessSettingForFrame = frame; } return m_cachedCanAccessSetting; } void* m_cachedCanAccessSettingForFrame; // the frame ptr for which we've cached the value (null if not cached) bool m_cachedCanAccessSetting; }; Also, if there's no use case for having the setting be different for local vs session, maybe we should alter the webkit api to remove that param from the permissionClient->allowStorage() method (eventually), and in this patch just pass a hard coded value of 'true' and take it as a TODO or FIXME to clean up that api.
jochen
Comment 11
2012-06-07 11:15:56 PDT
(In reply to
comment #10
)
> (From update of
attachment 146032
[details]
) > View in context:
https://bugs.webkit.org/attachment.cgi?id=146032&action=review
> > >>>> Source/WebKit/chromium/src/WebFrameImpl.cpp:1408 > >>>> + m_canAccessStorage = !permissionClient || permissionClient->allowStorage(this, localStorage); > >>> > >>> is the answer ever different for local vs session storage? > >> > >> hum, no, but we show different notifications. Also, it's an implementation detail outside of webkit, so we should probably cache both results > > > > hum, no, but we show different notifications. Also, it's an implementation detail outside of webkit, so we should probably cache both results > > hold on, if this setting can be different per-origin, webframeimpl is probably not a good place to cache this value since the frame can navigate from document to document in different origins. the storageareaproxy class is probably the best place for this cached value. instances of that class are per-document. while the methods of that class take a Frame* as input, in practice, the Frame* param value presented to a StorageAreaProxy instance will be the same value on each call. maybe something like this...
What if a page has multiple frames from the same origin, all using local storage?
> > class StorageAreaProxy { > > bool canAccess(frame) { > if (frame != m_cachedCanAccessSettingForFrame) { > m_cachedCanAccessSetting = get value out of frame and such; > m_cachedCanAccessSettingForFrame = frame; > } > return m_cachedCanAccessSetting; > } > > void* m_cachedCanAccessSettingForFrame; // the frame ptr for which we've cached the value (null if not cached) > bool m_cachedCanAccessSetting; > }; > > Also, if there's no use case for having the setting be different for local vs session, maybe we should alter the webkit api to remove that param from the permissionClient->allowStorage() method (eventually), and in this patch just pass a hard coded value of 'true' and take it as a TODO or FIXME to clean up that api.
The use case is displaying different UI based on whether it's sessionStorage or localStorage
Michael Nordman
Comment 12
2012-06-07 11:51:09 PDT
> > hold on, if this setting can be different per-origin, webframeimpl is probably not a good place to cache this value since the frame can navigate from document to document in different origins. the storageareaproxy class is probably the best place for this cached value. instances of that class are per-document. while the methods of that class take a Frame* as input, in practice, the Frame* param value presented to a StorageAreaProxy instance will be the same value on each call. maybe something like this... > > What if a page has multiple frames from the same origin, all using local storage?
Each document has a distinct StorageAreaProxy, actually potentially two of them, one for session storage and another for local storage.
> > > > class StorageAreaProxy { > > > > bool canAccess(frame) { > > if (frame != m_cachedCanAccessSettingForFrame) { > > m_cachedCanAccessSetting = get value out of frame and such; > > m_cachedCanAccessSettingForFrame = frame; > > } > > return m_cachedCanAccessSetting; > > } > > > > void* m_cachedCanAccessSettingForFrame; // the frame ptr for which we've cached the value (null if not cached) > > bool m_cachedCanAccessSetting; > > }; > > > > Also, if there's no use case for having the setting be different for local vs session, maybe we should alter the webkit api to remove that param from the permissionClient->allowStorage() method (eventually), and in this patch just pass a hard coded value of 'true' and take it as a TODO or FIXME to clean up that api. > > The use case is displaying different UI based on whether it's sessionStorage or localStorage
Ok, so we keep the param then.
Michael Nordman
Comment 13
2012-06-11 17:45:55 PDT
(In reply to
comment #12
)
> > > class StorageAreaProxy { > > > > > > bool canAccess(frame) { > > > if (frame != m_cachedCanAccessSettingForFrame) { > > > m_cachedCanAccessSetting = get value out of frame and such; > > > m_cachedCanAccessSettingForFrame = frame; > > > } > > > return m_cachedCanAccessSetting; > > > } > > > > > > void* m_cachedCanAccessSettingForFrame; // the frame ptr for which we've cached the value (null if not cached) > > > bool m_cachedCanAccessSetting; > > > };
If you like, I can work this into another small performance related change to this class thats in the works...
https://chromiumcodereview.appspot.com/10539097/
Michael Nordman
Comment 14
2012-06-14 18:37:17 PDT
Created
attachment 147699
[details]
tlc
Michael Nordman
Comment 15
2012-06-14 18:40:47 PDT
Created
attachment 147701
[details]
tlc added missing platform/ChangeLog diffs to the patch
Michael Nordman
Comment 16
2012-06-15 14:32:12 PDT
Created
attachment 147899
[details]
tlc not sure why the patch didn't apply, reupping to run it by the ews bots again
Michael Nordman
Comment 17
2012-06-15 17:21:24 PDT
> not sure why the patch didn't apply, reupping to run it by the ews bots again
i think that may have to do with line endings fyi, the chrome-side can be seen here,
https://chromiumcodereview.appspot.com/10533093/
Michael Nordman
Comment 18
2012-06-21 19:39:27 PDT
Created
attachment 148945
[details]
tlc
WebKit Review Bot
Comment 19
2012-06-21 19:41:19 PDT
Please wait for approval from
abarth@webkit.org
,
dglazkov@chromium.org
,
fishd@chromium.org
,
jamesr@chromium.org
or
tkent@chromium.org
before submitting, as this patch contains changes to the Chromium public API. See also
https://trac.webkit.org/wiki/ChromiumWebKitAPI
.
Adam Barth
Comment 20
2012-06-22 10:42:25 PDT
Comment on
attachment 148945
[details]
tlc API change LGTM
Michael Nordman
Comment 21
2012-06-22 11:55:00 PDT
(In reply to
comment #20
)
> (From update of
attachment 148945
[details]
) > API change LGTM
jochen, can you take a look at the .cpp parts of this?
jochen
Comment 22
2012-06-25 08:31:13 PDT
(In reply to
comment #21
)
> (In reply to
comment #20
) > > (From update of
attachment 148945
[details]
[details]) > > API change LGTM > > jochen, can you take a look at the .cpp parts of this?
I'm surprised this doesn't break LayoutTests/platform/chromium/permissionclient/storage-permission.html ?
Michael Nordman
Comment 23
2012-06-25 10:04:59 PDT
> I'm surprised this doesn't break LayoutTests/platform/chromium/permissionclient/storage-permission.html ?
It sure should break that test! Probably 'passing' because of this test expectation... BUGCR85292 : platform/chromium/permissionclient/storage-permission.html = PASS TEXT
jochen
Comment 24
2012-06-25 11:02:13 PDT
(In reply to
comment #23
)
> > I'm surprised this doesn't break LayoutTests/platform/chromium/permissionclient/storage-permission.html ? > > It sure should break that test! Probably 'passing' because of this test expectation... > > BUGCR85292 : platform/chromium/permissionclient/storage-permission.html = PASS TEXT
ouch Anyway, the question is, should the cache be invalidated by the embedder? Alternatively, we could update the test to always block storage.
Michael Nordman
Comment 25
2012-06-25 12:55:29 PDT
(In reply to
comment #24
)
> (In reply to
comment #23
) > > > I'm surprised this doesn't break LayoutTests/platform/chromium/permissionclient/storage-permission.html ? > > > > It sure should break that test! Probably 'passing' because of this test expectation... > > > > BUGCR85292 : platform/chromium/permissionclient/storage-permission.html = PASS TEXT > > ouch > > Anyway, the question is, should the cache be invalidated by the embedder? Alternatively, we could update the test to always block storage.
I'll poke at the test to setup to block access prior to checking and have that test just check the blocked condition.
jochen
Comment 26
2012-07-15 12:27:29 PDT
I've unskipped the test meanwhile. Can you update the test so it still works with this patch in?
Levi Weintraub
Comment 27
2013-04-08 10:55:01 PDT
Comment on
attachment 148945
[details]
tlc Clearing flags.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug