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

Issue 321993003: Refactor renderer-side script injection (Closed)

Created:
6 years, 6 months ago by Devlin
Modified:
6 years, 6 months ago
CC:
chromium-reviews, chromium-apps-reviews_chromium.org, extensions-reviews_chromium.org
Visibility:
Public.

Description

Refactor renderer-side script injection. Instead of having two script injection systems (UserScriptScheduler and UserScriptSlave), we have a single system (ScriptInjectionManager). Introduce abstract ScriptInjection class as an object which knows how to inject itself and whether or not it is allowed, with two implementations (UserScriptInjection and ProgrammaticScriptInjection). Primary benefit: Combine logic for script injections so that a) it's all in one place, b) when we ask for permission, we can do so analogously. Additional benefits: - Reduce dependency of script injection on ExtensionHelper. - Eliminate ScriptInjection dependency on UserScriptSlave (or ScriptInjectionManager). BUG=382945 TBR=jschuh@chromium.org (name changes to extension_messages.h, no functional changes) TBR=jochen@chromium.org (two-line change to chrome/renderer/chrome_content_renderer_client.cc) Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=279183

Patch Set 1 : #

Total comments: 7

Patch Set 2 : Browser test fixes #

Total comments: 13

Patch Set 3 : ScriptInjectionManager : RenderProcessObserver #

Patch Set 4 : Kalman 2 #

Total comments: 8

Patch Set 5 : #

Total comments: 6

Patch Set 6 : Missing files #

Total comments: 18

Patch Set 7 : #

Total comments: 12

Patch Set 8 : #

Patch Set 9 : Latest master #

Patch Set 10 : Test fix #

Patch Set 11 : #

Patch Set 12 : Latest master #

Unified diffs Side-by-side diffs Delta from patch set Stats (+1544 lines, -1356 lines) Patch
M chrome/browser/extensions/active_script_controller.h View 1 chunk +5 lines, -5 lines 0 comments Download
M chrome/browser/extensions/active_script_controller.cc View 2 chunks +8 lines, -9 lines 0 comments Download
M chrome/renderer/chrome_content_renderer_client.cc View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +1 line, -0 lines 0 comments Download
M chrome/renderer/extensions/chrome_v8_context.cc View 1 2 3 4 5 6 7 8 1 chunk +0 lines, -11 lines 0 comments Download
M extensions/common/extension_messages.h View 1 2 3 4 5 6 1 chunk +5 lines, -6 lines 0 comments Download
M extensions/extensions.gyp View 1 2 3 4 5 6 7 8 9 10 11 2 chunks +8 lines, -4 lines 0 comments Download
M extensions/renderer/dispatcher.h View 1 2 3 4 5 6 7 chunks +20 lines, -8 lines 0 comments Download
M extensions/renderer/dispatcher.cc View 1 2 3 4 5 6 7 8 9 9 chunks +22 lines, -28 lines 0 comments Download
M extensions/renderer/extension_helper.h View 3 chunks +0 lines, -9 lines 0 comments Download
M extensions/renderer/extension_helper.cc View 1 2 3 4 9 chunks +0 lines, -92 lines 0 comments Download
A extensions/renderer/programmatic_script_injection.h View 1 2 3 4 5 6 1 chunk +60 lines, -0 lines 0 comments Download
A extensions/renderer/programmatic_script_injection.cc View 1 2 3 4 5 6 7 8 9 10 1 chunk +217 lines, -0 lines 0 comments Download
M extensions/renderer/resources/messaging.js View 1 2 3 4 5 1 chunk +1 line, -4 lines 0 comments Download
M extensions/renderer/script_injection.h View 1 2 3 4 5 6 7 8 9 10 2 chunks +54 lines, -87 lines 0 comments Download
M extensions/renderer/script_injection.cc View 1 2 3 4 2 chunks +52 lines, -314 lines 0 comments Download
A extensions/renderer/script_injection_manager.h View 1 2 3 4 5 6 7 8 9 1 chunk +103 lines, -0 lines 0 comments Download
A extensions/renderer/script_injection_manager.cc View 1 2 3 4 5 6 7 8 9 1 chunk +351 lines, -0 lines 0 comments Download
A extensions/renderer/user_script_injection.h View 1 2 3 4 5 6 7 8 1 chunk +80 lines, -0 lines 0 comments Download
A extensions/renderer/user_script_injection.cc View 1 2 3 4 5 6 1 chunk +239 lines, -0 lines 0 comments Download
D extensions/renderer/user_script_scheduler.h View 1 chunk +0 lines, -95 lines 0 comments Download
D extensions/renderer/user_script_scheduler.cc View 1 chunk +0 lines, -281 lines 0 comments Download
A extensions/renderer/user_script_set.h View 1 2 3 4 5 6 7 1 chunk +100 lines, -0 lines 0 comments Download
A extensions/renderer/user_script_set.cc View 1 2 3 4 5 6 1 chunk +218 lines, -0 lines 0 comments Download
D extensions/renderer/user_script_slave.h View 1 chunk +0 lines, -105 lines 0 comments Download
D extensions/renderer/user_script_slave.cc View 1 chunk +0 lines, -298 lines 0 comments Download

