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

Issue 794803002: Refactor: cleanup declarative_api.cc. (Closed)

Created:
6 years ago by Xi Han
Modified:
6 years ago
CC:
chromium-reviews, chromium-apps-reviews_chromium.org, extensions-reviews_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Refactor: cleanup declarative_api.cc and get rid of "webViewIntanal" prefix when passing declarative webRequest Event from <webview>. When <webview> call an API, the event that passes to the browser will keep its original name. For example, "declarativeWebRequest.onMessage". With this patch, we don't need to add the "webViewIntanal" prefix when creating an event, and remove the prefix when browser receive it. However, this would cause a problem: you cannot tell whether this event comes from <webview> or regular tabs simply from its name. So the event will be treated as a regular API event rather than a <webview> event, and fails when doing feature permission checks if <webview> calls declarativeWebRequest API from a chrome app. In this CL, web_view_instance_id is passed along during event registry to bypass the feature permission checks. BUG=437566 Committed: https://crrev.com/b684c7ada5434b1954cced5e13a9d91ba88de6cd Cr-Commit-Position: refs/heads/master@{#309017}

Patch Set 1 #

Patch Set 2 : Pass webViewInstanceId when attachEvent (in event.js) to avoid permission check. #

Total comments: 4

Patch Set 3 : nits #

Patch Set 4 : #

Total comments: 10

Patch Set 5 : nits. #

Patch Set 6 : Clean up. #

Total comments: 12

Patch Set 7 : Update based on kalman@'s comments. #

Patch Set 8 : #

Total comments: 2

Patch Set 9 : Add "webViewInternal" back to event name. #

Total comments: 6

Patch Set 10 : kalman's comments #

Unified diffs Side-by-side diffs Delta from patch set Stats (+19 lines, -35 lines) Patch
M extensions/browser/api/declarative/declarative_api.cc View 1 2 3 4 5 6 7 8 9 3 chunks +18 lines, -34 lines 0 comments Download
M extensions/renderer/resources/guest_view/web_view_events.js View 1 2 3 4 5 6 7 8 9 1 chunk +1 line, -1 line 0 comments Download

Messages

