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

Issue 906493004: Refactoring: de-couple Extensions from "script injection System" [render side]:2 (Closed)

Created:
5 years, 10 months ago by Xi Han
Modified:
5 years, 9 months ago
Reviewers:
Fady Samuel, Devlin, Nico
CC:
chromium-reviews, chromium-apps-reviews_chromium.org, extensions-reviews_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@decouple_brower_isolated_world_1
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

This CL adds routing info for content scripts from <webview>. To support dynamically added/removed content scripts in <webview>, we store these content scripts in the same shared memory where user scripts from declarative content API are stored, but the decision for injection will be made in the render once the url pattern is matched. Since render doesn't need to send IPCs to ask a decision from browser, it makes a precise time injection possible. Special to <webview>, once the content scripts are updated (added/removed), browser will only notify the render process of the given <webview>, rather than all of the renders (which is the case for user scripts). BUG=437566 Committed: https://crrev.com/f853287c95cf818d0b5b02d7f4a6588761096d1c Cr-Commit-Position: refs/heads/master@{#318774} Committed: https://crrev.com/ccff496a48cdf435d59ef79f3fe9ae1e6914ed22 Cr-Commit-Position: refs/heads/master@{#318959}

Patch Set 1 : #

Patch Set 2 : Rebase. #

Total comments: 8

Patch Set 3 : Devlin's comments. #

Patch Set 4 : Fady's comments #

Patch Set 5 : Rebase and remove ConsumerInstanceInfo(id). #

Total comments: 17

Patch Set 6 : Devlin's comments and rebase. #

Total comments: 4

Patch Set 7 : ScriptInjection::CanExecuteOnFrame #

Patch Set 8 : clean up. #

Total comments: 3

Patch Set 9 : resubmit #

Total comments: 6
Unified diffs Side-by-side diffs Delta from patch set Stats (+99 lines, -15 lines) Patch
M extensions/browser/user_script_loader.cc View 1 2 3 4 5 1 chunk +18 lines, -5 lines 1 comment Download
M extensions/common/user_script.h View 1 2 3 4 5 chunks +37 lines, -0 lines 5 comments Download
M extensions/common/user_script.cc View 1 2 3 4 4 chunks +22 lines, -0 lines 0 comments Download
M extensions/renderer/extension_injection_host.cc View 1 2 3 4 5 6 1 chunk +9 lines, -4 lines 0 comments Download
M extensions/renderer/user_script_injector.cc View 1 2 3 4 5 6 2 chunks +13 lines, -6 lines 0 comments Download

Messages

