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

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

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

Prevent duplicate content script injection defined in manifest.json (reland) 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, 631247 TEST= Run target browser_tests with --gtest_filter="ExtensionApiTest.ContentScript*" Committed: https://crrev.com/90d8dd145246616da02f5a54f1da1f5bfe6680e9 Committed: https://crrev.com/d4faad4f287364c5b0d97576a3a3c30d5e551b06 Cr-Original-Commit-Position: refs/heads/master@{#407016} Cr-Commit-Position: refs/heads/master@{#417372}

Patch Set 1 : Pulled from codereview.chromium.org/2116613002 #

Patch Set 2 : Initial fix to bug 631247 #

Total comments: 12

Patch Set 3 : Addressed Patch 2 code review comments; no test #

Patch Set 4 : Test added #

Total comments: 17

Patch Set 5 : Addressed patch 4 code review comments #

Patch Set 6 : Rebased with origin master #

Total comments: 7

Patch Set 7 : Addressed patch 6 code review comments #

Total comments: 16

Patch Set 8 : Addressed patch 7 code review comments #

Total comments: 13

Patch Set 9 : Addressed patch 8 code review comments #

Total comments: 7

Patch Set 10 : Addressed patch 9 code review #

Patch Set 11 : Rebased with origin #

Total comments: 10

Patch Set 12 : Addressed lgtm nits #

Unified diffs Side-by-side diffs Delta from patch set Stats (+197 lines, -88 lines) Patch
M chrome/browser/extensions/content_script_apitest.cc View 1 2 3 4 5 6 7 8 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 1 chunk +29 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 6 7 8 9 10 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 chunk +7 lines, -0 lines 0 comments Download
M extensions/renderer/programmatic_script_injector.h View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +12 lines, -6 lines 0 comments Download
M extensions/renderer/programmatic_script_injector.cc View 1 2 3 4 5 6 7 8 9 10 11 4 chunks +10 lines, -9 lines 0 comments Download
M extensions/renderer/script_injection.h View 1 2 3 4 5 6 7 8 1 chunk +4 lines, -2 lines 0 comments Download
M extensions/renderer/script_injection.cc View 1 2 3 4 5 6 7 8 9 10 11 3 chunks +24 lines, -14 lines 0 comments Download
M extensions/renderer/script_injector.h View 1 2 3 4 5 6 7 8 9 2 chunks +12 lines, -9 lines 0 comments Download
M extensions/renderer/scripts_run_info.h View 1 2 3 4 5 6 7 8 1 chunk +2 lines, -0 lines 0 comments Download
M extensions/renderer/user_script_injector.h View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +12 lines, -6 lines 0 comments Download
M extensions/renderer/user_script_injector.cc View 1 2 3 4 5 6 7 8 9 10 11 3 chunks +45 lines, -33 lines 0 comments Download

Messages