Total messages: 40 (15 generated)
Xi Han
6 years ago (2014-12-11 15:34:56 UTC) #4
Fady Samuel
lgtm + nits. Please add kalman@ to this CL to get his thoughts. https://codereview.chromium.org/794803002/diff/60001/extensions/renderer/event_bindings.cc File ...
6 years ago (2014-12-11 15:39:09 UTC) #5
Xi Han
kalman@chromium.org: Please review all changes, thanks! https://codereview.chromium.org/794803002/diff/60001/extensions/renderer/event_bindings.cc File extensions/renderer/event_bindings.cc (right): https://codereview.chromium.org/794803002/diff/60001/extensions/renderer/event_bindings.cc#newcode173 extensions/renderer/event_bindings.cc:173: int web_view_instance_id = ...
6 years ago (2014-12-11 16:20:06 UTC) #7
not at google - send to devlin
https://codereview.chromium.org/794803002/diff/120001/extensions/browser/api/declarative/declarative_api.cc File extensions/browser/api/declarative/declarative_api.cc (right): https://codereview.chromium.org/794803002/diff/120001/extensions/browser/api/declarative/declarative_api.cc#newcode104 extensions/browser/api/declarative/declarative_api.cc:104: int web_view_instance_id = 0; I think this is a ...
6 years ago (2014-12-11 22:10:48 UTC) #9
Xi Han
https://codereview.chromium.org/794803002/diff/120001/extensions/browser/api/declarative/declarative_api.cc File extensions/browser/api/declarative/declarative_api.cc (right): https://codereview.chromium.org/794803002/diff/120001/extensions/browser/api/declarative/declarative_api.cc#newcode104 extensions/browser/api/declarative/declarative_api.cc:104: int web_view_instance_id = 0; On 2014/12/11 22:10:48, kalman wrote: ...
6 years ago (2014-12-12 22:28:30 UTC) #10
not at google - send to devlin
Again, I had an old comment sitting around, so sending that out. The more important ...
6 years ago (2014-12-15 04:24:30 UTC) #11
not at google - send to devlin
On 2014/12/12 22:28:30, hanxi wrote: > https://codereview.chromium.org/794803002/diff/120001/extensions/browser/api/declarative/declarative_api.cc > File extensions/browser/api/declarative/declarative_api.cc (right): > > https://codereview.chromium.org/794803002/diff/120001/extensions/browser/api/declarative/declarative_api.cc#newcode104 > ...
6 years ago (2014-12-15 04:27:39 UTC) #12
Xi Han
kalman@: I applied your patch (https://codereview.chromium.org/802653003) and this still works. The web pages (html files) ...
6 years ago (2014-12-15 17:17:57 UTC) #13
Xi Han
Hi Ken: kalman is on vacation, could you please help me to take a look ...
6 years ago (2014-12-15 18:47:14 UTC) #15
Ken Rockot(use gerrit already)
lgtm
6 years ago (2014-12-15 18:59:57 UTC) #16
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/794803002/160001
6 years ago (2014-12-15 19:04:42 UTC) #18
not at google - send to devlin
I'm not on vacation, please wait On Dec 16, 2014 6:04 AM, <commit-bot@chromium.org> wrote: > ...
6 years ago (2014-12-15 20:29:07 UTC) #19
not at google - send to devlin
On 2014/12/15 17:17:57, hanxi wrote: > kalman@: I applied your patch (https://codereview.chromium.org/802653003) and > this ...
6 years ago (2014-12-15 23:49:48 UTC) #21
not at google - send to devlin
https://codereview.chromium.org/794803002/diff/160001/extensions/browser/api/declarative/declarative_api.cc File extensions/browser/api/declarative/declarative_api.cc (right): https://codereview.chromium.org/794803002/diff/160001/extensions/browser/api/declarative/declarative_api.cc#newcode97 extensions/browser/api/declarative/declarative_api.cc:97: source_context_type_ = Feature::BLESSED_EXTENSION_CONTEXT; This looks very wrong, it's supposed ...
6 years ago (2014-12-15 23:49:57 UTC) #22
Xi Han
Hi Ben: If the network request can match all the criteria (e.g., url pattern) and ...
6 years ago (2014-12-16 19:05:27 UTC) #27
not at google - send to devlin
https://codereview.chromium.org/794803002/diff/280001/extensions/browser/api/declarative/declarative_api.cc File extensions/browser/api/declarative/declarative_api.cc (right): https://codereview.chromium.org/794803002/diff/280001/extensions/browser/api/declarative/declarative_api.cc#newcode117 extensions/browser/api/declarative/declarative_api.cc:117: Feature::BLESSED_EXTENSION_CONTEXT, But why does this only check blessed contexts?
6 years ago (2014-12-17 04:06:42 UTC) #28
not at google - send to devlin
On 2014/12/16 19:05:27, hanxi wrote: > Hi Ben: > If the network request can match ...
6 years ago (2014-12-17 04:13:29 UTC) #29
Xi Han
On 2014/12/17 04:13:29, kalman wrote: > On 2014/12/16 19:05:27, hanxi wrote: > > Hi Ben: ...
6 years ago (2014-12-17 15:02:29 UTC) #30
Xi Han
https://codereview.chromium.org/794803002/diff/280001/extensions/browser/api/declarative/declarative_api.cc File extensions/browser/api/declarative/declarative_api.cc (right): https://codereview.chromium.org/794803002/diff/280001/extensions/browser/api/declarative/declarative_api.cc#newcode117 extensions/browser/api/declarative/declarative_api.cc:117: Feature::BLESSED_EXTENSION_CONTEXT, On 2014/12/17 04:06:42, kalman wrote: > But why ...
6 years ago (2014-12-17 15:02:43 UTC) #31
Xi Han
Please take a look this simple solution first.Thanks!
6 years ago (2014-12-17 22:34:07 UTC) #32
not at google - send to devlin
lgtm, let's get this committed. with comments. https://codereview.chromium.org/794803002/diff/300001/extensions/browser/api/declarative/declarative_api.cc File extensions/browser/api/declarative/declarative_api.cc (right): https://codereview.chromium.org/794803002/diff/300001/extensions/browser/api/declarative/declarative_api.cc#newcode110 extensions/browser/api/declarative/declarative_api.cc:110: // permission, ...
6 years ago (2014-12-18 06:24:27 UTC) #33
Xi Han
https://codereview.chromium.org/794803002/diff/300001/extensions/browser/api/declarative/declarative_api.cc File extensions/browser/api/declarative/declarative_api.cc (right): https://codereview.chromium.org/794803002/diff/300001/extensions/browser/api/declarative/declarative_api.cc#newcode110 extensions/browser/api/declarative/declarative_api.cc:110: // permission, this function will return true to allow ...
6 years ago (2014-12-18 15:25:41 UTC) #36
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/794803002/340001
6 years ago (2014-12-18 15:26:12 UTC) #38
commit-bot: I haz the power
Committed patchset #10 (id:340001)
6 years ago (2014-12-18 16:18:59 UTC) #39
commit-bot: I haz the power
6 years ago (2014-12-18 18:05:21 UTC) #40
Message was sent while issue was closed.
Patchset 10 (id:??) landed as
https://crrev.com/b684c7ada5434b1954cced5e13a9d91ba88de6cd
Cr-Commit-Position: refs/heads/master@{#309017}

Powered by Google App Engine
This is Rietveld 408576698