Total messages: 47 (17 generated)
Xi Han
Hi Devlin: Please review all changes, thanks a lot!
5 years, 10 months ago (2015-02-06 21:21:30 UTC) #4
Fady Samuel
https://codereview.chromium.org/906493004/diff/80001/chrome/browser/extensions/user_script_loader.cc File chrome/browser/extensions/user_script_loader.cc (right): https://codereview.chromium.org/906493004/diff/80001/chrome/browser/extensions/user_script_loader.cc#newcode463 chrome/browser/extensions/user_script_loader.cc:463: if (i.GetCurrentValue()->GetID() != render_process_id) { if (is_web_view && i.GetCurrentValue()->GetID() ...
5 years, 10 months ago (2015-02-11 19:08:22 UTC) #7
Devlin
I'm hesitant to review this too much before the dependent patch is done, but a ...
5 years, 10 months ago (2015-02-11 20:29:01 UTC) #8
Xi Han
Hi Devlin: I would like you to review both CLs together, since if you find ...
5 years, 10 months ago (2015-02-11 21:57:24 UTC) #11
Xi Han
https://codereview.chromium.org/906493004/diff/80001/chrome/browser/extensions/user_script_loader.cc File chrome/browser/extensions/user_script_loader.cc (right): https://codereview.chromium.org/906493004/diff/80001/chrome/browser/extensions/user_script_loader.cc#newcode465 chrome/browser/extensions/user_script_loader.cc:465: } else { Adopt Fady's suggestion.
5 years, 10 months ago (2015-02-11 22:06:58 UTC) #12
Devlin
https://codereview.chromium.org/906493004/diff/200001/extensions/common/user_script.h File extensions/common/user_script.h (right): https://codereview.chromium.org/906493004/diff/200001/extensions/common/user_script.h#newcode312 extensions/common/user_script.h:312: // The type of the consumer instance that the ...
5 years, 10 months ago (2015-02-17 18:58:32 UTC) #14
chromium-reviews
As discussed offline, we will keep these routing info in the UserScript for now. Please ...
5 years, 10 months ago (2015-02-18 21:13:34 UTC) #15
Devlin
https://codereview.chromium.org/906493004/diff/200001/chrome/browser/extensions/user_script_loader.cc File chrome/browser/extensions/user_script_loader.cc (right): https://codereview.chromium.org/906493004/diff/200001/chrome/browser/extensions/user_script_loader.cc#newcode449 chrome/browser/extensions/user_script_loader.cc:449: const UserScriptList* scripts = user_scripts.get(); Why cache this, isntead ...
5 years, 10 months ago (2015-02-23 20:15:00 UTC) #16
Fady Samuel
https://codereview.chromium.org/906493004/diff/200001/chrome/browser/extensions/user_script_loader.cc File chrome/browser/extensions/user_script_loader.cc (right): https://codereview.chromium.org/906493004/diff/200001/chrome/browser/extensions/user_script_loader.cc#newcode458 chrome/browser/extensions/user_script_loader.cc:458: for (content::RenderProcessHost::iterator i( On 2015/02/23 20:15:00, Devlin wrote: > ...
5 years, 10 months ago (2015-02-23 20:16:57 UTC) #17
Xi Han
https://codereview.chromium.org/906493004/diff/200001/chrome/browser/extensions/user_script_loader.cc File chrome/browser/extensions/user_script_loader.cc (right): https://codereview.chromium.org/906493004/diff/200001/chrome/browser/extensions/user_script_loader.cc#newcode449 chrome/browser/extensions/user_script_loader.cc:449: const UserScriptList* scripts = user_scripts.get(); On 2015/02/23 20:15:00, Devlin ...
5 years, 9 months ago (2015-02-24 16:19:55 UTC) #21
Devlin
https://codereview.chromium.org/906493004/diff/200001/extensions/renderer/user_script_injector.cc File extensions/renderer/user_script_injector.cc (right): https://codereview.chromium.org/906493004/diff/200001/extensions/renderer/user_script_injector.cc#newcode138 extensions/renderer/user_script_injector.cc:138: if (script_->routing_info().render_view_id == routing_id && On 2015/02/24 16:19:55, Xi ...
5 years, 9 months ago (2015-02-25 17:14:38 UTC) #22
Xi Han
PTAL, thanks! https://codereview.chromium.org/906493004/diff/200001/extensions/renderer/user_script_injector.cc File extensions/renderer/user_script_injector.cc (right): https://codereview.chromium.org/906493004/diff/200001/extensions/renderer/user_script_injector.cc#newcode138 extensions/renderer/user_script_injector.cc:138: if (script_->routing_info().render_view_id == routing_id && On 2015/02/25 ...
5 years, 9 months ago (2015-02-27 19:36:19 UTC) #24
Devlin
https://codereview.chromium.org/906493004/diff/270001/extensions/renderer/script_injection.h File extensions/renderer/script_injection.h (right): https://codereview.chromium.org/906493004/diff/270001/extensions/renderer/script_injection.h#newcode93 extensions/renderer/script_injection.h:93: On 2015/02/27 19:36:19, Xi Han wrote: > On 2015/02/25 ...
5 years, 9 months ago (2015-02-27 21:52:43 UTC) #25
Xi Han
https://codereview.chromium.org/906493004/diff/270001/extensions/renderer/script_injection.h File extensions/renderer/script_injection.h (right): https://codereview.chromium.org/906493004/diff/270001/extensions/renderer/script_injection.h#newcode93 extensions/renderer/script_injection.h:93: On 2015/02/27 21:52:42, Devlin wrote: > On 2015/02/27 19:36:19, ...
5 years, 9 months ago (2015-02-27 22:10:02 UTC) #27
Devlin
https://codereview.chromium.org/906493004/diff/350001/extensions/renderer/user_script_injector.cc File extensions/renderer/user_script_injector.cc (right): https://codereview.chromium.org/906493004/diff/350001/extensions/renderer/user_script_injector.cc#newcode137 extensions/renderer/user_script_injector.cc:137: UserScript::ConsumerInstanceType::WEBVIEW || This seems very wrong. Why are we ...
5 years, 9 months ago (2015-03-02 20:22:42 UTC) #28
Xi Han
https://codereview.chromium.org/906493004/diff/350001/extensions/renderer/user_script_injector.cc File extensions/renderer/user_script_injector.cc (right): https://codereview.chromium.org/906493004/diff/350001/extensions/renderer/user_script_injector.cc#newcode137 extensions/renderer/user_script_injector.cc:137: UserScript::ConsumerInstanceType::WEBVIEW || On 2015/03/02 20:22:42, Devlin wrote: > This ...
5 years, 9 months ago (2015-03-02 20:30:17 UTC) #29
Devlin
lgtm https://codereview.chromium.org/906493004/diff/350001/extensions/renderer/user_script_injector.cc File extensions/renderer/user_script_injector.cc (right): https://codereview.chromium.org/906493004/diff/350001/extensions/renderer/user_script_injector.cc#newcode137 extensions/renderer/user_script_injector.cc:137: UserScript::ConsumerInstanceType::WEBVIEW || On 2015/03/02 20:30:17, Xi Han wrote: ...
5 years, 9 months ago (2015-03-02 21:08:14 UTC) #30
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/906493004/350001
5 years, 9 months ago (2015-03-02 21:16:06 UTC) #32
commit-bot: I haz the power
Committed patchset #8 (id:350001)
5 years, 9 months ago (2015-03-02 22:34:00 UTC) #33
commit-bot: I haz the power
Patchset 8 (id:??) landed as https://crrev.com/f853287c95cf818d0b5b02d7f4a6588761096d1c Cr-Commit-Position: refs/heads/master@{#318774}
5 years, 9 months ago (2015-03-02 22:35:25 UTC) #34
cpu_(ooo_6.6-7.5)
A revert of this CL (patchset #8 id:350001) has been created in https://codereview.chromium.org/972863002/ by cpu@chromium.org. ...
5 years, 9 months ago (2015-03-03 00:48:28 UTC) #35
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/906493004/370001
5 years, 9 months ago (2015-03-03 21:38:19 UTC) #38
Devlin
On 2015/03/03 21:38:19, I haz the power (commit-bot) wrote: > CQ is trying da patch. ...
5 years, 9 months ago (2015-03-03 21:42:54 UTC) #39
commit-bot: I haz the power
Committed patchset #9 (id:370001)
5 years, 9 months ago (2015-03-03 23:14:17 UTC) #40
commit-bot: I haz the power
Patchset 9 (id:??) landed as https://crrev.com/ccff496a48cdf435d59ef79f3fe9ae1e6914ed22 Cr-Commit-Position: refs/heads/master@{#318959}
5 years, 9 months ago (2015-03-03 23:14:51 UTC) #41
Nico
On 2015/03/03 21:42:54, Devlin wrote: > On 2015/03/03 21:38:19, I haz the power (commit-bot) wrote: ...
5 years, 9 months ago (2015-03-04 15:31:30 UTC) #42
Nico
https://codereview.chromium.org/906493004/diff/370001/extensions/common/user_script.h File extensions/common/user_script.h (right): https://codereview.chromium.org/906493004/diff/370001/extensions/common/user_script.h#newcode132 extensions/common/user_script.h:132: RoutingInfo() : render_process_id(-1), render_view_id(-1) {}; nit: no ';' after ...
5 years, 9 months ago (2015-03-04 15:35:02 UTC) #44
Nico
https://codereview.chromium.org/906493004/diff/370001/extensions/browser/user_script_loader.cc File extensions/browser/user_script_loader.cc (right): https://codereview.chromium.org/906493004/diff/370001/extensions/browser/user_script_loader.cc#newcode447 extensions/browser/user_script_loader.cc:447: // If user scripts are comming from a <webview>, ...
5 years, 9 months ago (2015-03-05 00:40:11 UTC) #45
Devlin
https://codereview.chromium.org/906493004/diff/370001/extensions/common/user_script.h File extensions/common/user_script.h (right): https://codereview.chromium.org/906493004/diff/370001/extensions/common/user_script.h#newcode316 extensions/common/user_script.h:316: RoutingInfo routing_info_; On 2015/03/05 00:40:11, Nico wrote: > You ...
5 years, 9 months ago (2015-03-05 00:42:49 UTC) #46
Nico
5 years, 9 months ago (2015-03-05 00:45:10 UTC) #47
Message was sent while issue was closed.
https://codereview.chromium.org/906493004/diff/370001/extensions/common/user_...
File extensions/common/user_script.h (right):

https://codereview.chromium.org/906493004/diff/370001/extensions/common/user_...
extensions/common/user_script.h:316: RoutingInfo routing_info_;
On 2015/03/05 00:42:49, Devlin wrote:
> On 2015/03/05 00:40:11, Nico wrote:
> > You don't initialize this in the constructor, which causes brokenness.
Please
> > fix. Initializing this to TAB fixes the clang/win issues.
> > 
> > Also consider covering some of this logic by unit tests.
> > 
> > DrMemory didn't find this because this apparently is only covered by
> > browser_tests, which seem to not run on DrMemory (probably too slow).
> > 
> > I should probably write a clang diag that warns on some fields not getting
set
> 
> 
> This comment refers to the variable on line 313. :)

Duh, yes, sorry :-(

Powered by Google App Engine
This is Rietveld 408576698