Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1002)

Issue 655273005: Implement AutomationNode.querySelector(). (Closed)

Created:
6 years, 1 month ago by aboxhall
Modified:
6 years, 1 month ago
CC:
chromium-reviews, chromium-apps-reviews_chromium.org, extensions-reviews_chromium.org, not at google - send to devlin, dmazzoni
Base URL:
https://chromium.googlesource.com/chromium/src@master
Project:
chromium
Visibility:
Public.

Description

Implement AutomationNode.querySelector(). BUG=404710 Committed: https://crrev.com/7abfb3db96dc7d87c9f1282b5fc81328ec9c787c Cr-Commit-Position: refs/heads/master@{#302944}

Patch Set 1 #

Total comments: 69

Patch Set 2 : Address comments #

Total comments: 32

Patch Set 3 : Address review comments and flesh out error and edge case handling #

Total comments: 30

Patch Set 4 : Address comments #

Patch Set 5 : Use assertEq instead of assertTrue in testQuerySelectorFromRemovedNode() #

Total comments: 10

Patch Set 6 : dmazzoni comments #

Patch Set 7 : devlin review comments #

Total comments: 8

Patch Set 8 : Use enums instead of strings for error messages #

Total comments: 4

Patch Set 9 : Use correct path for automation_api_helper in BUILD.gn #

Patch Set 10 : palmer nits #

Patch Set 11 : rebase #

Patch Set 12 : License typo #

Patch Set 13 : Add complex.html #

Patch Set 14 : Fix heap-use-after-free issue by not keeping a scoped_ptr to automation_api_helper in extension_hel… #

Unified diffs Side-by-side diffs Delta from patch set Stats (+538 lines, -47 lines) Patch
M chrome/browser/extensions/api/automation/automation_apitest.cc View 1 2 3 4 5 6 7 8 9 10 3 chunks +10 lines, -7 lines 0 comments Download
M chrome/browser/extensions/api/automation_internal/automation_internal_api.h View 1 2 3 4 5 6 7 8 9 10 1 chunk +22 lines, -0 lines 0 comments Download
M chrome/browser/extensions/api/automation_internal/automation_internal_api.cc View 1 2 3 4 5 6 7 8 9 10 6 chunks +162 lines, -29 lines 0 comments Download
M chrome/common/extensions/api/automation.idl View 1 2 3 4 5 6 7 8 9 10 2 chunks +19 lines, -0 lines 0 comments Download
M chrome/common/extensions/api/automation_internal.idl View 1 2 3 4 5 6 7 8 9 10 3 chunks +14 lines, -0 lines 0 comments Download
M chrome/renderer/resources/extensions/automation/automation_node.js View 1 2 3 4 5 6 7 8 9 10 4 chunks +32 lines, -3 lines 0 comments Download
A chrome/test/data/extensions/api_test/automation/sites/complex.html View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +23 lines, -0 lines 0 comments Download
M chrome/test/data/extensions/api_test/automation/sites/index.html View 1 2 1 chunk +1 line, -1 line 0 comments Download
M chrome/test/data/extensions/api_test/automation/tests/tabs/close_tab.js View 1 2 3 4 5 6 7 1 chunk +1 line, -1 line 0 comments Download
M chrome/test/data/extensions/api_test/automation/tests/tabs/common.js View 1 2 2 chunks +5 lines, -4 lines 0 comments Download
A + chrome/test/data/extensions/api_test/automation/tests/tabs/queryselector.html View 1 2 3 4 5 6 7 8 9 10 1 chunk +1 line, -1 line 0 comments Download
A chrome/test/data/extensions/api_test/automation/tests/tabs/queryselector.js View 1 2 3 4 5 6 7 1 chunk +82 lines, -0 lines 0 comments Download
M chrome/test/data/extensions/api_test/automation/tests/tabs/tab_id.js View 1 2 3 4 5 6 7 2 chunks +2 lines, -1 line 0 comments Download
M extensions/common/extension_messages.h View 1 2 3 4 5 6 7 8 9 10 11 3 chunks +31 lines, -0 lines 0 comments Download
M extensions/extensions.gyp View 1 2 3 4 5 6 7 8 9 10 1 chunk +2 lines, -0 lines 0 comments Download
M extensions/renderer/BUILD.gn View 1 2 3 4 5 6 7 8 9 10 1 chunk +2 lines, -0 lines 0 comments Download
A extensions/renderer/api/automation/automation_api_helper.h View 1 2 1 chunk +33 lines, -0 lines 0 comments Download
A extensions/renderer/api/automation/automation_api_helper.cc View 1 2 3 4 5 6 7 8 9 1 chunk +90 lines, -0 lines 0 comments Download
M extensions/renderer/extension_helper.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 2 chunks +3 lines, -0 lines 0 comments Download
M extensions/renderer/extension_helper.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 2 chunks +3 lines, -0 lines 0 comments Download

