WebKit Bugzilla
Attachment 347012 Details for
Bug 188515
: WebDriver: do not try to set the caret when focusing non text element in send keys command
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
wd-send-keys-caret.diff (text/plain), 2.05 KB, created by
Carlos Garcia Campos
on 2018-08-13 06:16:28 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Carlos Garcia Campos
Created:
2018-08-13 06:16:28 PDT
Size:
2.05 KB
patch
obsolete
>diff --git a/Source/WebDriver/ChangeLog b/Source/WebDriver/ChangeLog >index ae6fe07632b..9bfa1efe252 100644 >--- a/Source/WebDriver/ChangeLog >+++ b/Source/WebDriver/ChangeLog >@@ -1,3 +1,15 @@ >+2018-08-13 Carlos Garcia Campos <cgarcia@igalia.com> >+ >+ WebDriver: do not try to set the caret when focusing non text element in send keys command >+ https://bugs.webkit.org/show_bug.cgi?id=188515 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ It causes a type error exception. >+ >+ * Session.cpp: >+ (WebDriver::Session::elementSendKeys): >+ > 2018-08-13 Carlos Garcia Campos <cgarcia@igalia.com> > > WebDriver: include all capabilities in the new session response >diff --git a/Source/WebDriver/Session.cpp b/Source/WebDriver/Session.cpp >index 5c52e15cc3d..7583535beda 100644 >--- a/Source/WebDriver/Session.cpp >+++ b/Source/WebDriver/Session.cpp >@@ -1732,12 +1732,14 @@ void Session::elementSendKeys(const String& elementID, const String& text, Funct > // FIXME: move this to an atom. > static const char focusScript[] = > "function focus(element) {" >- " var doc = element.ownerDocument || element;" >- " var prevActiveElement = doc.activeElement;" >+ " let doc = element.ownerDocument || element;" >+ " let prevActiveElement = doc.activeElement;" > " if (element != prevActiveElement && prevActiveElement)" > " prevActiveElement.blur();" > " element.focus();" >- " if (element != prevActiveElement && element.value && element.value.length && element.setSelectionRange)" >+ " let tagName = element.tagName.toUpperCase();" >+ " let isTextElement = tagName === 'TEXTAREA' || (tagName === 'INPUT' && element.type === 'text');" >+ " if (isTextElement && element.selectionEnd == 0)" > " element.setSelectionRange(element.value.length, element.value.length);" > " if (element != doc.activeElement)" > " throw new Error('cannot focus element');"
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:
bburg
:
review+
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 188515
: 347012