WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
174987
Web Automation: add event to notify service when a page's main frame window object has cleared
https://bugs.webkit.org/show_bug.cgi?id=174987
Summary
Web Automation: add event to notify service when a page's main frame window o...
Blaze Burg
Reported
2017-07-31 13:09:01 PDT
Needed by safaridriver to prune old element handles that are no longer valid.
Attachments
Patch
(5.09 KB, patch)
2017-07-31 13:12 PDT
,
Blaze Burg
no flags
Details
Formatted Diff
Diff
Proposed Fix
(5.50 KB, patch)
2017-08-01 16:52 PDT
,
Blaze Burg
no flags
Details
Formatted Diff
Diff
Show Obsolete
(2)
View All
Add attachment
proposed patch, testcase, etc.
Blaze Burg
Comment 1
2017-07-31 13:09:33 PDT
<
rdar://problem/36602634
>
Blaze Burg
Comment 2
2017-07-31 13:12:32 PDT
Created
attachment 316796
[details]
Patch
Carlos Garcia Campos
Comment 3
2017-07-31 23:07:59 PDT
Comment on
attachment 316796
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=316796&action=review
LGTM, do we need a WebKit2 owner approval for this?
> Source/WebKit/UIProcess/Automation/Automation.json:530 > + { > + "name": "browsingContextCleared", > + "description": "Fired when the specified browsing context has navigated or closed. Existing element references from the browsing context are no longer valid.", > + "parameters": [ > + { "name": "browsingContextHandle", "$ref": "BrowsingContextHandle" } > + ]
What does safaridriver do in response to this? element references are in the automation proxy in the web process, no? or does safaridriver keep also a cache of element references?
Blaze Burg
Comment 4
2017-08-01 08:59:47 PDT
Comment on
attachment 316796
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=316796&action=review
>> Source/WebKit/UIProcess/Automation/Automation.json:530 >> + ] > > What does safaridriver do in response to this? element references are in the automation proxy in the web process, no? or does safaridriver keep also a cache of element references?
This is part of our implementation of file upload. The W3C specification states that sendKeys to an <input type=file multiple> should append, not replace, the file list. I don't want to encode the append semantics into the protocol. So safaridriver keeps a map of (element handle) -> (last file list selection). This allows it to send a new Automation.setFilesToSelectForFileUpload command with the new file appended. We also double-check the FileList of `element.files` to make sure that it hasn't been cleared out from under us via element.form.reset() or whatever. If we didn't keep a map of element -> last file selection, then we'd not be able to emulate appending files. We'd also not be able to re-match the already selected files (which lack a full path, we just know the basename+mtime+filesize) to the full file paths that we need to pass to setFilesToSelectForFileUpload. So, with all that in mind, this event lets safaridriver clear out element handles from the aforementioned map when the corresponding browsing context clears its window object. Otherwise, we'd retain a handle in the map for every element used as a file upload target.
Blaze Burg
Comment 5
2017-08-01 09:00:55 PDT
(In reply to Carlos Garcia Campos from
comment #3
)
> Comment on
attachment 316796
[details]
> Patch > > View in context: >
https://bugs.webkit.org/attachment.cgi?id=316796&action=review
> > LGTM, do we need a WebKit2 owner approval for this?
Maybe officially, but not really? I'll cc Tim and Brady but usually things unrelated to API are less important to get reviewed by that team.
Brady Eidson
Comment 6
2017-08-01 09:04:45 PDT
Comment on
attachment 316796
[details]
Patch s'fine
Carlos Garcia Campos
Comment 7
2017-08-01 09:25:30 PDT
(In reply to Brian Burg from
comment #4
)
> Comment on
attachment 316796
[details]
> Patch > > View in context: >
https://bugs.webkit.org/attachment.cgi?id=316796&action=review
> > >> Source/WebKit/UIProcess/Automation/Automation.json:530 > >> + ] > > > > What does safaridriver do in response to this? element references are in the automation proxy in the web process, no? or does safaridriver keep also a cache of element references? > > This is part of our implementation of file upload. The W3C specification > states that sendKeys to an <input type=file multiple> should append, not > replace, the file list. I don't want to encode the append semantics into the > protocol. So safaridriver keeps a map of (element handle) -> (last file list > selection). This allows it to send a new > Automation.setFilesToSelectForFileUpload command with the new file appended. > We also double-check the FileList of `element.files` to make sure that it > hasn't been cleared out from under us via element.form.reset() or whatever. > > If we didn't keep a map of element -> last file selection, then we'd not be > able to emulate appending files. We'd also not be able to re-match the > already selected files (which lack a full path, we just know the > basename+mtime+filesize) to the full file paths that we need to pass to > setFilesToSelectForFileUpload. > > So, with all that in mind, this event lets safaridriver clear out element > handles from the aforementioned map when the corresponding browsing context > clears its window object. Otherwise, we'd retain a handle in the map for > every element used as a file upload target.
Ah, ok, I haven't implemented yet the file uploads, so I didn't know that. I'll do it after list box elements.
Carlos Garcia Campos
Comment 8
2017-08-01 09:26:44 PDT
(In reply to Brian Burg from
comment #5
)
> (In reply to Carlos Garcia Campos from
comment #3
) > > Comment on
attachment 316796
[details]
> > Patch > > > > View in context: > >
https://bugs.webkit.org/attachment.cgi?id=316796&action=review
> > > > LGTM, do we need a WebKit2 owner approval for this? > > Maybe officially, but not really? I'll cc Tim and Brady but usually things > unrelated to API are less important to get reviewed by that team.
I guess I'm too used to ask owners approval for all cross-platform changes in WebKit2.
WebKit Commit Bot
Comment 9
2017-08-01 16:31:50 PDT
Comment on
attachment 316796
[details]
Patch Clearing flags on attachment: 316796 Committed
r220115
: <
http://trac.webkit.org/changeset/220115
>
WebKit Commit Bot
Comment 10
2017-08-01 16:31:53 PDT
All reviewed patches have been landed. Closing bug.
Blaze Burg
Comment 11
2017-08-01 16:52:30 PDT
Reopening to attach new patch.
Blaze Burg
Comment 12
2017-08-01 16:52:30 PDT
Created
attachment 316912
[details]
Proposed Fix
Blaze Burg
Comment 13
2017-08-01 16:53:10 PDT
Comment on
attachment 316912
[details]
Proposed Fix webkit-patch got confused.
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