Title: [289143] trunk/Tools
Revision
289143
Author
[email protected]
Date
2022-02-04 16:48:34 -0800 (Fri, 04 Feb 2022)

Log Message

Add test for the fix in https://bugs.webkit.org/show_bug.cgi?id=235928
https://bugs.webkit.org/show_bug.cgi?id=236152

Patch by Matt Gilligan <[email protected]> on 2022-02-04
Reviewed by Tim Horton.

* TestWebKitAPI/Tests/ios/KeyboardInputTestsIOS.mm:
(TestWebKitAPI::TEST):

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (289142 => 289143)


--- trunk/Tools/ChangeLog	2022-02-05 00:28:02 UTC (rev 289142)
+++ trunk/Tools/ChangeLog	2022-02-05 00:48:34 UTC (rev 289143)
@@ -1,3 +1,13 @@
+2022-02-04  Matt Gilligan  <[email protected]>
+
+        Add test for the fix in https://bugs.webkit.org/show_bug.cgi?id=235928
+        https://bugs.webkit.org/show_bug.cgi?id=236152
+
+        Reviewed by Tim Horton.
+
+        * TestWebKitAPI/Tests/ios/KeyboardInputTestsIOS.mm:
+        (TestWebKitAPI::TEST):
+
 2022-02-04  Arcady Goldmints-Orlov  <[email protected]>
 
         REGRESSION(r280077): [GTK] It caused 155 new test failures

Modified: trunk/Tools/TestWebKitAPI/Tests/ios/KeyboardInputTestsIOS.mm (289142 => 289143)


--- trunk/Tools/TestWebKitAPI/Tests/ios/KeyboardInputTestsIOS.mm	2022-02-05 00:28:02 UTC (rev 289142)
+++ trunk/Tools/TestWebKitAPI/Tests/ios/KeyboardInputTestsIOS.mm	2022-02-05 00:48:34 UTC (rev 289143)
@@ -36,6 +36,7 @@
 #import "UIKitSPI.h"
 #import "UserInterfaceSwizzler.h"
 #import <WebKit/WKProcessPoolPrivate.h>
+#import <WebKit/WKWebViewConfigurationPrivate.h>
 #import <WebKit/WKWebViewPrivate.h>
 #import <WebKit/_WKProcessPoolConfiguration.h>
 #import <WebKitLegacy/WebEvent.h>
@@ -826,6 +827,29 @@
     EXPECT_EQ(contentView.undoManager, undoManager);
 }
 
+TEST(KeyboardInputTests, DoNotRegisterActionsInOverriddenUndoManager)
+{
+    auto configuration = adoptNS([[WKWebViewConfiguration alloc] init]);
+    [configuration _setUndoManagerAPIEnabled:YES];
+
+    auto webView = adoptNS([[CustomUndoManagerWebView alloc] initWithFrame:CGRectMake(0, 0, 320, 500) configuration:configuration.get()]);
+    auto contentView = [webView wkContentView];
+    EXPECT_FALSE([contentView.undoManagerForWebView canUndo]);
+
+    auto overrideUndoManager = adoptNS([[NSUndoManager alloc] init]);
+    [webView setCustomUndoManager:overrideUndoManager.get()];
+
+    __block bool doneWaiting = false;
+    [webView synchronouslyLoadHTMLString:@"<body></body>"];
+    [webView evaluateJavaScript:@"document.undoManager.addItem(new UndoItem({ label: '', undo: () => debug(\"Performed undo.\"), redo: () => debug(\"Performed redo.\") }))" completionHandler:^(id, NSError *) {
+        doneWaiting = true;
+    }];
+
+    TestWebKitAPI::Util::run(&doneWaiting);
+    EXPECT_TRUE([contentView.undoManagerForWebView canUndo]);
+    EXPECT_FALSE([overrideUndoManager canUndo]);
+}
+
 static UIView * nilResizableSnapshotViewFromRect(id, SEL, CGRect, BOOL, UIEdgeInsets)
 {
     return nil;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to