Messages

Total messages: 60 (10 generated)
aboxhall
Not quite ready for commit yet (e.g. need to do some more robust error handling), ...
6 years, 1 month ago (2014-10-27 18:02:50 UTC) #2
dmazzoni
Rather than making the implementation only part of the automation API, I'd prefer we just ...
6 years, 1 month ago (2014-10-27 18:47:36 UTC) #4
dmazzoni
What happens if the AutomationNode you fire this on is a Desktop node? It's fine ...
6 years, 1 month ago (2014-10-27 18:50:42 UTC) #5
dmazzoni
One meta-comment - I think this is a cool API and really useful for automation ...
6 years, 1 month ago (2014-10-27 18:57:09 UTC) #6
David Tseng
+1 making this more generic to accessibility and making desktop accessibility possible to support via ...
6 years, 1 month ago (2014-10-27 20:44:35 UTC) #7
dmazzoni
Maybe this one should be renamed domQuerySelector to indicate that it uses DOM syntax? On ...
6 years, 1 month ago (2014-10-27 23:47:49 UTC) #8
Devlin
First quick look-through. https://codereview.chromium.org/655273005/diff/1/chrome/browser/extensions/api/automation_internal/automation_internal_api.cc File chrome/browser/extensions/api/automation_internal/automation_internal_api.cc (right): https://codereview.chromium.org/655273005/diff/1/chrome/browser/extensions/api/automation_internal/automation_internal_api.cc#newcode49 chrome/browser/extensions/api/automation_internal/automation_internal_api.cc:49: class QuerySelectorHandler : public content::WebContentsObserver { ...
6 years, 1 month ago (2014-10-28 21:05:11 UTC) #9
aboxhall
On 2014/10/27 18:47:36, dmazzoni wrote: > Rather than making the implementation only part of the ...
6 years, 1 month ago (2014-10-28 23:40:39 UTC) #10
aboxhall
On 2014/10/27 18:50:42, dmazzoni wrote: > What happens if the AutomationNode you fire this on ...
6 years, 1 month ago (2014-10-28 23:41:44 UTC) #11
aboxhall
On 2014/10/27 18:50:42, dmazzoni wrote: > What happens if the AutomationNode you fire this on ...
6 years, 1 month ago (2014-10-28 23:41:47 UTC) #12
aboxhall
On 2014/10/27 18:57:09, dmazzoni wrote: > One meta-comment - I think this is a cool ...
6 years, 1 month ago (2014-10-28 23:42:56 UTC) #13
aboxhall
On 2014/10/27 20:44:35, David Tseng wrote: > +1 making this more generic to accessibility and ...
6 years, 1 month ago (2014-10-28 23:43:47 UTC) #14
aboxhall
https://codereview.chromium.org/655273005/diff/1/chrome/browser/extensions/api/automation_internal/automation_internal_api.cc File chrome/browser/extensions/api/automation_internal/automation_internal_api.cc (right): https://codereview.chromium.org/655273005/diff/1/chrome/browser/extensions/api/automation_internal/automation_internal_api.cc#newcode49 chrome/browser/extensions/api/automation_internal/automation_internal_api.cc:49: class QuerySelectorHandler : public content::WebContentsObserver { On 2014/10/28 21:05:09, ...
6 years, 1 month ago (2014-10-28 23:43:57 UTC) #15
dmazzoni
https://codereview.chromium.org/655273005/diff/1/chrome/common/extensions/api/automation.idl File chrome/common/extensions/api/automation.idl (right): https://codereview.chromium.org/655273005/diff/1/chrome/common/extensions/api/automation.idl#newcode226 chrome/common/extensions/api/automation.idl:226: }; On 2014/10/28 23:43:56, aboxhall wrote: > On 2014/10/27 ...
6 years, 1 month ago (2014-10-29 00:00:10 UTC) #16
Devlin
Just answering quick questions - will do a full review this afternoon. https://codereview.chromium.org/655273005/diff/1/chrome/browser/extensions/api/automation_internal/automation_internal_api.cc File chrome/browser/extensions/api/automation_internal/automation_internal_api.cc ...
6 years, 1 month ago (2014-10-29 16:09:03 UTC) #17
aboxhall
https://codereview.chromium.org/655273005/diff/1/chrome/browser/extensions/api/automation_internal/automation_internal_api.cc File chrome/browser/extensions/api/automation_internal/automation_internal_api.cc (right): https://codereview.chromium.org/655273005/diff/1/chrome/browser/extensions/api/automation_internal/automation_internal_api.cc#newcode56 chrome/browser/extensions/api/automation_internal/automation_internal_api.cc:56: extensions::AutomationInternalQuerySelectorFunction::Callback callback) On 2014/10/29 16:09:03, Devlin wrote: > On ...
6 years, 1 month ago (2014-10-29 16:35:19 UTC) #18
aboxhall
On 2014/10/29 00:00:10, dmazzoni wrote: > https://codereview.chromium.org/655273005/diff/1/chrome/common/extensions/api/automation.idl > File chrome/common/extensions/api/automation.idl (right): > > https://codereview.chromium.org/655273005/diff/1/chrome/common/extensions/api/automation.idl#newcode226 > ...
6 years, 1 month ago (2014-10-29 16:58:13 UTC) #19
aboxhall
https://codereview.chromium.org/655273005/diff/1/chrome/browser/extensions/api/automation_internal/automation_internal_api.cc File chrome/browser/extensions/api/automation_internal/automation_internal_api.cc (right): https://codereview.chromium.org/655273005/diff/1/chrome/browser/extensions/api/automation_internal/automation_internal_api.cc#newcode56 chrome/browser/extensions/api/automation_internal/automation_internal_api.cc:56: extensions::AutomationInternalQuerySelectorFunction::Callback callback) On 2014/10/29 16:35:19, aboxhall wrote: > On ...
6 years, 1 month ago (2014-10-29 17:05:20 UTC) #20
Devlin
https://codereview.chromium.org/655273005/diff/1/chrome/browser/extensions/api/automation_internal/automation_internal_api.cc File chrome/browser/extensions/api/automation_internal/automation_internal_api.cc (right): https://codereview.chromium.org/655273005/diff/1/chrome/browser/extensions/api/automation_internal/automation_internal_api.cc#newcode56 chrome/browser/extensions/api/automation_internal/automation_internal_api.cc:56: extensions::AutomationInternalQuerySelectorFunction::Callback callback) On 2014/10/29 16:35:19, aboxhall wrote: > On ...
6 years, 1 month ago (2014-10-29 17:05:36 UTC) #21
Devlin
Mostly just small stuff. https://codereview.chromium.org/655273005/diff/20001/chrome/browser/extensions/api/automation_internal/automation_internal_api.cc File chrome/browser/extensions/api/automation_internal/automation_internal_api.cc (right): https://codereview.chromium.org/655273005/diff/20001/chrome/browser/extensions/api/automation_internal/automation_internal_api.cc#newcode54 chrome/browser/extensions/api/automation_internal/automation_internal_api.cc:54: class QuerySelectorHandler : public content::WebContentsObserver ...
6 years, 1 month ago (2014-10-29 21:23:44 UTC) #22
dmazzoni
On Wed, Oct 29, 2014 at 9:58 AM, <aboxhall@chromium.org> wrote: > https://codereview.chromium.org/655273005/diff/1/extensions/renderer/api/ > automation/automation_api_helper.cc#newcode55 > ...
6 years, 1 month ago (2014-10-29 22:36:05 UTC) #23
aboxhall
https://codereview.chromium.org/655273005/diff/20001/chrome/browser/extensions/api/automation_internal/automation_internal_api.cc File chrome/browser/extensions/api/automation_internal/automation_internal_api.cc (right): https://codereview.chromium.org/655273005/diff/20001/chrome/browser/extensions/api/automation_internal/automation_internal_api.cc#newcode54 chrome/browser/extensions/api/automation_internal/automation_internal_api.cc:54: class QuerySelectorHandler : public content::WebContentsObserver { On 2014/10/29 21:23:43, ...
6 years, 1 month ago (2014-10-30 18:34:18 UTC) #24
aboxhall
https://codereview.chromium.org/655273005/diff/1/extensions/renderer/api/automation/automation_api_helper.cc File extensions/renderer/api/automation/automation_api_helper.cc (right): https://codereview.chromium.org/655273005/diff/1/extensions/renderer/api/automation/automation_api_helper.cc#newcode55 extensions/renderer/api/automation/automation_api_helper.cc:55: node = obj.node(); On 2014/10/29 00:00:10, dmazzoni wrote: > ...
6 years, 1 month ago (2014-10-30 18:36:45 UTC) #25
aboxhall
Ping?
6 years, 1 month ago (2014-10-30 22:46:03 UTC) #26
Devlin
I'm mostly happy. I'll hold off on the lg until dmazzoni and dtseng confirm that ...
6 years, 1 month ago (2014-10-30 23:26:54 UTC) #27
dmazzoni
https://codereview.chromium.org/655273005/diff/40001/chrome/browser/extensions/api/automation_internal/automation_internal_api.cc File chrome/browser/extensions/api/automation_internal/automation_internal_api.cc (right): https://codereview.chromium.org/655273005/diff/40001/chrome/browser/extensions/api/automation_internal/automation_internal_api.cc#newcode337 chrome/browser/extensions/api/automation_internal/automation_internal_api.cc:337: return RespondNow(Error("querySelector query sent on destroyed node")); nit: this ...
6 years, 1 month ago (2014-10-30 23:32:42 UTC) #28
aboxhall
https://codereview.chromium.org/655273005/diff/20001/chrome/browser/extensions/api/automation_internal/automation_internal_api.cc File chrome/browser/extensions/api/automation_internal/automation_internal_api.cc (right): https://codereview.chromium.org/655273005/diff/20001/chrome/browser/extensions/api/automation_internal/automation_internal_api.cc#newcode355 chrome/browser/extensions/api/automation_internal/automation_internal_api.cc:355: return; On 2014/10/30 23:26:53, Devlin wrote: > On 2014/10/29 ...
6 years, 1 month ago (2014-10-31 20:32:22 UTC) #29
dmazzoni
lgtm https://codereview.chromium.org/655273005/diff/80001/chrome/common/extensions/api/automation.idl File chrome/common/extensions/api/automation.idl (right): https://codereview.chromium.org/655273005/diff/80001/chrome/common/extensions/api/automation.idl#newcode224 chrome/common/extensions/api/automation.idl:224: dictionary QueryInfo { unused? https://codereview.chromium.org/655273005/diff/80001/extensions/renderer/api/automation/automation_api_helper.cc File extensions/renderer/api/automation/automation_api_helper.cc (right): ...
6 years, 1 month ago (2014-10-31 22:02:07 UTC) #30
aboxhall
+palmer for extension_messages.h https://codereview.chromium.org/655273005/diff/80001/chrome/common/extensions/api/automation.idl File chrome/common/extensions/api/automation.idl (right): https://codereview.chromium.org/655273005/diff/80001/chrome/common/extensions/api/automation.idl#newcode224 chrome/common/extensions/api/automation.idl:224: dictionary QueryInfo { On 2014/10/31 22:02:07, ...
6 years, 1 month ago (2014-10-31 22:10:53 UTC) #32
Devlin
extensions lgtm https://codereview.chromium.org/655273005/diff/80001/chrome/browser/extensions/api/automation_internal/automation_internal_api.cc File chrome/browser/extensions/api/automation_internal/automation_internal_api.cc (right): https://codereview.chromium.org/655273005/diff/80001/chrome/browser/extensions/api/automation_internal/automation_internal_api.cc#newcode343 chrome/browser/extensions/api/automation_internal/automation_internal_api.cc:343: base::string16 selector = base::UTF8ToUTF16(params->args.selector); #include "base/strings/string16.h" https://codereview.chromium.org/655273005/diff/80001/chrome/test/data/extensions/api_test/automation/tests/tabs/queryselector.js ...
6 years, 1 month ago (2014-10-31 22:11:28 UTC) #33
aboxhall
https://codereview.chromium.org/655273005/diff/80001/chrome/browser/extensions/api/automation_internal/automation_internal_api.cc File chrome/browser/extensions/api/automation_internal/automation_internal_api.cc (right): https://codereview.chromium.org/655273005/diff/80001/chrome/browser/extensions/api/automation_internal/automation_internal_api.cc#newcode343 chrome/browser/extensions/api/automation_internal/automation_internal_api.cc:343: base::string16 selector = base::UTF8ToUTF16(params->args.selector); On 2014/10/31 22:11:28, Devlin wrote: ...
6 years, 1 month ago (2014-10-31 23:06:49 UTC) #34
palmer
https://codereview.chromium.org/655273005/diff/120001/chrome/browser/extensions/api/automation_internal/automation_internal_api.cc File chrome/browser/extensions/api/automation_internal/automation_internal_api.cc (right): https://codereview.chromium.org/655273005/diff/120001/chrome/browser/extensions/api/automation_internal/automation_internal_api.cc#newcode140 chrome/browser/extensions/api/automation_internal/automation_internal_api.cc:140: void Focus(int32 id) override { rfh_->AccessibilitySetFocus(id); } Are these ...
6 years, 1 month ago (2014-11-01 00:20:48 UTC) #35
aboxhall
https://codereview.chromium.org/655273005/diff/120001/chrome/browser/extensions/api/automation_internal/automation_internal_api.cc File chrome/browser/extensions/api/automation_internal/automation_internal_api.cc (right): https://codereview.chromium.org/655273005/diff/120001/chrome/browser/extensions/api/automation_internal/automation_internal_api.cc#newcode140 chrome/browser/extensions/api/automation_internal/automation_internal_api.cc:140: void Focus(int32 id) override { rfh_->AccessibilitySetFocus(id); } On 2014/11/01 ...
6 years, 1 month ago (2014-11-03 17:27:11 UTC) #36
palmer
> > Are these |id|s the same things as are declared as ints in the ...
6 years, 1 month ago (2014-11-03 20:42:56 UTC) #37
aboxhall
https://codereview.chromium.org/655273005/diff/120001/extensions/common/extension_messages.h File extensions/common/extension_messages.h (right): https://codereview.chromium.org/655273005/diff/120001/extensions/common/extension_messages.h#newcode759 extensions/common/extension_messages.h:759: base::string16 /* selector */) On 2014/11/03 17:27:11, aboxhall wrote: ...
6 years, 1 month ago (2014-11-03 22:35:19 UTC) #38
aboxhall
palmer: ping?
6 years, 1 month ago (2014-11-04 18:02:53 UTC) #39
aboxhall
This is failing to build on linux gn with the message: ninja: error: '../../extensions/renderer/automation_api_helper.cc', needed ...
6 years, 1 month ago (2014-11-04 19:12:10 UTC) #40
Devlin
On 2014/11/04 19:12:10, aboxhall wrote: > This is failing to build on linux gn with ...
6 years, 1 month ago (2014-11-04 19:26:44 UTC) #41
aboxhall
On 2014/11/04 19:26:44, Devlin wrote: > On 2014/11/04 19:12:10, aboxhall wrote: > > This is ...
6 years, 1 month ago (2014-11-04 19:29:41 UTC) #42
palmer
LGTM, but you probably don't want to crash the browser process unnecessarily. https://codereview.chromium.org/655273005/diff/140001/chrome/browser/extensions/api/automation_internal/automation_internal_api.cc File chrome/browser/extensions/api/automation_internal/automation_internal_api.cc ...
6 years, 1 month ago (2014-11-04 19:39:22 UTC) #43
aboxhall
https://codereview.chromium.org/655273005/diff/140001/chrome/browser/extensions/api/automation_internal/automation_internal_api.cc File chrome/browser/extensions/api/automation_internal/automation_internal_api.cc (right): https://codereview.chromium.org/655273005/diff/140001/chrome/browser/extensions/api/automation_internal/automation_internal_api.cc#newcode86 chrome/browser/extensions/api/automation_internal/automation_internal_api.cc:86: CHECK(message.ReadInt(&iter, &message_request_id)); On 2014/11/04 19:39:22, Chromium Palmer wrote: > ...
6 years, 1 month ago (2014-11-04 22:13:49 UTC) #44
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/655273005/200001
6 years, 1 month ago (2014-11-05 17:10:20 UTC) #46
commit-bot: I haz the power
Try jobs failed on following builders: chromium_presubmit on tryserver.chromium.linux (http://build.chromium.org/p/tryserver.chromium.linux/builders/chromium_presubmit/builds/22306)
6 years, 1 month ago (2014-11-05 17:15:37 UTC) #48
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/655273005/220001
6 years, 1 month ago (2014-11-05 17:18:07 UTC) #50
commit-bot: I haz the power
Try jobs failed on following builders: win_gpu_triggered_tests on tryserver.chromium.gpu (http://build.chromium.org/p/tryserver.chromium.gpu/builders/win_gpu_triggered_tests/builds/71888) linux_chromium_rel_ng on tryserver.chromium.linux (http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_rel_ng/builds/3072)
6 years, 1 month ago (2014-11-05 18:31:29 UTC) #52
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/655273005/220001
6 years, 1 month ago (2014-11-05 18:35:51 UTC) #54
commit-bot: I haz the power
Try jobs failed on following builders: linux_chromium_rel_ng on tryserver.chromium.linux (http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_rel_ng/builds/3110)
6 years, 1 month ago (2014-11-05 19:50:16 UTC) #56
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/655273005/260001
6 years, 1 month ago (2014-11-06 01:13:20 UTC) #58
commit-bot: I haz the power
Committed patchset #14 (id:260001)
6 years, 1 month ago (2014-11-06 02:03:19 UTC) #59
commit-bot: I haz the power
6 years, 1 month ago (2014-11-06 02:04:48 UTC) #60
Message was sent while issue was closed.
Patchset 14 (id:??) landed as
https://crrev.com/7abfb3db96dc7d87c9f1282b5fc81328ec9c787c
Cr-Commit-Position: refs/heads/master@{#302944}

Powered by Google App Engine
This is Rietveld 408576698