WebKit Bugzilla
Attachment 369385 Details for
Bug 197685
: TestRunnerWKWebView's menu callbacks should be cleared upon UI script completion
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-197685-20190508085017.patch (text/plain), 9.00 KB, created by
Wenson Hsieh
on 2019-05-08 08:50:17 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Wenson Hsieh
Created:
2019-05-08 08:50:17 PDT
Size:
9.00 KB
patch
obsolete
>Subversion Revision: 245049 >diff --git a/Tools/ChangeLog b/Tools/ChangeLog >index bf3ca1d766f14b8083d8967d2eeac35be616ca91..1b190680b659e112c0813bf786829225c480b834 100644 >--- a/Tools/ChangeLog >+++ b/Tools/ChangeLog >@@ -1,3 +1,16 @@ >+2019-05-08 Wenson Hsieh <wenson_hsieh@apple.com> >+ >+ TestRunnerWKWebView's menu callbacks should be cleared upon UI script completion >+ https://bugs.webkit.org/show_bug.cgi?id=197685 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Fixes a bug in the test runner wherein didShowMenuCallback and didHideMenuCallback are not reset upon UI script >+ completion. See LayoutTests/ChangeLog for more details. >+ >+ * WebKitTestRunner/ios/UIScriptControllerIOS.mm: >+ (WTR::UIScriptController::platformClearAllCallbacks): >+ > 2019-05-07 Oriol Brufau <obrufau@igalia.com> > > Unreviewed. Add myself as a committer. >diff --git a/Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm b/Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm >index 37554c003d67714882e6c67b52f92a6ba5a16fef..9933150503f489d567811a35132c5ed5c5a477c9 100644 >--- a/Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm >+++ b/Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm >@@ -993,20 +993,7 @@ void UIScriptController::platformSetDidEndScrollingCallback() > > void UIScriptController::platformClearAllCallbacks() > { >- TestRunnerWKWebView *webView = TestController::singleton().mainWebView()->platformView(); >- >- webView.didStartFormControlInteractionCallback = nil; >- webView.didEndFormControlInteractionCallback = nil; >- webView.didShowForcePressPreviewCallback = nil; >- webView.didDismissForcePressPreviewCallback = nil; >- webView.didEndZoomingCallback = nil; >- webView.willBeginZoomingCallback = nil; >- webView.didHideKeyboardCallback = nil; >- webView.didShowKeyboardCallback = nil; >- webView.willPresentPopoverCallback = nil; >- webView.didDismissPopoverCallback = nil; >- webView.didEndScrollingCallback = nil; >- webView.rotationDidEndCallback = nil; >+ [TestController::singleton().mainWebView()->platformView() resetInteractionCallbacks]; > } > > void UIScriptController::setSafeAreaInsets(double top, double right, double bottom, double left) >diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index f5b8c15dff1a8e8230841a94fc795be193424f82..a2ba0a429a74f69469244924be6956d39f11ccfc 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,32 @@ >+2019-05-08 Wenson Hsieh <wenson_hsieh@apple.com> >+ >+ TestRunnerWKWebView's menu callbacks should be cleared upon UI script completion >+ https://bugs.webkit.org/show_bug.cgi?id=197685 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Adjust a couple of existing layout tests such that they don't rely on didShowMenuCallback and >+ didHideMenuCallback sticking around across UI scripts. Currently, these layout tests do the following: >+ >+ 1. Run a UI script that registers menu callback handlers. >+ 2. Run a subsequent UI script that will cause the callback handlers to be fired (e.g. clicking on an element). >+ >+ After making the change in the test runner to clear menu callbacks upon script completion, callbacks registered >+ in step (1) are now unregistered when step (2) completes. Instead, we can rewrite this test logic so that >+ they're driven by a single UI script. >+ >+ * editing/pasteboard/ios/dom-paste-consecutive-confirmations.html: >+ * editing/pasteboard/ios/dom-paste-requires-user-gesture.html: >+ >+ Instead of using internals.withUserGesture, put the test logic under a click handler (which is inside the scope >+ of a user gesture token), and then use requestAnimationFrame to schedule a second programmatic paste that is >+ outside the scope of user interaction. As opposed to setTimeout, requestAnimationFrame does not propagate the >+ current user gesture token. >+ >+ * editing/pasteboard/ios/resources/dom-paste-helper.js: >+ (return.new.Promise.): >+ (async._waitForOrTriggerPasteMenu): >+ > 2019-05-07 Jiewen Tan <jiewen_tan@apple.com> > > [WebAuthN] A new request should always suppress the pending request if any >diff --git a/LayoutTests/editing/pasteboard/ios/dom-paste-consecutive-confirmations.html b/LayoutTests/editing/pasteboard/ios/dom-paste-consecutive-confirmations.html >index b3d1ae69f082da58e3dbd183e4324a38038aea5b..daed28f5a0f224b87b3045bf18e39a70d2300c40 100644 >--- a/LayoutTests/editing/pasteboard/ios/dom-paste-consecutive-confirmations.html >+++ b/LayoutTests/editing/pasteboard/ios/dom-paste-consecutive-confirmations.html >@@ -49,15 +49,19 @@ async function waitForAndTapPasteMenuTwice() { > (() => { > doneCount = 0; > function incrementProgress() { >- if (++doneCount === 4) >+ if (++doneCount === 5) > uiController.uiScriptComplete(); > } > > uiController.didHideMenuCallback = incrementProgress; >- uiController.didShowMenuCallback = () => { >+ uiController.didShowMenuCallback = tapPasteMenuAction; >+ >+ function tapPasteMenuAction() { > const rect = uiController.rectForMenuAction("Paste"); > uiController.singleTapAtPoint(rect.left + rect.width / 2, rect.top + rect.height / 2, incrementProgress); >- }; >+ } >+ >+ uiController.singleTapAtPoint(160, 50, incrementProgress); > })()`, resolve); > }); > } >@@ -80,9 +84,9 @@ addEventListener("load", async () => { > if (!window.testRunner || !window.internals) > return; > >- waitForAndTapPasteMenuTwice().then(finishJSTest); > await UIHelper.activateAt(160, 125); >- await UIHelper.activateAt(160, 50); >+ await waitForAndTapPasteMenuTwice(); >+ finishJSTest(); > }); > </script> > </body> >diff --git a/LayoutTests/editing/pasteboard/ios/dom-paste-requires-user-gesture.html b/LayoutTests/editing/pasteboard/ios/dom-paste-requires-user-gesture.html >index ac4e7d3f1fa91075ea760ea830f6e327e1ba0c34..127904f0e2cc3fef9ca7e289786b0378831b4363 100644 >--- a/LayoutTests/editing/pasteboard/ios/dom-paste-requires-user-gesture.html >+++ b/LayoutTests/editing/pasteboard/ios/dom-paste-requires-user-gesture.html >@@ -43,18 +43,29 @@ const editor = document.getElementById("editor"); > > description("Verifies that no callout is shown when the page programmatically triggers paste outside the scope of user interaction. This test requires WebKitTestRunner."); > >-addEventListener("load", async () => { >- UIHelper.activateAt(160, 125).then(() => { >- editor.focus(); >- waitForPasteMenu().then(finishJSTest); >- >- UIHelper.ensurePresentationUpdate().then(() => { >- internals.withUserGesture(() => shouldBe("document.execCommand('Paste')", "true")); >- shouldBe("document.execCommand('Paste')", "false"); >- shouldBeEqualToString("editor.textContent", "Click here to copy"); >- }); >+function checkDone() { >+ if (!window.doneCount) >+ doneCount = 0; >+ >+ if (++doneCount == 2) >+ finishJSTest(); >+} >+ >+editor.addEventListener("click", event => { >+ editor.focus(); >+ shouldBe("document.execCommand('Paste')", "true"); >+ requestAnimationFrame(() => { >+ shouldBe("document.execCommand('Paste')", "false") >+ shouldBeEqualToString("editor.textContent", "Click here to copy"); >+ checkDone(); > }); > }); >+ >+addEventListener("load", async () => { >+ await UIHelper.activateAt(160, 125); >+ await triggerPasteMenuAfterTapAt(160, 50); >+ checkDone(); >+}); > </script> > </body> > </html> >diff --git a/LayoutTests/editing/pasteboard/ios/resources/dom-paste-helper.js b/LayoutTests/editing/pasteboard/ios/resources/dom-paste-helper.js >index bbcdb4fae56da0bc5b60fbdcb716291d372b0223..ef9bc41a5be5ace509c10a4a33b6b2097be5f48e 100644 >--- a/LayoutTests/editing/pasteboard/ios/resources/dom-paste-helper.js >+++ b/LayoutTests/editing/pasteboard/ios/resources/dom-paste-helper.js >@@ -10,7 +10,8 @@ async function _waitForOrTriggerPasteMenu(x, y, proceedWithPaste, shouldTap) { > } > > uiController.didHideMenuCallback = checkDone; >- uiController.didShowMenuCallback = () => { >+ >+ function tapPasteMenuAction() { > if (${proceedWithPaste}) { > const rect = uiController.rectForMenuAction("Paste"); > uiController.singleTapAtPoint(rect.left + rect.width / 2, rect.top + rect.height / 2, checkDone); >@@ -18,7 +19,12 @@ async function _waitForOrTriggerPasteMenu(x, y, proceedWithPaste, shouldTap) { > uiController.resignFirstResponder(); > checkDone(); > } >- }; >+ } >+ >+ if (uiController.isShowingMenu) >+ tapPasteMenuAction(); >+ else >+ uiController.didShowMenuCallback = tapPasteMenuAction; > > if (${shouldTap}) > uiController.singleTapAtPoint(${x}, ${y}, checkDone);
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 197685
: 369385