Messages

Total messages: 18 (0 generated)
Devlin
Ben, please take a look. It might be a bit rough, but should be mostly ...
6 years, 6 months ago (2014-06-10 16:52:00 UTC) #1
not at google - send to devlin
Here are my comments from the first patchset. I'll continue reviewing on the new patchset. ...
6 years, 6 months ago (2014-06-11 18:26:30 UTC) #2
not at google - send to devlin
sending out another small number of comments awaiting the next patchset. https://codereview.chromium.org/321993003/diff/60001/extensions/renderer/script_injection_manager.cc File extensions/renderer/script_injection_manager.cc (right): ...
6 years, 6 months ago (2014-06-11 20:21:27 UTC) #3
Devlin
https://codereview.chromium.org/321993003/diff/20001/extensions/renderer/dispatcher.cc File extensions/renderer/dispatcher.cc (right): https://codereview.chromium.org/321993003/diff/20001/extensions/renderer/dispatcher.cc#newcode789 extensions/renderer/dispatcher.cc:789: script_injection_manager_->UpdateUserScripts(scripts, extension_ids); On 2014/06/11 18:26:29, kalman wrote: > It ...
6 years, 6 months ago (2014-06-11 20:26:13 UTC) #4
Mark Dittmer
https://codereview.chromium.org/321993003/diff/20001/extensions/renderer/user_script_injection_list.h File extensions/renderer/user_script_injection_list.h (right): https://codereview.chromium.org/321993003/diff/20001/extensions/renderer/user_script_injection_list.h#newcode49 extensions/renderer/user_script_injection_list.h:49: void GetInjections(ScopedVector<ScriptInjection>* injections, nit: Injections appears to be an ...
6 years, 6 months ago (2014-06-11 20:47:56 UTC) #5
not at google - send to devlin
gotta run, 2 more comments, will review more when I'm back after meetings https://codereview.chromium.org/321993003/diff/120001/extensions/renderer/script_injection.h File ...
6 years, 6 months ago (2014-06-11 20:57:50 UTC) #6
Devlin
https://codereview.chromium.org/321993003/diff/60001/extensions/renderer/script_injection_manager.cc File extensions/renderer/script_injection_manager.cc (right): https://codereview.chromium.org/321993003/diff/60001/extensions/renderer/script_injection_manager.cc#newcode222 extensions/renderer/script_injection_manager.cc:222: // Should we be including extensions we know are ...
6 years, 6 months ago (2014-06-11 21:40:42 UTC) #7
Devlin
https://codereview.chromium.org/321993003/diff/120001/extensions/renderer/script_injection.h File extensions/renderer/script_injection.h (right): https://codereview.chromium.org/321993003/diff/120001/extensions/renderer/script_injection.h#newcode73 extensions/renderer/script_injection.h:73: virtual bool Allowed(const Extension* extension) = 0; On 2014/06/11 ...
6 years, 6 months ago (2014-06-11 21:40:43 UTC) #8
Devlin
https://codereview.chromium.org/321993003/diff/120001/extensions/renderer/script_injection.h File extensions/renderer/script_injection.h (right): https://codereview.chromium.org/321993003/diff/120001/extensions/renderer/script_injection.h#newcode73 extensions/renderer/script_injection.h:73: virtual bool Allowed(const Extension* extension) = 0; On 2014/06/11 ...
6 years, 6 months ago (2014-06-12 15:41:02 UTC) #9
Devlin
Ben, take a look at this one. UserScriptInjections now update their script references by themselves, ...
6 years, 6 months ago (2014-06-12 21:24:56 UTC) #10
not at google - send to devlin
sorry this took so long. have some suggestions, trying to keep them as noninvasive as ...
6 years, 6 months ago (2014-06-15 23:53:38 UTC) #11
Devlin
Not sure I like what making the TryToInject() method did to the ScriptInjection classes. Let ...
6 years, 6 months ago (2014-06-16 18:11:17 UTC) #12
not at google - send to devlin
lgtm, minor comments left. I requested a few places for more detailed comments. I think ...
6 years, 6 months ago (2014-06-16 21:35:50 UTC) #13
Devlin
Ben, please take a quick look at the changes to ScriptInjectionManager from 9 to 10. ...
6 years, 6 months ago (2014-06-18 18:57:06 UTC) #14
not at google - send to devlin
lgtm
6 years, 6 months ago (2014-06-18 18:59:33 UTC) #15
Devlin
The CQ bit was checked by rdevlin.cronin@chromium.org
6 years, 6 months ago (2014-06-23 18:28:53 UTC) #16
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/rdevlin.cronin@chromium.org/321993003/270001
6 years, 6 months ago (2014-06-23 18:29:32 UTC) #17
commit-bot: I haz the power
6 years, 6 months ago (2014-06-23 21:44:28 UTC) #18
Message was sent while issue was closed.
Change committed as 279183

Powered by Google App Engine
This is Rietveld 408576698