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

Issue 2116613002: Prevent duplicate content script injection defined in manifest.json (Closed)

Created:
4 years, 5 months ago by catmullings
Modified:
4 years, 4 months ago
Reviewers:
Devlin
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

Keeps track of scripts injected by extensions installed. Checks if a script is already injected, and injects a script only if it has not been injected. BUG=248627 TEST= Run target browser_tests with --gtest_filter="ExtensionApiTest.ContentScript*" Committed: https://crrev.com/90d8dd145246616da02f5a54f1da1f5bfe6680e9 Cr-Commit-Position: refs/heads/master@{#407016}

Patch Set 1 #

Patch Set 2 : Tests Added #

Total comments: 25

Patch Set 3 : Addressed code review comments #

Total comments: 12

Patch Set 4 : Addressed code review comments on patch 3 #

Total comments: 3

Patch Set 5 : Addressed code review comments from patch 4 #

Total comments: 6

Patch Set 6 : Addressed code review comments on patch 5 #

Patch Set 7 : Minor followup fix to patch 5 #

Total comments: 10

Patch Set 8 : Addressed code review comments from patch 7 #

Total comments: 10

Patch Set 9 : Addressed code review on patch 8 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+118 lines, -29 lines) Patch
M chrome/browser/extensions/content_script_apitest.cc View 1 2 3 4 5 6 7 1 chunk +37 lines, -0 lines 0 comments Download
A chrome/test/data/extensions/api_test/content_scripts/duplicate_script_injection/manifest.json View 1 2 3 4 5 6 7 1 chunk +24 lines, -0 lines 0 comments Download
A + chrome/test/data/extensions/api_test/content_scripts/duplicate_script_injection/should_run_once.js View 1 2 3 4 5 6 7 8 1 chunk +3 lines, -9 lines 0 comments Download
A chrome/test/data/extensions/api_test/content_scripts/duplicate_script_injection/should_run_twice.js View 1 2 3 4 5 6 7 8 1 chunk +7 lines, -0 lines 0 comments Download
M extensions/renderer/programmatic_script_injector.h View 1 2 3 4 5 6 7 8 1 chunk +4 lines, -2 lines 0 comments Download
M extensions/renderer/programmatic_script_injector.cc View 1 2 2 chunks +4 lines, -2 lines 0 comments Download
M extensions/renderer/script_injection.h View 1 chunk +2 lines, -2 lines 0 comments Download
M extensions/renderer/script_injection.cc View 3 chunks +6 lines, -6 lines 0 comments Download
M extensions/renderer/script_injector.h View 1 chunk +4 lines, -2 lines 0 comments Download
M extensions/renderer/scripts_run_info.h View 1 2 3 1 chunk +2 lines, -0 lines 0 comments Download
M extensions/renderer/user_script_injector.h View 1 chunk +4 lines, -2 lines 0 comments Download
M extensions/renderer/user_script_injector.cc View 1 2 3 4 5 6 7 8 5 chunks +21 lines, -4 lines 0 comments Download

Messages

