Bug 199423 - Make sure to cross-thread copy in StorageManager when hopping back to the main thread
Summary: Make sure to cross-thread copy in StorageManager when hopping back to the mai...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit Misc. (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: youenn fablet
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2019-07-02 14:46 PDT by youenn fablet
Modified: 2019-07-03 10:29 PDT (History)
5 users (show)

See Also:


Attachments
Patch (7.06 KB, patch)
2019-07-02 14:59 PDT, youenn fablet
no flags Details | Formatted Diff | Diff
Patch (7.05 KB, patch)
2019-07-02 15:46 PDT, youenn fablet
no flags Details | Formatted Diff | Diff
Patch (6.02 KB, patch)
2019-07-02 16:58 PDT, youenn fablet
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description youenn fablet 2019-07-02 14:46:56 PDT
Make sure to cross-thread copy in StorageManager when hopping back to the main thread
Comment 1 youenn fablet 2019-07-02 14:59:20 PDT
Created attachment 373364 [details]
Patch
Comment 2 youenn fablet 2019-07-02 15:46:39 PDT
Created attachment 373367 [details]
Patch
Comment 3 Chris Dumez 2019-07-02 16:37:35 PDT
Comment on attachment 373367 [details]
Patch

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

> Source/WebKit/NetworkProcess/WebStorage/LocalStorageDatabaseTracker.cpp:132
> +Vector<LocalStorageDatabaseTracker::OriginDetails> LocalStorageDatabaseTracker::originDetailsIsolatedCopy()

What's getting isolatedCopied here? It is not obvious to me from looking at the implementation.
Comment 4 youenn fablet 2019-07-02 16:43:10 PDT
Comment on attachment 373367 [details]
Patch

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

>> Source/WebKit/NetworkProcess/WebStorage/LocalStorageDatabaseTracker.cpp:132
>> +Vector<LocalStorageDatabaseTracker::OriginDetails> LocalStorageDatabaseTracker::originDetailsIsolatedCopy()
> 
> What's getting isolatedCopied here? It is not obvious to me from looking at the implementation.

There is nothing getting copied but I want to make it clear that this method is generating already isolated strings here.
Initially, when reading the code, I thought there might be an issue and was thinking of isolating-copy at call site.
Maybe another name might be better or adding an ASSERT at call site?
Comment 5 Chris Dumez 2019-07-02 16:51:49 PDT
Comment on attachment 373367 [details]
Patch

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

>>> Source/WebKit/NetworkProcess/WebStorage/LocalStorageDatabaseTracker.cpp:132
>>> +Vector<LocalStorageDatabaseTracker::OriginDetails> LocalStorageDatabaseTracker::originDetailsIsolatedCopy()
>> 
>> What's getting isolatedCopied here? It is not obvious to me from looking at the implementation.
> 
> There is nothing getting copied but I want to make it clear that this method is generating already isolated strings here.
> Initially, when reading the code, I thought there might be an issue and was thinking of isolating-copy at call site.
> Maybe another name might be better or adding an ASSERT at call site?

Why not isolateCopy() at call site? Nothing guarantees that origin.databaseIdentifier() returns a String that is isolated. It might be safe now but no guarantee that origin.databaseIdentifier() does not get updated in the future.
Comment 6 youenn fablet 2019-07-02 16:55:35 PDT
(In reply to Chris Dumez from comment #5)
> Comment on attachment 373367 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=373367&action=review
> 
> >>> Source/WebKit/NetworkProcess/WebStorage/LocalStorageDatabaseTracker.cpp:132
> >>> +Vector<LocalStorageDatabaseTracker::OriginDetails> LocalStorageDatabaseTracker::originDetailsIsolatedCopy()
> >> 
> >> What's getting isolatedCopied here? It is not obvious to me from looking at the implementation.
> > 
> > There is nothing getting copied but I want to make it clear that this method is generating already isolated strings here.
> > Initially, when reading the code, I thought there might be an issue and was thinking of isolating-copy at call site.
> > Maybe another name might be better or adding an ASSERT at call site?
> 
> Why not isolateCopy() at call site? Nothing guarantees that
> origin.databaseIdentifier() returns a String that is isolated. It might be
> safe now but no guarantee that origin.databaseIdentifier() does not get
> updated in the future.

Yeah, this should not be called that often so let's do it.
Comment 7 youenn fablet 2019-07-02 16:58:37 PDT
Created attachment 373372 [details]
Patch
Comment 8 WebKit Commit Bot 2019-07-03 10:28:59 PDT
Comment on attachment 373372 [details]
Patch

Clearing flags on attachment: 373372

Committed r247092: <https://trac.webkit.org/changeset/247092>
Comment 9 WebKit Commit Bot 2019-07-03 10:29:00 PDT
All reviewed patches have been landed.  Closing bug.
Comment 10 Radar WebKit Bug Importer 2019-07-03 10:29:17 PDT
<rdar://problem/52596472>