Total messages: 58 (36 generated)
catmullings
Initial fix to bug 631247; no test yet. https://codereview.chromium.org/2213603002/diff/40001/extensions/renderer/user_script_injector.cc File extensions/renderer/user_script_injector.cc (right): https://codereview.chromium.org/2213603002/diff/40001/extensions/renderer/user_script_injector.cc#newcode271 extensions/renderer/user_script_injector.cc:271: if ...
4 years, 4 months ago (2016-08-03 23:31:22 UTC) #3
catmullings
4 years, 4 months ago (2016-08-03 23:33:05 UTC) #5
Devlin
We should also add an additional test case for the scenario that caused the crash, ...
4 years, 4 months ago (2016-08-03 23:34:44 UTC) #6
catmullings
https://codereview.chromium.org/2213603002/diff/40001/extensions/renderer/script_injection.cc File extensions/renderer/script_injection.cc (right): https://codereview.chromium.org/2213603002/diff/40001/extensions/renderer/script_injection.cc#newcode247 extensions/renderer/script_injection.cc:247: DCHECK(sources.size() != 0); On 2016/08/03 23:34:44, Devlin wrote: > ...
4 years, 4 months ago (2016-08-09 23:13:42 UTC) #7
Devlin
I'll take another look once the test's added. :) https://codereview.chromium.org/2213603002/diff/40001/extensions/renderer/user_script_injector.cc File extensions/renderer/user_script_injector.cc (right): https://codereview.chromium.org/2213603002/diff/40001/extensions/renderer/user_script_injector.cc#newcode271 extensions/renderer/user_script_injector.cc:271: ...
4 years, 4 months ago (2016-08-10 19:23:27 UTC) #8
catmullings
Test added. Passes all ExtensionsApiTest.*
4 years, 4 months ago (2016-08-22 22:34:19 UTC) #10
Devlin
I think you'll also need to rebase this. On 2016/08/22 22:34:19, catmullings wrote: > Test ...
4 years, 4 months ago (2016-08-22 22:46:53 UTC) #11
catmullings
Addressed your code review comments. I will rebase this branch in the next patch, and ...
4 years, 4 months ago (2016-08-24 01:13:19 UTC) #13
catmullings
Rebased with origin master.
4 years, 3 months ago (2016-08-24 23:49:07 UTC) #16
Devlin
it also looks like there's a test failing on the bots. https://codereview.chromium.org/2213603002/diff/100001/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): ...
4 years, 3 months ago (2016-08-25 16:52:26 UTC) #20
catmullings
Addressed patch 6 code review comments. https://codereview.chromium.org/2213603002/diff/100001/extensions/renderer/script_injection.cc File extensions/renderer/script_injection.cc (right): https://codereview.chromium.org/2213603002/diff/100001/extensions/renderer/script_injection.cc#newcode221 extensions/renderer/script_injection.cc:221: // Occurs when ...
4 years, 3 months ago (2016-08-27 00:23:09 UTC) #23
Devlin
https://codereview.chromium.org/2213603002/diff/200001/extensions/renderer/programmatic_script_injector.h File extensions/renderer/programmatic_script_injector.h (right): https://codereview.chromium.org/2213603002/diff/200001/extensions/renderer/programmatic_script_injector.h#newcode46 extensions/renderer/programmatic_script_injector.h:46: std::set<GURL>& injected_scripts) const override; nit: chromium style (mostly) forbids ...
4 years, 3 months ago (2016-08-29 20:48:14 UTC) #26
catmullings
https://codereview.chromium.org/2213603002/diff/200001/extensions/renderer/programmatic_script_injector.h File extensions/renderer/programmatic_script_injector.h (right): https://codereview.chromium.org/2213603002/diff/200001/extensions/renderer/programmatic_script_injector.h#newcode46 extensions/renderer/programmatic_script_injector.h:46: std::set<GURL>& injected_scripts) const override; On 2016/08/29 20:48:14, Devlin wrote: ...
4 years, 3 months ago (2016-09-01 17:43:51 UTC) #29
Devlin
https://codereview.chromium.org/2213603002/diff/220001/extensions/renderer/programmatic_script_injector.h File extensions/renderer/programmatic_script_injector.h (right): https://codereview.chromium.org/2213603002/diff/220001/extensions/renderer/programmatic_script_injector.h#newcode38 extensions/renderer/programmatic_script_injector.h:38: std::map<std::string, std::set<std::string>>& Remember, chromium style discourages non-const refs (https://codereview.chromium.org/2213603002/diff/200001/extensions/renderer/programmatic_script_injector.h#newcode46). ...
4 years, 3 months ago (2016-09-06 17:21:13 UTC) #32
catmullings
Addressed patch 8 code review comments https://codereview.chromium.org/2213603002/diff/220001/extensions/renderer/programmatic_script_injector.h File extensions/renderer/programmatic_script_injector.h (right): https://codereview.chromium.org/2213603002/diff/220001/extensions/renderer/programmatic_script_injector.h#newcode38 extensions/renderer/programmatic_script_injector.h:38: std::map<std::string, std::set<std::string>>& On ...
4 years, 3 months ago (2016-09-07 01:00:36 UTC) #36
Devlin
Nice! Just a few last nits. https://codereview.chromium.org/2213603002/diff/300001/extensions/renderer/script_injector.h File extensions/renderer/script_injector.h (right): https://codereview.chromium.org/2213603002/diff/300001/extensions/renderer/script_injector.h#newcode56 extensions/renderer/script_injector.h:56: std::set<std::string>* executing_scripts) const ...
4 years, 3 months ago (2016-09-07 18:22:40 UTC) #41
catmullings
Addressed patch 9 code review https://codereview.chromium.org/2213603002/diff/300001/extensions/renderer/script_injector.h File extensions/renderer/script_injector.h (right): https://codereview.chromium.org/2213603002/diff/300001/extensions/renderer/script_injector.h#newcode56 extensions/renderer/script_injector.h:56: std::set<std::string>* executing_scripts) const = ...
4 years, 3 months ago (2016-09-07 18:56:31 UTC) #42
catmullings
Rebased with origin. https://codereview.chromium.org/2213603002/diff/380001/extensions/renderer/user_script_injector.cc File extensions/renderer/user_script_injector.cc (right): https://codereview.chromium.org/2213603002/diff/380001/extensions/renderer/user_script_injector.cc#newcode237 extensions/renderer/user_script_injector.cc:237: (*num_injected_js_scripts) += 1; This increment was ...
4 years, 3 months ago (2016-09-08 17:10:33 UTC) #49
Devlin
awesome, lgtm! https://codereview.chromium.org/2213603002/diff/380001/extensions/renderer/programmatic_script_injector.cc File extensions/renderer/programmatic_script_injector.cc (right): https://codereview.chromium.org/2213603002/diff/380001/extensions/renderer/programmatic_script_injector.cc#newcode21 extensions/renderer/programmatic_script_injector.cc:21: #include "extensions/renderer/scripts_run_info.h" not needed https://codereview.chromium.org/2213603002/diff/380001/extensions/renderer/programmatic_script_injector.h File extensions/renderer/programmatic_script_injector.h ...
4 years, 3 months ago (2016-09-08 17:47:32 UTC) #52
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/2213603002/400001
4 years, 3 months ago (2016-09-08 18:22:28 UTC) #55
commit-bot: I haz the power
Committed patchset #12 (id:400001)
4 years, 3 months ago (2016-09-08 19:55:47 UTC) #56
commit-bot: I haz the power
4 years, 3 months ago (2016-09-08 19:59:03 UTC) #58
Message was sent while issue was closed.
Patchset 12 (id:??) landed as
https://crrev.com/d4faad4f287364c5b0d97576a3a3c30d5e551b06
Cr-Commit-Position: refs/heads/master@{#417372}

Powered by Google App Engine
This is Rietveld 408576698