Total messages: 31 (10 generated)
catmullings
4 years, 5 months ago (2016-06-30 19:13:43 UTC) #2
Devlin
I don't see any glaring issues here; it seems like the right solution. :) Go ...
4 years, 5 months ago (2016-07-01 00:33:46 UTC) #3
catmullings
Test added. Let me know if this test is sufficient.
4 years, 5 months ago (2016-07-11 23:30:02 UTC) #4
Devlin
Overall, test looks pretty solid! There were also a few comments similar to your first ...
4 years, 5 months ago (2016-07-11 23:45:50 UTC) #5
catmullings
Addressed comments in code review. https://codereview.chromium.org/2116613002/diff/20001/chrome/browser/extensions/content_script_apitest.cc File chrome/browser/extensions/content_script_apitest.cc (right): https://codereview.chromium.org/2116613002/diff/20001/chrome/browser/extensions/content_script_apitest.cc#newcode338 chrome/browser/extensions/content_script_apitest.cc:338: IN_PROC_BROWSER_TEST_F(ExtensionApiTest, On 2016/07/11 23:45:50, ...
4 years, 5 months ago (2016-07-12 22:23:26 UTC) #6
Devlin
A few more comments, but looking pretty good! Also, I left a couple of meta-comments ...
4 years, 5 months ago (2016-07-12 23:32:36 UTC) #7
catmullings
On 2016/07/12 23:32:36, Devlin wrote: > A few more comments, but looking pretty good! Also, ...
4 years, 5 months ago (2016-07-13 16:13:49 UTC) #10
catmullings
Addressed code review comments on patch 3. I'm adding trybots on this patch. https://codereview.chromium.org/2116613002/diff/40001/chrome/browser/extensions/content_script_apitest.cc File ...
4 years, 5 months ago (2016-07-13 17:25:34 UTC) #11
Devlin
https://codereview.chromium.org/2116613002/diff/40001/extensions/renderer/user_script_injector.cc File extensions/renderer/user_script_injector.cc (right): https://codereview.chromium.org/2116613002/diff/40001/extensions/renderer/user_script_injector.cc#newcode254 extensions/renderer/user_script_injector.cc:254: GURL scriptUrl = iter->url(); On 2016/07/12 23:32:36, Devlin wrote: ...
4 years, 5 months ago (2016-07-13 18:58:36 UTC) #12
catmullings
Addressed code review comments from patch 4 https://codereview.chromium.org/2116613002/diff/40001/extensions/renderer/user_script_injector.cc File extensions/renderer/user_script_injector.cc (right): https://codereview.chromium.org/2116613002/diff/40001/extensions/renderer/user_script_injector.cc#newcode254 extensions/renderer/user_script_injector.cc:254: GURL scriptUrl ...
4 years, 5 months ago (2016-07-15 20:26:59 UTC) #13
Devlin
https://codereview.chromium.org/2116613002/diff/80001/chrome/test/data/extensions/api_test/content_scripts/duplicate_script_injection/manifest.json File chrome/test/data/extensions/api_test/content_scripts/duplicate_script_injection/manifest.json (right): https://codereview.chromium.org/2116613002/diff/80001/chrome/test/data/extensions/api_test/content_scripts/duplicate_script_injection/manifest.json#newcode6 chrome/test/data/extensions/api_test/content_scripts/duplicate_script_injection/manifest.json:6: "background": { nitty nit: "background": {}, (i.e., open and ...
4 years, 5 months ago (2016-07-15 22:43:27 UTC) #14
catmullings
Addressed patch 5 code review https://codereview.chromium.org/2116613002/diff/80001/chrome/test/data/extensions/api_test/content_scripts/duplicate_script_injection/manifest.json File chrome/test/data/extensions/api_test/content_scripts/duplicate_script_injection/manifest.json (right): https://codereview.chromium.org/2116613002/diff/80001/chrome/test/data/extensions/api_test/content_scripts/duplicate_script_injection/manifest.json#newcode6 chrome/test/data/extensions/api_test/content_scripts/duplicate_script_injection/manifest.json:6: "background": { On 2016/07/15 ...
4 years, 5 months ago (2016-07-19 15:53:30 UTC) #15
Devlin
Nice! Just a few last nits https://codereview.chromium.org/2116613002/diff/120001/chrome/browser/extensions/content_script_apitest.cc File chrome/browser/extensions/content_script_apitest.cc (right): https://codereview.chromium.org/2116613002/diff/120001/chrome/browser/extensions/content_script_apitest.cc#newcode345 chrome/browser/extensions/content_script_apitest.cc:345: GURL url = ...
4 years, 5 months ago (2016-07-19 16:09:00 UTC) #16
catmullings
Addressed code review comments from patch 7 https://codereview.chromium.org/2116613002/diff/120001/chrome/browser/extensions/content_script_apitest.cc File chrome/browser/extensions/content_script_apitest.cc (right): https://codereview.chromium.org/2116613002/diff/120001/chrome/browser/extensions/content_script_apitest.cc#newcode345 chrome/browser/extensions/content_script_apitest.cc:345: GURL url ...
4 years, 5 months ago (2016-07-19 17:10:51 UTC) #17
Devlin
lgtm with one last round of nits. https://codereview.chromium.org/2116613002/diff/140001/chrome/test/data/extensions/api_test/content_scripts/duplicate_script_injection/should_run_once.js File chrome/test/data/extensions/api_test/content_scripts/duplicate_script_injection/should_run_once.js (right): https://codereview.chromium.org/2116613002/diff/140001/chrome/test/data/extensions/api_test/content_scripts/duplicate_script_injection/should_run_once.js#newcode7 chrome/test/data/extensions/api_test/content_scripts/duplicate_script_injection/should_run_once.js:7: document.querySelector('body').appendChild(should_be_injected_once); sorry, ...
4 years, 5 months ago (2016-07-19 23:10:36 UTC) #18
catmullings
Addressed comments in patch 8 https://codereview.chromium.org/2116613002/diff/140001/chrome/test/data/extensions/api_test/content_scripts/duplicate_script_injection/should_run_once.js File chrome/test/data/extensions/api_test/content_scripts/duplicate_script_injection/should_run_once.js (right): https://codereview.chromium.org/2116613002/diff/140001/chrome/test/data/extensions/api_test/content_scripts/duplicate_script_injection/should_run_once.js#newcode7 chrome/test/data/extensions/api_test/content_scripts/duplicate_script_injection/should_run_once.js:7: document.querySelector('body').appendChild(should_be_injected_once); On 2016/07/19 23:10:36, ...
4 years, 5 months ago (2016-07-20 16:00:36 UTC) #19
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2116613002/160001
4 years, 5 months ago (2016-07-21 21:59:55 UTC) #22
commit-bot: I haz the power
Committed patchset #9 (id:160001)
4 years, 5 months ago (2016-07-22 03:22:02 UTC) #24
commit-bot: I haz the power
Patchset 9 (id:??) landed as https://crrev.com/90d8dd145246616da02f5a54f1da1f5bfe6680e9 Cr-Commit-Position: refs/heads/master@{#407016}
4 years, 5 months ago (2016-07-22 03:27:18 UTC) #26
achuithb
There's a renderer crash on chromeos (http://crbug.com/631247) that I've bisected to this CL.
4 years, 4 months ago (2016-08-01 22:27:19 UTC) #27
Devlin
4 years, 4 months ago (2016-08-02 00:13:39 UTC) #28
Message was sent while issue was closed.
A revert of this CL (patchset #9 id:160001) has been created in
https://codereview.chromium.org/2206463002/ by rdevlin.cronin@chromium.org.

The reason for reverting is: Causes a renderer crash - http://crbug.com/631247.

Powered by Google App Engine
This is Rietveld 408576698