Bug 214583

Summary: Allow IndexedDB in third-party frames
Product: WebKit Reporter: Sihui Liu <sihui_liu>
Component: WebCore Misc.Assignee: Sihui Liu <sihui_liu>
Status: RESOLVED FIXED    
Severity: Normal CC: alecflett, beidson, bfulgham, cdumez, ews-watchlist, ggaren, jsbell, webkit-bug-importer, wilander
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch
none
Patch
none
Patch
none
Patch none

Description Sihui Liu 2020-07-20 19:53:00 PDT
<rdar://problem/61278487>
Comment 1 Sihui Liu 2020-07-20 20:07:50 PDT
Created attachment 404787 [details]
Patch
Comment 2 Sihui Liu 2020-07-20 20:14:20 PDT
Created attachment 404788 [details]
Patch
Comment 3 Sihui Liu 2020-07-21 11:49:58 PDT
Created attachment 404845 [details]
Patch
Comment 4 Sihui Liu 2020-07-21 15:24:16 PDT
Created attachment 404866 [details]
Patch
Comment 5 John Wilander 2020-07-21 15:36:53 PDT
Comment on attachment 404866 [details]
Patch

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

Does this in-memory IDB line up with the IDB third-party ServiceWorkers get? If so, can we add a test to show that?

Is this WK2-specific? I believe so since WK1 already has partitioned IDB afaik. If it is WK2-specific, please say so in the change log.

Does partitioned IDB get cleared when IDB is cleared for the third-party, the partition (the first party), or both? Can we add a test for that?

> Source/WebCore/ChangeLog:10
> +        in-memory storage.

Please add specifics on what the partitioning key is, i.e. origin (scheme+host+port), host, or registrable domain.
Comment 6 Sihui Liu 2020-07-21 16:32:51 PDT
(In reply to John Wilander from comment #5)
> Comment on attachment 404866 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=404866&action=review
> 
> Does this in-memory IDB line up with the IDB third-party ServiceWorkers get?
> If so, can we add a test to show that?
> 

Now IDB should have the same behavior as localStorage, so workers should have temporary storage too. Will try adding a test.

> Is this WK2-specific? I believe so since WK1 already has partitioned IDB
> afaik. If it is WK2-specific, please say so in the change log.
> 

No, both wk1 and wk2 use the same logic: they didn't allow IDB on 3rd party frames. Check mac-wk1 bot behavior on updated test.

> Does partitioned IDB get cleared when IDB is cleared for the third-party,
> the partition (the first party), or both? Can we add a test for that?
> 

Both. Will add a test.

> > Source/WebCore/ChangeLog:10
> > +        in-memory storage.
> 
> Please add specifics on what the partitioning key is, i.e. origin
> (scheme+host+port), host, or registrable domain.

Sure.
Comment 7 Sihui Liu 2020-07-23 00:30:05 PDT
Created attachment 405019 [details]
Patch
Comment 8 Geoffrey Garen 2020-07-23 12:56:55 PDT
Comment on attachment 405019 [details]
Patch

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

r=me

> Source/WebCore/Modules/indexeddb/IDBFactory.cpp:58
> +    if (!context.securityOrigin()->canAccessDatabase(nullptr))
>          return true;

This check looks a little mysterious. It's nice that we're being consistent with LocalStorage here. Probably deserves some follow-up for both LocalStorage and IDB to make this check clearer.
Comment 9 Geoffrey Garen 2020-07-23 12:57:16 PDT
Seems like all review comments so far have been addressed, so I'll say r=me.
Comment 10 EWS 2020-07-23 14:21:26 PDT
Committed r264790: <https://trac.webkit.org/changeset/264790>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 405019 [details].