WebKit Bugzilla
Attachment 339907 Details for
Bug 185260
: Some fields are not identified as [WKWebProcessPlugInNodeHandle isTextField]
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
V2 Proposed fix + API test
0001-Cocoa-Some-fields-are-not-identified-as-WKWebProcess.patch (text/plain), 15.01 KB, created by
Richard Houle
on 2018-05-08 17:29:46 PDT
(
hide
)
Description:
V2 Proposed fix + API test
Filename:
MIME Type:
Creator:
Richard Houle
Created:
2018-05-08 17:29:46 PDT
Size:
15.01 KB
patch
obsolete
>From 141baf57dae28e795d0cd465686c0a1434f25f94 Mon Sep 17 00:00:00 2001 >From: Richard Houle <rhoule@apple.com> >Date: Mon, 7 May 2018 17:23:37 -0700 >Subject: [PATCH] [Cocoa] Some fields are not identified as > [WKWebProcessPlugInNodeHandle isTextField] > https://bugs.webkit.org/show_bug.cgi?id=185260 <rdar://problem/39290394> > >Source/WebKit: > >* WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.cpp: >(WebKit::InjectedBundleNodeHandle::isTextField const): > >Tools: > >* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj: >* TestWebKitAPI/Tests/WebKitCocoa/InjectedBundleNodeHandleIsTextField.mm: Added. >(-[InjectedBundleNodeHandleIsTextField isTextFieldForHTMLInputType:document:jsContext:]): >(-[InjectedBundleNodeHandleIsTextField webProcessPlugIn:didCreateBrowserContextController:]): >* TestWebKitAPI/Tests/WebKitCocoa/UIDelegate.mm: >(-[InjectedBundleNodeHandleIsTextFieldDelegate webView:runJavaScriptAlertPanelWithMessage:initiatedByFrame:completionHandler:]): >--- > Source/WebKit/ChangeLog | 15 ++++ > .../DOM/InjectedBundleNodeHandle.cpp | 2 +- > Tools/ChangeLog | 15 ++++ > .../TestWebKitAPI.xcodeproj/project.pbxproj | 4 + > .../InjectedBundleNodeHandleIsTextField.mm | 92 ++++++++++++++++++++++ > .../TestWebKitAPI/Tests/WebKitCocoa/UIDelegate.mm | 24 ++++++ > 6 files changed, 151 insertions(+), 1 deletion(-) > create mode 100644 Tools/TestWebKitAPI/Tests/WebKitCocoa/InjectedBundleNodeHandleIsTextField.mm > >diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog >index ee8fb7d26db..4226d37d2dd 100644 >--- a/Source/WebKit/ChangeLog >+++ b/Source/WebKit/ChangeLog >@@ -1,3 +1,18 @@ >+2018-05-08 Richard Houle <rhoule@apple.com> >+ >+ [Cocoa] Some fields are not identified as [WKWebProcessPlugInNodeHandle isTextField] >+ https://bugs.webkit.org/show_bug.cgi?id=185260 >+ <rdar://problem/39290394> >+ >+ INPUT element are not considered to be text fields when >+ calling -[WKWebProcessPlugInNodeHandle isTextField] >+ when they are of type number. >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.cpp: >+ (WebKit::InjectedBundleNodeHandle::isTextField const): >+ > 2018-05-07 Don Olmstead <don.olmstead@sony.com> > > [Win] Add missing methods to WebChromeClient >diff --git a/Source/WebKit/WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.cpp b/Source/WebKit/WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.cpp >index 117cc21070c..b7f74396e7d 100644 >--- a/Source/WebKit/WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.cpp >+++ b/Source/WebKit/WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.cpp >@@ -334,7 +334,7 @@ bool InjectedBundleNodeHandle::isTextField() const > if (!is<HTMLInputElement>(m_node)) > return false; > >- return downcast<HTMLInputElement>(m_node.get()).isText(); >+ return downcast<HTMLInputElement>(m_node.get()).isTextField(); > } > > RefPtr<InjectedBundleNodeHandle> InjectedBundleNodeHandle::htmlTableCellElementCellAbove() >diff --git a/Tools/ChangeLog b/Tools/ChangeLog >index 2e92d2d2b78..b04cf9a765e 100644 >--- a/Tools/ChangeLog >+++ b/Tools/ChangeLog >@@ -1,3 +1,18 @@ >+2018-05-08 Richard Houle <rhoule@apple.com> >+ >+ [Cocoa] Some fields are not identified as [WKWebProcessPlugInNodeHandle isTextField] >+ https://bugs.webkit.org/show_bug.cgi?id=185260 >+ <rdar://problem/39290394> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj: >+ * TestWebKitAPI/Tests/WebKitCocoa/InjectedBundleNodeHandleIsTextField.mm: Added. >+ (-[InjectedBundleNodeHandleIsTextField isTextFieldForHTMLInputType:document:jsContext:]): >+ (-[InjectedBundleNodeHandleIsTextField webProcessPlugIn:didCreateBrowserContextController:]): >+ * TestWebKitAPI/Tests/WebKitCocoa/UIDelegate.mm: >+ (-[InjectedBundleNodeHandleIsTextFieldDelegate webView:runJavaScriptAlertPanelWithMessage:initiatedByFrame:completionHandler:]): >+ > 2018-05-07 Jonathan Bedard <jbedard@apple.com> > > Check for com.apple.datamigrator before declaring simulators booted >diff --git a/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj b/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj >index 2c67684571e..ce7eab29821 100644 >--- a/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj >+++ b/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj >@@ -293,6 +293,7 @@ > 7673499D1930C5BB00E44DF9 /* StopLoadingDuringDidFailProvisionalLoad_bundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7673499A1930182E00E44DF9 /* StopLoadingDuringDidFailProvisionalLoad_bundle.cpp */; }; > 76E182DD1547569100F1FADD /* WillSendSubmitEvent_Bundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 76E182DC1547569100F1FADD /* WillSendSubmitEvent_Bundle.cpp */; }; > 76E182DF154767E600F1FADD /* auto-submitting-form.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 76E182DE15475A8300F1FADD /* auto-submitting-form.html */; }; >+ 79C5D431209D768300F1E7CA /* InjectedBundleNodeHandleIsTextField.mm in Sources */ = {isa = PBXBuildFile; fileRef = 79C5D430209D768300F1E7CA /* InjectedBundleNodeHandleIsTextField.mm */; }; > 7A010BCB1D877C0500EDE72A /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7A010BCA1D877C0500EDE72A /* CoreGraphics.framework */; }; > 7A010BCD1D877C0D00EDE72A /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7A010BCC1D877C0D00EDE72A /* QuartzCore.framework */; }; > 7A0509411FB9F06400B33FB8 /* JSONValue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7A0509401FB9F04400B33FB8 /* JSONValue.cpp */; }; >@@ -1510,6 +1511,7 @@ > 76E182D91547550100F1FADD /* WillSendSubmitEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WillSendSubmitEvent.cpp; sourceTree = "<group>"; }; > 76E182DC1547569100F1FADD /* WillSendSubmitEvent_Bundle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WillSendSubmitEvent_Bundle.cpp; sourceTree = "<group>"; }; > 76E182DE15475A8300F1FADD /* auto-submitting-form.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "auto-submitting-form.html"; sourceTree = "<group>"; }; >+ 79C5D430209D768300F1E7CA /* InjectedBundleNodeHandleIsTextField.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = InjectedBundleNodeHandleIsTextField.mm; sourceTree = "<group>"; }; > 7A010BCA1D877C0500EDE72A /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; > 7A010BCC1D877C0D00EDE72A /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; }; > 7A0509401FB9F04400B33FB8 /* JSONValue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSONValue.cpp; sourceTree = "<group>"; }; >@@ -2191,6 +2193,7 @@ > 57599E201F07191700A3FB8C /* IndexedDBStructuredCloneBackwardCompatibility.mm */, > 5198A23F1EA7E595008910B7 /* InitialWarmedProcessUsed.mm */, > 2DB0232E1E4E871800707123 /* InteractionDeadlockAfterCrash.mm */, >+ 79C5D430209D768300F1E7CA /* InjectedBundleNodeHandleIsTextField.mm */, > 5C69BDD41F82A7EB000F4F4B /* JavaScriptDuringNavigation.mm */, > C25CCA051E51380B0026CB8A /* LineBreaking.mm */, > 37D36ED61AF42ECD00BAF5D9 /* LoadAlternateHTMLString.mm */, >@@ -3862,6 +3865,7 @@ > A13EBBB01B87436F00097110 /* BundleParametersPlugIn.mm in Sources */, > 37A709AF1E3EA97E00CA5969 /* BundleRangeHandlePlugIn.mm in Sources */, > 1C2B81831C891F0900A5529F /* CancelFontSubresourcePlugIn.mm in Sources */, >+ 79C5D431209D768300F1E7CA /* InjectedBundleNodeHandleIsTextField.mm in Sources */, > 5CB18BA81F5645E300EE23C4 /* ClickAutoFillButton.mm in Sources */, > A14FC58B1B89927100D107EB /* ContentFilteringPlugIn.mm in Sources */, > CEA7F57D2089624B0078EF6E /* DidResignInputElementStrongPasswordAppearance.mm in Sources */, >diff --git a/Tools/TestWebKitAPI/Tests/WebKitCocoa/InjectedBundleNodeHandleIsTextField.mm b/Tools/TestWebKitAPI/Tests/WebKitCocoa/InjectedBundleNodeHandleIsTextField.mm >new file mode 100644 >index 00000000000..eda8407dac4 >--- /dev/null >+++ b/Tools/TestWebKitAPI/Tests/WebKitCocoa/InjectedBundleNodeHandleIsTextField.mm >@@ -0,0 +1,92 @@ >+/* >+ * Copyright (C) 2018 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#import "config.h" >+ >+#if WK_API_ENABLED >+ >+#import <WebKit/WKDOMDocument.h> >+#import <WebKit/WKDOMElement.h> >+#import <WebKit/WKDOMNodePrivate.h> >+#import <WebKit/WKWebProcessPlugIn.h> >+#import <WebKit/WKWebProcessPlugInBrowserContextControllerPrivate.h> >+#import <WebKit/WKWebProcessPlugInFrame.h> >+#import <WebKit/WKWebProcessPlugInNodeHandlePrivate.h> >+#import <WebKit/WKWebProcessPlugInScriptWorld.h> >+ >+@interface InjectedBundleNodeHandleIsTextField : NSObject <WKWebProcessPlugIn> >+@end >+ >+@implementation InjectedBundleNodeHandleIsTextField >+ >+- (BOOL)isTextFieldForHTMLInputType:(NSString *)htmlInputType document:(WKDOMDocument *)document jsContext:(JSContext *)jsContext >+{ >+ WKDOMElement *inputElement = [document createElement:@"input"]; >+ [inputElement setAttribute:@"type" value:htmlInputType]; >+ [[document body] appendChild:inputElement]; >+ >+ auto *jsValue = [jsContext evaluateScript:@"document.querySelector('input')"]; >+ auto* nodeHandle = [WKWebProcessPlugInNodeHandle nodeHandleWithJSValue:jsValue inContext:jsContext]; >+ auto result = [nodeHandle isTextField]; >+ >+ [[document body] removeChild:inputElement]; >+ return result; >+} >+ >+- (void)webProcessPlugIn:(WKWebProcessPlugInController *)plugInController didCreateBrowserContextController:(WKWebProcessPlugInBrowserContextController *)browserContextController >+{ >+ WKDOMDocument *document = [browserContextController mainFrameDocument]; >+ auto *jsContext = [[browserContextController mainFrame] jsContextForWorld:[WKWebProcessPlugInScriptWorld normalWorld]]; >+ >+ ASSERT([self isTextFieldForHTMLInputType:@"date" document:document jsContext:jsContext]); >+ ASSERT([self isTextFieldForHTMLInputType:@"datetime" document:document jsContext:jsContext]); >+ ASSERT([self isTextFieldForHTMLInputType:@"datetime-local" document:document jsContext:jsContext]); >+ ASSERT([self isTextFieldForHTMLInputType:@"email" document:document jsContext:jsContext]); >+ ASSERT([self isTextFieldForHTMLInputType:@"month" document:document jsContext:jsContext]); >+ ASSERT([self isTextFieldForHTMLInputType:@"number" document:document jsContext:jsContext]); >+ ASSERT([self isTextFieldForHTMLInputType:@"password" document:document jsContext:jsContext]); >+ ASSERT([self isTextFieldForHTMLInputType:@"search" document:document jsContext:jsContext]); >+ ASSERT([self isTextFieldForHTMLInputType:@"tel" document:document jsContext:jsContext]); >+ ASSERT([self isTextFieldForHTMLInputType:@"text" document:document jsContext:jsContext]); >+ ASSERT([self isTextFieldForHTMLInputType:@"time" document:document jsContext:jsContext]); >+ ASSERT([self isTextFieldForHTMLInputType:@"url" document:document jsContext:jsContext]); >+ ASSERT([self isTextFieldForHTMLInputType:@"week" document:document jsContext:jsContext]); >+ >+ ASSERT(![self isTextFieldForHTMLInputType:@"button" document:document jsContext:jsContext]); >+ ASSERT(![self isTextFieldForHTMLInputType:@"color" document:document jsContext:jsContext]); >+ ASSERT(![self isTextFieldForHTMLInputType:@"file" document:document jsContext:jsContext]); >+ ASSERT(![self isTextFieldForHTMLInputType:@"hidden" document:document jsContext:jsContext]); >+ ASSERT(![self isTextFieldForHTMLInputType:@"image" document:document jsContext:jsContext]); >+ ASSERT(![self isTextFieldForHTMLInputType:@"radio" document:document jsContext:jsContext]); >+ ASSERT(![self isTextFieldForHTMLInputType:@"range" document:document jsContext:jsContext]); >+ ASSERT(![self isTextFieldForHTMLInputType:@"reset" document:document jsContext:jsContext]); >+ ASSERT(![self isTextFieldForHTMLInputType:@"submit" document:document jsContext:jsContext]); >+ >+ [[[browserContextController mainFrame] jsContextForWorld:[WKWebProcessPlugInScriptWorld normalWorld]] evaluateScript:@"alert('isTextField success')"]; >+} >+ >+@end >+ >+#endif // WK_API_ENABLED >diff --git a/Tools/TestWebKitAPI/Tests/WebKitCocoa/UIDelegate.mm b/Tools/TestWebKitAPI/Tests/WebKitCocoa/UIDelegate.mm >index 386e727b981..d7363648e7b 100644 >--- a/Tools/TestWebKitAPI/Tests/WebKitCocoa/UIDelegate.mm >+++ b/Tools/TestWebKitAPI/Tests/WebKitCocoa/UIDelegate.mm >@@ -611,6 +611,30 @@ TEST(WebKit, AutoFillAvailable) > TestWebKitAPI::Util::run(&done); > } > >+@interface InjectedBundleNodeHandleIsTextFieldDelegate : NSObject <WKUIDelegatePrivate> >+@end >+ >+@implementation InjectedBundleNodeHandleIsTextFieldDelegate >+ >+- (void)webView:(WKWebView *)webView runJavaScriptAlertPanelWithMessage:(NSString *)message initiatedByFrame:(WKFrameInfo *)frame completionHandler:(void (^)())completionHandler >+{ >+ completionHandler(); >+ ASSERT_STREQ(message.UTF8String, "isTextField success"); >+ done = true; >+} >+ >+@end >+ >+TEST(WebKit, InjectedBundleNodeHandleIsTextField) >+{ >+ WKWebViewConfiguration *configuration = [WKWebViewConfiguration _test_configurationWithTestPlugInClassName:@"InjectedBundleNodeHandleIsTextField"]; >+ >+ auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:CGRectMake(0, 0, 800, 600) configuration:configuration]); >+ auto delegate = adoptNS([[InjectedBundleNodeHandleIsTextFieldDelegate alloc] init]); >+ [webView setUIDelegate:delegate.get()]; >+ TestWebKitAPI::Util::run(&done); >+} >+ > @interface PinnedStateObserver : NSObject > @end > >-- >2.16.1 (Apple Git-102) >
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
Flags:
thorton
:
review+
commit-queue
:
commit-queue-
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 185260
:
339429
|
339442
|
339516
|
339828
|
339907
|
340004