Bug 214198 - [iOS] Prompt for requestStorageAccess is inverted in WKWebView
Summary: [iOS] Prompt for requestStorageAccess is inverted in WKWebView
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit API (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Brent Fulgham
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2020-07-10 14:27 PDT by Ali Juma
Modified: 2020-07-10 23:30 PDT (History)
7 users (show)

See Also:


Attachments
Test case (77 bytes, text/html)
2020-07-10 14:27 PDT, Ali Juma
no flags Details
Patch (2.30 KB, patch)
2020-07-10 16:07 PDT, Brent Fulgham
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ali Juma 2020-07-10 14:27:00 PDT
Created attachment 404001 [details]
Test case

Testing on iOS 14 beta 2, I'm seeing the following broken behavior for the requestStorageAccess prompt in WKWebView:
1. On the simulator, clicking "Don't allow" or "Allow" does the opposite: "Don't allow" grants access while "Allow" denies it.
2. On device, in situations where the prompt should be shown, storage access is granted silently without displaying any prompt.

The behavior is correct in Safari, but broken in WKWebView (I'm testing using Chrome).

I've attached a test case that reproduces this bug:
1. First visit https://alijuma.github.io/request.html and click the button.
2. Visit the attached test page (which embeds the page above) and click the button, which triggers requestStorageAccess.

Expected behavior (and behavior in Safari): a prompt is shown, and clicking on "Allow" or "Don't allow" updates the displayed message to indicate whether the promise resolved or rejected.
Actual behavior in WKWebView: On simulator, the prompt is shown, but the buttons do the opposite of what they should. On device, no prompt is shown.
Comment 1 Ali Juma 2020-07-10 14:32:57 PDT
Also created FB7910866 for this.
Comment 2 Brent Fulgham 2020-07-10 16:02:06 PDT
Oh wow -- I think this has been inverted the whole time!
Comment 3 Radar WebKit Bug Importer 2020-07-10 16:02:28 PDT
<rdar://problem/65369725>
Comment 4 Brent Fulgham 2020-07-10 16:04:59 PDT
Ali: Looking at the code, I believe this has been broken in all versions of iOS with this prompt. Did you test in iOS 13 and find that it worked properly in that release?
Comment 5 Brent Fulgham 2020-07-10 16:07:43 PDT
Created attachment 404015 [details]
Patch
Comment 6 Ali Juma 2020-07-10 17:42:57 PDT
(In reply to Brent Fulgham from comment #4)
> Ali: Looking at the code, I believe this has been broken in all versions of
> iOS with this prompt. Did you test in iOS 13 and find that it worked
> properly in that release?

On iOS 13, I don't see the prompt at all in WKWebView (storage access is silently granted), presumably because ITP isn't enabled in iOS 13.
Comment 7 EWS 2020-07-10 23:30:28 PDT
Committed r264266: <https://trac.webkit.org/changeset/264266>

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