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

Issue 23478003: Check and canonicalize CSS selectors before registering PageStateMatchers. (Closed)

Created:
7 years, 3 months ago by Jeffrey Yasskin
Modified:
7 years, 3 months ago
CC:
chromium-reviews, joi+watch-content_chromium.org, darin-cc_chromium.org, jam, extensions-reviews_chromium.org, chromium-apps-reviews_chromium.org
Visibility:
Public.

Description

Check and canonicalize CSS selectors before registering PageStateMatchers. Checking the selectors here gives error messages when a developer has a typo instead of just failing to match anything. Canonicalizing the selectors improves compatibility with the upcoming Blink watchSelectors API, which will send back generated selector strings instead of exactly what the user set. I also added support in our testing infrastructure to assert that a thrown exception's message matches a regular expression. BUG=172011 Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=220487

Patch Set 1 #

Total comments: 17

Patch Set 2 : Use WebKit::canonicalizeSelector() instead of CSSStyleRule.selectorText #

Total comments: 22

Patch Set 3 : Fix problems kalman noticed #

Total comments: 3
Unified diffs Side-by-side diffs Delta from patch set Stats (+153 lines, -3 lines) Patch
M chrome/browser/extensions/api/declarative_content/declarative_content_apitest.cc View 1 2 1 chunk +58 lines, -0 lines 0 comments Download
M chrome/chrome_renderer.gypi View 1 2 1 chunk +2 lines, -0 lines 0 comments Download
M chrome/common/extensions/api/test.json View 1 2 1 chunk +1 line, -1 line 0 comments Download
A chrome/renderer/extensions/css_native_handler.h View 1 2 1 chunk +27 lines, -0 lines 0 comments Download
A chrome/renderer/extensions/css_native_handler.cc View 1 2 1 chunk +35 lines, -0 lines 3 comments Download
M chrome/renderer/extensions/dispatcher.cc View 1 2 2 chunks +3 lines, -0 lines 0 comments Download
M chrome/renderer/resources/extensions/declarative_content_custom_bindings.js View 1 2 2 chunks +18 lines, -0 lines 0 comments Download
M chrome/renderer/resources/extensions/test_custom_bindings.js View 1 2 1 chunk +8 lines, -2 lines 0 comments Download
M tools/json_schema_compiler/model.py View 1 2 1 chunk +1 line, -0 lines 0 comments Download

Messages

