Issue metadata
Sign in to add a comment
|
Closing a dialog can lose the user gesture
Reported by
kyaw...@yathit.com,
Dec 29 2016
|
||||||||||||||||||||
Issue descriptionUserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.95 Safari/537.36 Steps to reproduce the problem: 1. install https://chrome.google.com/webstore/detail/yathit-sugarcrm-for-gmail/iccdnijlhdogaccaiafdpjmbakdcdakk 2. Setup sugarcrm and login to gmail 3. upload an attachment What is the expected behavior? Prompt permission dialog What went wrong? "This function must be called during a user gesture" Error thrown in background page. Did this work before? N/A Does this work in other browsers? No chrome.permissions.request must be called during user gesture. User gesture are carried from Chrome UI to background page. If a permission require, it bering up permission dialog box. My extension used to work fine for years, now last two week, the function throw with "This function must be called during a user gesture" even though it is called with dialog.close button click. the issue is not appear in Chromium Version 53.0.2766.0 (64-bit), but appear in Version 57.0.2958.0 canary (64-bit) and Version 55.0.2883.95 (64-bit) Chrome version: 55.0.2883.95 Channel: stable OS Version: OS X 10.11.6 Flash Version: Shockwave Flash 24.0 r0 It is possible but very time consuming to make minimal chrome extension which has persistent channel, ui and permission request. I am *pretty* sure this is Chrome regression since I do not update my extension during the time. Anyways, just drop a comment here, if a minimal test case is necessary to reproduce the issue. thanks.
,
Jan 25 2017
Here is solid proof of recent bug. Screenshoot http://g.recordit.co/HasKzDtlFI.gif Please install attached extension. A Positive and an Test buttons should show on any web page from the content script. Click 'Positive', it request optional permission. Click 'Test', it fail to request optional permission saying "This function must be called during a user gesture", even though it is invoked by user gesture. This is working before around Chrome 53.
,
Jan 25 2017
Tinkering workaround with window.confirm https://github.com/yathit/permission-req-bug Clearly it is user gesture, but working :-( I should go with <all_urls> permission. Sweet!!!
,
Jan 25 2017
Bisect using the extension from #2: 420838 (good) - 420839 (bad), 55.0.2872.0 https://chromium.googlesource.com/chromium/src/+log/2e70970b..9027b8ba?pretty=fuller The only change in the range is r420839 "Queue a close event for dialog.close" - issue 380087 .
,
Feb 1 2017
Thank you for providing more feedback. Adding requester "brajkumar@chromium.org" for another review and adding "Needs-Review" label for tracking. For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
,
Mar 13 2017
Cleaning up "Needs-Review" label as we are not using this label for triage. Ref bug 684919
,
Mar 13 2017
,
Apr 17 2017
Could someone take a look?
,
May 12 2017
As per bisect information provided in comment #4 adding @xing.xu for more updates on this issue. Thanks!
,
May 12 2017
Thanks for the bisect, woxxom@! That definitely sounds like the culprit. By asynchronously closing the dialog, I'm suspecting we lose track of the fact that there was a user gesture being processed, which is what we use to determine if an extension function is called with a user gesture. We need to curry that information through to the dialog close (e.g. with user gesture tokens). Assigning to skobes@, who reviewed r420839, and updating the summary.
,
May 19 2017
Hi, I tried to revert this patch locally on Ubuntu as follows, "This function must be called during a user gesture" will gone:
--- a/third_party/WebKit/Source/core/html/HTMLDialogElement.cpp
+++ b/third_party/WebKit/Source/core/html/HTMLDialogElement.cpp
@@ -125,7 +125,7 @@ void HTMLDialogElement::CloseDialog(const String& return_value) {
if (!return_value.IsNull())
return_value_ = return_value;
- ScheduleCloseEvent();
+ DispatchScopedEvent(Event::Create(EventTypeNames::close));
}
Issue analyze:
PermissionsRequestFunction::RunAsync(chrome\browser\extensions\api\permissions\Permissions_api.cc) will check if current call is inside a user_gesture(). If not, will throw this error.
So If we queue the dialog.close as https://html.spec.whatwg.org/multipage/forms.html#close-the-dialog does, this dialog.close will be outside of a user_gesture(). That's why error being throw.
I have little about the extension permission, any other idea about this?
,
May 23 2017
,
May 24 2018
This issue has been Available for over a year. If it's no longer important or seems unlikely to be fixed, please consider closing it out. If it is important, please re-triage the issue. Sorry for the inconvenience if the bug really should have been left as Available. For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
,
Jan 4
This still needs to be fixed. Marking available. |
|||||||||||||||||||||
►
Sign in to add a comment |
|||||||||||||||||||||
Comment 1 by brajkumar@chromium.org
, Dec 30 2016Components: Platform>Extensions
Labels: Needs-Feedback