Bug 214583 - Allow IndexedDB in third-party frames
Summary: Allow IndexedDB in third-party frames
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Sihui Liu
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2020-07-20 19:53 PDT by Sihui Liu
Modified: 2020-07-23 14:21 PDT (History)
9 users (show)

See Also:


Attachments
Patch (14.56 KB, patch)
2020-07-20 20:07 PDT, Sihui Liu
no flags Details | Formatted Diff | Diff
Patch (14.53 KB, patch)
2020-07-20 20:14 PDT, Sihui Liu
no flags Details | Formatted Diff | Diff
Patch (21.06 KB, patch)
2020-07-21 11:49 PDT, Sihui Liu
no flags Details | Formatted Diff | Diff
Patch (21.14 KB, patch)
2020-07-21 15:24 PDT, Sihui Liu
no flags Details | Formatted Diff | Diff
Patch (29.25 KB, patch)
2020-07-23 00:30 PDT, Sihui Liu
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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].