Bug 27517

Summary: Misc cleanup in DOM Storage.
Product: WebKit Reporter: Jeremy Orlow <jorlow>
Component: New BugsAssignee: Jeremy Orlow <jorlow>
Status: RESOLVED FIXED    
Severity: Normal CC: eric, fishd
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
Attachments:
Description Flags
v1
fishd: review-
v2
none
patch
none
patch eric: review+

Jeremy Orlow
Reported 2009-07-21 13:56:20 PDT
Description will be attached to patch shortly.
Attachments
v1 (5.36 KB, patch)
2009-07-21 14:05 PDT, Jeremy Orlow
fishd: review-
v2 (7.36 KB, patch)
2009-07-25 20:12 PDT, Jeremy Orlow
no flags
patch (7.92 KB, patch)
2009-07-28 14:08 PDT, Jeremy Orlow
no flags
patch (7.92 KB, patch)
2009-07-28 14:31 PDT, Jeremy Orlow
eric: review+
Jeremy Orlow
Comment 1 2009-07-21 14:05:38 PDT
Created attachment 33212 [details] v1 The StorageAreaImpl changes are all for Chromium. Because the DOM Storage implementation runs in a different process from where the Frame object lives, Chromium passes in NULL for the sourceFrame. This affects events and handling privateBrowsing. Chromium's incognito mode does not use the private browsing setting, so that's not a concern. As for events, I've decided to simply disable them for now. The StorageNamespaceImpl changes get rid of a stale comment (path is .copy'ed for thread-safety) and to add an assert that .copy is only ever called on a SessionStorage namespace.
Darin Fisher (:fishd, Google)
Comment 2 2009-07-23 11:01:24 PDT
Comment on attachment 33212 [details] v1 > Index: WebCore/storage/StorageAreaImpl.cpp ... > + // The frame pointer can be NULL in Chromium since this call is made in a > + // different process from where the Frame object exists. Luckily private > + // browsing is implemented differently in Chromium, so it'd never return > + // true anyway. This is a good comment for the ChangeLog since it is the kind of thing that could get stale, and it refers to things like Chrome's multi-process architecture that are not visible to someone just looking at the WebKit code base. We have made a concerted effort to avoid putting comments into WebKit that refer to Chrome and Chrome's architecture as much as we can. If we can instead have WebKit "make sense" standalone then it is a good thing. It means WebKit will be easier to understand. Ultimately, I think we should probably revise StorageAreaImpl to not depend directly on having a Page with Settings. Or, in Chromium we should have a dummy Page so that we can provide Settings. Or, finally... the simplest thing is to just have a comment that says StorageAreaImpl should be usable when there is no associated Frame. We could have a single comment in the header say that documents that. We could add that Chromium uses it that way without needing to give much more detail. A blanket comment like that would help someone else who is tempted to add additional code to touch the Frame, Page, or Settings. Otherwise, looks good.
Jeremy Orlow
Comment 3 2009-07-25 20:12:58 PDT
Created attachment 33501 [details] v2 I haven't decided what approach I'm going to take with events yet. I'll have to think carefully about how it can be tied in with Chromium in a way that's still very clean from the WebKit side of things. Until then, I've placed FIXME's where we're dong the frame checks. I'll come up with a better long term solution soon, but since we're the only implementation that would supply NULLS, I think this is an acceptable short-term solution. So...changed the comments in StorageAreaImpl.cpp. Also cleaned up a bunch of trailing whitespace because once I started I couldn't stop.
Eric Seidel (no email)
Comment 4 2009-07-28 11:09:24 PDT
Comment on attachment 33501 [details] v2 I would rather you abstract this into a function, something like this: static bool privateBrowsingEnabled(frame) { #ifdef CHROMIUM // comment explaing why it's OK for frame to be null return false; #else return frame->.... #endif } Otherwis this looks fine.
Jeremy Orlow
Comment 5 2009-07-28 14:08:13 PDT
Jeremy Orlow
Comment 6 2009-07-28 14:09:48 PDT
Would be great if I could get a quick review. This is the only thing standing between LocalStorage (mostly) working in Chromium. :-)
Jeremy Orlow
Comment 7 2009-07-28 14:31:45 PDT
Eric Seidel (no email)
Comment 8 2009-07-28 14:57:09 PDT
Comment on attachment 33672 [details] patch Why remove: // FIXME: When can this occur? Also, instead of removing // FIXME: Is the .copy necessary? it seems replacing it with // copy for safe muti-threaded access or some similar comment which explains the "why" since clearly the author of that FIXME didn't understand "why" :) Otherwise looks fine.
Jeremy Orlow
Comment 9 2009-07-28 15:05:28 PDT
Added in the comment on the .copy(). As for the other FIXME, I still don't know when it's possible, but I suspect this was put in because page() can return NULL. I added the fixme originally and I don't think anyone's touched the code since, so I figured it was OK to remove.
Eric Seidel (no email)
Comment 10 2009-07-28 15:12:56 PDT
I would rather replace it with an ASSERT(page) than just removing it. :)
Jeremy Orlow
Comment 11 2009-07-28 15:15:35 PDT
I'll create another bug to review this and a couple other places where I think there are unnecessary if statements. I think it'll need careful review.
Jeremy Orlow
Comment 12 2009-07-28 15:26:41 PDT
Sending WebCore/ChangeLog Deleting WebCore/storage/StorageArea.cpp Sending WebCore/storage/StorageAreaImpl.cpp Sending WebCore/storage/StorageNamespaceImpl.cpp Transmitting file data ... Committed revision 46502. http://trac.webkit.org/changeset/46502
Note You need to log in before you can comment on or make changes to this bug.