WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
165830
Add a setting to suppress keyboard input during provisional navigation
https://bugs.webkit.org/show_bug.cgi?id=165830
Summary
Add a setting to suppress keyboard input during provisional navigation
Andy Estes
Reported
2016-12-13 16:47:54 PST
Add a setting to suppress keyboard DOM events during provisional navigation
Attachments
Patch
(23.12 KB, patch)
2016-12-13 17:04 PST
,
Andy Estes
no flags
Details
Formatted Diff
Diff
Patch
(23.98 KB, patch)
2016-12-13 18:05 PST
,
Andy Estes
no flags
Details
Formatted Diff
Diff
Patch
(24.25 KB, patch)
2016-12-13 18:12 PST
,
Andy Estes
no flags
Details
Formatted Diff
Diff
Patch
(29.03 KB, patch)
2016-12-14 15:08 PST
,
Andy Estes
no flags
Details
Formatted Diff
Diff
Archive of layout-test-results from ews101 for mac-yosemite
(1.28 MB, application/zip)
2016-12-14 16:01 PST
,
Build Bot
no flags
Details
Archive of layout-test-results from ews112 for mac-yosemite
(1.77 MB, application/zip)
2016-12-14 16:12 PST
,
Build Bot
no flags
Details
Patch
(30.78 KB, patch)
2016-12-16 14:33 PST
,
Andy Estes
no flags
Details
Formatted Diff
Diff
Show Obsolete
(4)
View All
Add attachment
proposed patch, testcase, etc.
Andy Estes
Comment 1
2016-12-13 17:04:33 PST
Created
attachment 297051
[details]
Patch
Andy Estes
Comment 2
2016-12-13 17:07:09 PST
rdar://problem/26929398
Andy Estes
Comment 3
2016-12-13 17:09:10 PST
Comment on
attachment 297051
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=297051&action=review
> Source/WebKit2/UIProcess/API/C/WKPreferencesRefPrivate.h:458 > +WK_EXPORT bool WKPreferencesShouldSuppressKeyboardDOMEventsDuringProvisionalNavigation(WKPreferencesRef);
Oops, this should have a "Get" in the name.
Andy Estes
Comment 4
2016-12-13 18:05:36 PST
Created
attachment 297054
[details]
Patch
Andy Estes
Comment 5
2016-12-13 18:12:45 PST
Created
attachment 297055
[details]
Patch
Andreas Kling
Comment 6
2016-12-13 19:04:57 PST
Comment on
attachment 297055
[details]
Patch In EventHandler::keyEvent(), if (initialKeyEvent.type() == PlatformEvent::RawKeyDown), we may dispatch the keydown event without ever calling stopPropagation() on it. Do we need to cover that code path as well?
Andy Estes
Comment 7
2016-12-13 21:11:35 PST
(In reply to
comment #6
)
> Comment on
attachment 297055
[details]
> Patch > > In EventHandler::keyEvent(), if (initialKeyEvent.type() == > PlatformEvent::RawKeyDown), we may dispatch the keydown event without ever > calling stopPropagation() on it. > Do we need to cover that code path as well?
Oh, good catch. From what I can tell, that path is for platforms that have separate keydown and keypress/char events, such as Windows. On Cocoa platforms we get a single event for "key down" that we disambiguate into separate keydown and keypress events, but since the initialKeyEvent is never RawKeyDown, these platforms won't take that path. I restructured things so that stopPropogation() is called on the keydown KeyboardEvent before we encounter that branch. I then added another call to stopPropogation() for the handledByInputMethod case, since we reassign keydown in that block. I'll also add an input method composition to my test.
Andy Estes
Comment 8
2016-12-14 15:08:59 PST
Created
attachment 297132
[details]
Patch
Build Bot
Comment 9
2016-12-14 16:00:55 PST
Comment on
attachment 297132
[details]
Patch
Attachment 297132
[details]
did not pass mac-ews (mac): Output:
http://webkit-queues.webkit.org/results/2723878
New failing tests: http/tests/navigation/keyboard-events-during-provisional-navigation.html
Build Bot
Comment 10
2016-12-14 16:01:00 PST
Created
attachment 297140
[details]
Archive of layout-test-results from ews101 for mac-yosemite The attached test failures were seen while running run-webkit-tests on the mac-ews. Bot: ews101 Port: mac-yosemite Platform: Mac OS X 10.10.5
Build Bot
Comment 11
2016-12-14 16:12:13 PST
Comment on
attachment 297132
[details]
Patch
Attachment 297132
[details]
did not pass mac-debug-ews (mac): Output:
http://webkit-queues.webkit.org/results/2723919
New failing tests: http/tests/navigation/keyboard-events-during-provisional-navigation.html
Build Bot
Comment 12
2016-12-14 16:12:18 PST
Created
attachment 297142
[details]
Archive of layout-test-results from ews112 for mac-yosemite The attached test failures were seen while running run-webkit-tests on the mac-debug-ews. Bot: ews112 Port: mac-yosemite Platform: Mac OS X 10.10.5
Andy Estes
Comment 13
2016-12-14 17:08:56 PST
The mac and mac-debug EWS failures are due to my new test failing with this error: CONSOLE MESSAGE: line 10: TypeError: internals.settings.setShouldSuppressKeyboardInputDuringProvisionalNavigation is not a function. (In 'internals.settings.setShouldSuppressKeyboardInputDuringProvisionalNavigation(true)', 'internals.settings.setShouldSuppressKeyboardInputDuringProvisionalNavigation' is undefined) FAIL: Timed out waiting for notifyDone to be called That suggests that EWS miscompiled the patch. On my local machine I have setShouldSuppressKeyboardInputDuringProvisionalNavigation() in InternalSettingsGenerated.h, and the test passes both in DumpRenderTree and WebKitTestRunner.
Brent Fulgham
Comment 14
2016-12-14 18:07:05 PST
(In reply to
comment #13
)
> The mac and mac-debug EWS failures are due to my new test failing with this > error: > > CONSOLE MESSAGE: line 10: TypeError: > internals.settings.setShouldSuppressKeyboardInputDuringProvisionalNavigation > is not a function. (In > 'internals.settings. > setShouldSuppressKeyboardInputDuringProvisionalNavigation(true)', > 'internals.settings. > setShouldSuppressKeyboardInputDuringProvisionalNavigation' is undefined) > FAIL: Timed out waiting for notifyDone to be called > > That suggests that EWS miscompiled the patch. On my local machine I have > setShouldSuppressKeyboardInputDuringProvisionalNavigation() in > InternalSettingsGenerated.h, and the test passes both in DumpRenderTree and > WebKitTestRunner.
It's weird that both of these WK1 tests are unhappy. If mac-32bit is also WK1, then it seems much more likely that a bad build is at fault. If you are confident the WK1 code is correct go ahead and land it.
Brent Fulgham
Comment 15
2016-12-14 18:08:10 PST
Comment on
attachment 297132
[details]
Patch I think this change looks good. I don't see any obvious reason why WK1 would be a problem. As far as I can tell, the new Internal settings changes are identical to other "known good" cases.
Andy Estes
Comment 16
2016-12-14 20:25:00 PST
(In reply to
comment #14
)
> (In reply to
comment #13
) > > The mac and mac-debug EWS failures are due to my new test failing with this > > error: > > > > CONSOLE MESSAGE: line 10: TypeError: > > internals.settings.setShouldSuppressKeyboardInputDuringProvisionalNavigation > > is not a function. (In > > 'internals.settings. > > setShouldSuppressKeyboardInputDuringProvisionalNavigation(true)', > > 'internals.settings. > > setShouldSuppressKeyboardInputDuringProvisionalNavigation' is undefined) > > FAIL: Timed out waiting for notifyDone to be called > > > > That suggests that EWS miscompiled the patch. On my local machine I have > > setShouldSuppressKeyboardInputDuringProvisionalNavigation() in > > InternalSettingsGenerated.h, and the test passes both in DumpRenderTree and > > WebKitTestRunner. > > It's weird that both of these WK1 tests are unhappy. If mac-32bit is also > WK1, then it seems much more likely that a bad build is at fault.
I also thought that was suspicious, but I couldn't reproduce the failure locally in DRY,
Andy Estes
Comment 17
2016-12-14 20:28:36 PST
Oops, saved too soon. I couldn't reproduce locally, nor could I see any obvious issue with the patch. I believe mac-32bit doesn't run tests, which is why we didn't see issues there. Simon also mentioned to me on IRC that there are known issues with InternalSettingsGenerated and incremental builds. I'll land this and monitor the bots for failures in case I need to roll out. Thanks for the review!
Ryosuke Niwa
Comment 18
2016-12-14 20:30:38 PST
Comment on
attachment 297132
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=297132&action=review
> Source/WebCore/dom/EventDispatcher.cpp:159 > + if (shouldSuppressEventDispatchInDOM(node, event)) > + event.stopPropagation(); > +
I don’t think this is the right layer to handle this problem. Doing this in EventHandler as you attempted in a previous patch is better. e.g. with this approach, we may still try to select text, drag text, etc...
Ryosuke Niwa
Comment 19
2016-12-14 20:38:27 PST
Source/WebCore/replay/UserInputBridge has a nice of user inputs you want to block. We should also block accessibility related user interactions initiated from accessibilityPerformAction in Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm and friends.
Andy Estes
Comment 20
2016-12-16 14:19:33 PST
(In reply to
comment #18
)
> Comment on
attachment 297132
[details]
> Patch > > View in context: >
https://bugs.webkit.org/attachment.cgi?id=297132&action=review
> > > Source/WebCore/dom/EventDispatcher.cpp:159 > > + if (shouldSuppressEventDispatchInDOM(node, event)) > > + event.stopPropagation(); > > + > > I don’t think this is the right layer to handle this problem. > Doing this in EventHandler as you attempted in a previous patch is better.
Putting a check in EventHandler is insufficient to block all the events covered by the test case, so it's not clear to me how the previous patch was better. What's wrong with blocking event dispatch in EventDispatcher?
> e.g. with this approach, we may still try to select text, drag text, etc...
These actions are allowed by design. We're specifically targeting text input from the keyboard.
Andy Estes
Comment 21
2016-12-16 14:27:26 PST
(In reply to
comment #19
)
> Source/WebCore/replay/UserInputBridge has a nice of user inputs you want to > block. > > We should also block accessibility related user interactions initiated from > accessibilityPerformAction in > Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm and > friends.
As far as I can tell, these actions result in things like menu interactions, touch events, and access key invocations, not observable text input. Those things are outside the scope of what we're trying to fix with this bug.
Andy Estes
Comment 22
2016-12-16 14:33:50 PST
Created
attachment 297355
[details]
Patch
WebKit Commit Bot
Comment 23
2016-12-16 15:11:34 PST
Comment on
attachment 297355
[details]
Patch Clearing flags on attachment: 297355 Committed
r209943
: <
http://trac.webkit.org/changeset/209943
>
WebKit Commit Bot
Comment 24
2016-12-16 15:11:41 PST
All reviewed patches have been landed. Closing bug.
Ryosuke Niwa
Comment 25
2016-12-16 15:17:33 PST
Comment on
attachment 297355
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=297355&action=review
> Source/WebCore/dom/EventDispatcher.cpp:158 > if (is<HTMLInputElement>(node)) > downcast<HTMLInputElement>(node).willDispatchEvent(event, clickHandlingState); > > + if (shouldSuppressEventDispatchInDOM(node, event)) > + event.stopPropagation();
This would probably mean that checkbox state would have been updated already.
Ryosuke Niwa
Comment 26
2016-12-16 15:20:27 PST
(In reply to
comment #20
)
> (In reply to
comment #18
) > > Comment on
attachment 297132
[details]
> > Patch > > > > View in context: > >
https://bugs.webkit.org/attachment.cgi?id=297132&action=review
> > > > > Source/WebCore/dom/EventDispatcher.cpp:159 > > > + if (shouldSuppressEventDispatchInDOM(node, event)) > > > + event.stopPropagation(); > > > + > > > > I don’t think this is the right layer to handle this problem. > > Doing this in EventHandler as you attempted in a previous patch is better. > > Putting a check in EventHandler is insufficient to block all the events > covered by the test case, so it's not clear to me how the previous patch was > better. What's wrong with blocking event dispatch in EventDispatcher?
The problem is that EventDispatcher is supposed to be a low level primitive the rest of WebCore uses, and I can’t reckon all the implications of checking FrameLoader’s state like this. For example, EventHandler has a bunch of states that get updated before events are dispatched.
> > e.g. with this approach, we may still try to select text, drag text, etc... > > These actions are allowed by design. We're specifically targeting text input > from the keyboard.
In that case, it would have been better to do this check in the default event handlers which are responsible for text inputs.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug