Bug 75469 - Clear localStorage before making assumption about its contents
Summary: Clear localStorage before making assumption about its contents
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: jochen
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-01-03 05:32 PST by jochen
Modified: 2012-01-03 17:11 PST (History)
3 users (show)

See Also:


Attachments
Patch (1.25 KB, patch)
2012-01-03 05:34 PST, jochen
no flags Details | Formatted Diff | Diff
Patch (1.39 KB, patch)
2012-01-03 11:31 PST, jochen
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description jochen 2012-01-03 05:32:56 PST
Clear localStorage before making assumption about its contents
Comment 1 jochen 2012-01-03 05:34:12 PST
Created attachment 120937 [details]
Patch
Comment 2 jochen 2012-01-03 05:36:42 PST
This test fails flakily on our bots when there are already other entries in localStorage

Adam, can you please have a look?
Comment 3 Daniel Bates 2012-01-03 10:50:17 PST
Comment on attachment 120937 [details]
Patch

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

> LayoutTests/platform/chromium/permissionclient/storage-permission.html:21
> +    localStorage.clear();

Is this necessary? Can we reuse/simplify the logic in clearLocalStorage.js (*)? By line 3 of LayoutTests/platform/chromium/permissionclient/storage-permission.html, <http://trac.webkit.org/browser/trunk/LayoutTests/platform/chromium/permissionclient/storage-permission.html?rev=87597#L3>, we reference this script using the relative URL: resources/clearLocalStorage.js. However this script isn't included because it doesn't exist in directory LayoutTests/platform/chromium/permissionclient/resources. Instead, it exists in directory LayoutTests/storage/domstorage/localstorage/resources.

(*) I'm unclear how the decision was made to clear localStorage using the approach taken in <http://trac.webkit.org/browser/trunk/LayoutTests/storage/domstorage/localstorage/resources/clearLocalStorage.js?rev=31908> as opposed to calling localStorage.clear().
Comment 4 jochen 2012-01-03 10:56:36 PST
(In reply to comment #3)
> (From update of attachment 120937 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=120937&action=review
> 
> > LayoutTests/platform/chromium/permissionclient/storage-permission.html:21
> > +    localStorage.clear();
> 
> Is this necessary? Can we reuse/simplify the logic in clearLocalStorage.js (*)? By line 3 of LayoutTests/platform/chromium/permissionclient/storage-permission.html, <http://trac.webkit.org/browser/trunk/LayoutTests/platform/chromium/permissionclient/storage-permission.html?rev=87597#L3>, we reference this script using the relative URL: resources/clearLocalStorage.js. However this script isn't included because it doesn't exist in directory LayoutTests/platform/chromium/permissionclient/resources. Instead, it exists in directory LayoutTests/storage/domstorage/localstorage/resources.

Ouch, seems I forgot to copy this over...



> 
> (*) I'm unclear how the decision was made to clear localStorage using the approach taken in <http://trac.webkit.org/browser/trunk/LayoutTests/storage/domstorage/localstorage/resources/clearLocalStorage.js?rev=31908> as opposed to calling localStorage.clear().


I have no idea either. I think localStorage.clear() is preferable.
Comment 5 jochen 2012-01-03 11:31:49 PST
Created attachment 120971 [details]
Patch
Comment 6 Daniel Bates 2012-01-03 11:36:07 PST
Comment on attachment 120971 [details]
Patch

Can you elaborate on why we can't use the script clearLocalStorage.js?
Comment 7 jochen 2012-01-03 11:47:19 PST
(In reply to comment #6)
> (From update of attachment 120971 [details])
> Can you elaborate on why we can't use the script clearLocalStorage.js?

We can, but I don't see the benefit. clearLocalStorage seems to stem from before localStorage.clear() was implemented: http://trac.webkit.org/browser/trunk/WebCore/storage/Storage.idl?rev=31908

I'm preparing a separate CL that removes clearLocalStorage and replaces it with localStorage.clear() wdyt?
Comment 8 Daniel Bates 2012-01-03 11:52:46 PST
(In reply to comment #7)
> I'm preparing a separate CL that removes clearLocalStorage and replaces it with localStorage.clear() wdyt?

Sounds good.
Comment 9 WebKit Review Bot 2012-01-03 17:11:11 PST
Comment on attachment 120971 [details]
Patch

Clearing flags on attachment: 120971

Committed r103991: <http://trac.webkit.org/changeset/103991>
Comment 10 WebKit Review Bot 2012-01-03 17:11:16 PST
All reviewed patches have been landed.  Closing bug.