Total messages: 15 (0 generated)
Jeffrey Yasskin
The Blink change this helps with is https://codereview.chromium.org/18371008/. +Adam and Elliott to see if they ...
7 years, 3 months ago (2013-08-26 22:35:19 UTC) #1
not at google - send to devlin
"Adam and Elliott to see if they prefer a new Blink API for this" as ...
7 years, 3 months ago (2013-08-27 01:46:14 UTC) #2
Jeffrey Yasskin
https://codereview.chromium.org/23478003/diff/1/chrome/browser/extensions/api/declarative_content/declarative_content_apitest.cc File chrome/browser/extensions/api/declarative_content/declarative_content_apitest.cc (right): https://codereview.chromium.org/23478003/diff/1/chrome/browser/extensions/api/declarative_content/declarative_content_apitest.cc#newcode123 chrome/browser/extensions/api/declarative_content/declarative_content_apitest.cc:123: " var psm = new PageStateMatcher(\n" On 2013/08/27 01:46:14, ...
7 years, 3 months ago (2013-08-27 19:09:48 UTC) #3
not at google - send to devlin
https://codereview.chromium.org/23478003/diff/1/chrome/browser/extensions/api/declarative_content/declarative_content_apitest.cc File chrome/browser/extensions/api/declarative_content/declarative_content_apitest.cc (right): https://codereview.chromium.org/23478003/diff/1/chrome/browser/extensions/api/declarative_content/declarative_content_apitest.cc#newcode123 chrome/browser/extensions/api/declarative_content/declarative_content_apitest.cc:123: " var psm = new PageStateMatcher(\n" On 2013/08/27 19:09:48, ...
7 years, 3 months ago (2013-08-27 19:39:53 UTC) #4
Jeffrey Yasskin
https://codereview.chromium.org/23478003/diff/1/chrome/renderer/resources/extensions/declarative_content_custom_bindings.js File chrome/renderer/resources/extensions/declarative_content_custom_bindings.js (right): https://codereview.chromium.org/23478003/diff/1/chrome/renderer/resources/extensions/declarative_content_custom_bindings.js#newcode41 chrome/renderer/resources/extensions/declarative_content_custom_bindings.js:41: document.body.appendChild(div); On 2013/08/27 19:09:48, Jeffrey Yasskin wrote: > Adding ...
7 years, 3 months ago (2013-08-29 03:39:38 UTC) #5
not at google - send to devlin
https://codereview.chromium.org/23478003/diff/1/chrome/renderer/resources/extensions/test_custom_bindings.js File chrome/renderer/resources/extensions/test_custom_bindings.js (right): https://codereview.chromium.org/23478003/diff/1/chrome/renderer/resources/extensions/test_custom_bindings.js#newcode238 chrome/renderer/resources/extensions/test_custom_bindings.js:238: if (e !== failureException && message !== undefined) On ...
7 years, 3 months ago (2013-08-29 15:20:25 UTC) #6
Jeffrey Yasskin
Thanks for teaching me javascript. :) https://codereview.chromium.org/23478003/diff/1/chrome/renderer/resources/extensions/test_custom_bindings.js File chrome/renderer/resources/extensions/test_custom_bindings.js (right): https://codereview.chromium.org/23478003/diff/1/chrome/renderer/resources/extensions/test_custom_bindings.js#newcode238 chrome/renderer/resources/extensions/test_custom_bindings.js:238: if (e !== ...
7 years, 3 months ago (2013-08-29 21:46:42 UTC) #7
not at google - send to devlin
lgtm https://codereview.chromium.org/23478003/diff/18001/chrome/browser/extensions/api/declarative_content/declarative_content_apitest.cc File chrome/browser/extensions/api/declarative_content/declarative_content_apitest.cc (right): https://codereview.chromium.org/23478003/diff/18001/chrome/browser/extensions/api/declarative_content/declarative_content_apitest.cc#newcode147 chrome/browser/extensions/api/declarative_content/declarative_content_apitest.cc:147: " /compound selector.*: div input$/);\n" On 2013/08/29 21:46:43, ...
7 years, 3 months ago (2013-08-29 22:24:03 UTC) #8
not at google - send to devlin
lgtm
7 years, 3 months ago (2013-08-29 22:24:55 UTC) #9
Jeffrey Yasskin
https://codereview.chromium.org/23478003/diff/28001/chrome/renderer/extensions/css_native_handler.cc File chrome/renderer/extensions/css_native_handler.cc (right): https://codereview.chromium.org/23478003/diff/28001/chrome/renderer/extensions/css_native_handler.cc#newcode29 chrome/renderer/extensions/css_native_handler.cc:29: WebString output_selector = WebKit::canonicalizeSelector( On 2013/08/29 22:24:04, kalman wrote: ...
7 years, 3 months ago (2013-08-29 23:18:49 UTC) #10
not at google - send to devlin
https://codereview.chromium.org/23478003/diff/28001/chrome/renderer/extensions/css_native_handler.cc File chrome/renderer/extensions/css_native_handler.cc (right): https://codereview.chromium.org/23478003/diff/28001/chrome/renderer/extensions/css_native_handler.cc#newcode29 chrome/renderer/extensions/css_native_handler.cc:29: WebString output_selector = WebKit::canonicalizeSelector( On 2013/08/29 23:18:49, Jeffrey Yasskin ...
7 years, 3 months ago (2013-08-29 23:24:29 UTC) #11
not at google - send to devlin
(as in I didn't think to look in the header file, I'm sure that's fine)
7 years, 3 months ago (2013-08-29 23:24:48 UTC) #12
Jeffrey Yasskin
On 2013/08/29 23:24:29, kalman wrote: > https://codereview.chromium.org/23478003/diff/28001/chrome/renderer/extensions/css_native_handler.cc > File chrome/renderer/extensions/css_native_handler.cc (right): > > https://codereview.chromium.org/23478003/diff/28001/chrome/renderer/extensions/css_native_handler.cc#newcode29 > ...
7 years, 3 months ago (2013-08-29 23:26:27 UTC) #13
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/jyasskin@chromium.org/23478003/28001
7 years, 3 months ago (2013-08-29 23:27:19 UTC) #14
commit-bot: I haz the power
7 years, 3 months ago (2013-08-30 02:38:11 UTC) #15
Message was sent while issue was closed.
Change committed as 220487

Powered by Google App Engine
This is Rietveld 408576698