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

Issue 339064: Add new user script injection point: document_idle. (Closed)

Created:
11 years, 1 month ago by Aaron Boodman
Modified:
9 years, 6 months ago
CC:
chromium-reviews_googlegroups.com
Visibility:
Public.

Description

Add new user script injection point "document_idle" and make it the default. Semantically, document-idle means "when the DOM is ready and layout has been idle for awhile", or more loosely, "as soon as we get around to it". Right now this uses a simple heuristic. It injects scripts 200ms after DOMContentLoaded, or immediately after onload, whichever happens first. BUG=26126 TEST=Manual. Extensions with content scripts should work. Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=30784

Patch Set 1 #

Patch Set 2 : cleanup #

Patch Set 3 : Simpler heuristic #

Total comments: 3

Patch Set 4 : blargh #

Patch Set 5 : smaller, cleaner, better #

Total comments: 10
Unified diffs Side-by-side diffs Delta from patch set Stats (+250 lines, -48 lines) Patch
M chrome/browser/extensions/user_script_master.cc View 1 chunk +5 lines, -0 lines 0 comments Download
M chrome/chrome.gyp View 1 chunk +2 lines, -0 lines 0 comments Download
M chrome/common/extensions/docs/content_scripts.html View 1 chunk +18 lines, -1 line 0 comments Download
M chrome/common/extensions/docs/static/content_scripts.html View 1 chunk +18 lines, -1 line 0 comments Download
M chrome/common/extensions/extension.cc View 1 chunk +2 lines, -0 lines 0 comments Download
M chrome/common/extensions/extension_constants.h View 1 chunk +1 line, -0 lines 0 comments Download
M chrome/common/extensions/extension_constants.cc View 1 chunk +1 line, -0 lines 0 comments Download
M chrome/common/extensions/user_script.h View 2 chunks +8 lines, -3 lines 0 comments Download
M chrome/renderer/navigation_state.h View 4 4 chunks +11 lines, -1 line 2 comments Download
M chrome/renderer/render_view.h View 1 2 3 4 2 chunks +9 lines, -0 lines 2 comments Download
M chrome/renderer/render_view.cc View 1 2 3 4 6 chunks +51 lines, -21 lines 4 comments Download
chrome/renderer/user_script_idle_scheduler.h View 1 chunk +58 lines, -0 lines 0 comments Download
A chrome/renderer/user_script_idle_scheduler.cc View 1 chunk +47 lines, -0 lines 1 comment Download
M chrome/test/data/extensions/good/Extensions/bjafgdebaacbbbecmhlhpofkepfkgcpa/1.0/page.js View 1 chunk +19 lines, -21 lines 1 comment Download

Messages

Total messages: 11 (0 generated)
Aaron Boodman
*** NOT FOR SUBMISSION -- feedback only ***
11 years, 1 month ago (2009-10-29 08:26:10 UTC) #1
Erik does not do reviews
Yes, this looks roughly like what I was thinking. Two issues popped out at me: ...
11 years, 1 month ago (2009-10-29 15:06:07 UTC) #2
Matt Perry
This makes sense to me. I only notice some unrelated issues (like the fact that ...
11 years, 1 month ago (2009-10-29 18:47:35 UTC) #3
Aaron Boodman
This is ready for a real review now.
11 years, 1 month ago (2009-10-30 00:06:45 UTC) #4
Matt Perry
http://codereview.chromium.org/339064/diff/2002/2007 File chrome/renderer/render_view.cc (right): http://codereview.chromium.org/339064/diff/2002/2007#newcode2297 Line 2297: void RenderView::InjectIdleUserScripts(WebKit::WebFrame* frame) { I don't think there's ...
11 years, 1 month ago (2009-10-30 00:15:13 UTC) #5
Erik does not do reviews
LGTM looks like you handle the closing frame case already http://codereview.chromium.org/339064/diff/2002/2007 File chrome/renderer/render_view.cc (right): http://codereview.chromium.org/339064/diff/2002/2007#newcode208 ...
11 years, 1 month ago (2009-10-30 04:15:24 UTC) #6
Aaron Boodman
Ok, new take based on ideas from darin and abarth (cc'd). Matt, can you take ...
11 years, 1 month ago (2009-10-31 06:55:03 UTC) #7
abarth-chromium
http://codereview.chromium.org/339064/diff/6010/6022 File chrome/renderer/user_script_idle_scheduler.cc (right): http://codereview.chromium.org/339064/diff/6010/6022#newcode19 Line 19: frame_(frame), has_run_(false) { These should each be on ...
11 years, 1 month ago (2009-10-31 07:07:39 UTC) #8
Matt Perry
LGTM with small changes. http://codereview.chromium.org/339064/diff/6010/6019 File chrome/renderer/navigation_state.h (right): http://codereview.chromium.org/339064/diff/6010/6019#newcode37 Line 37: UserScriptIdleScheduler* user_script_idle_scheduler() { Very ...
11 years, 1 month ago (2009-11-02 19:46:30 UTC) #9
Aaron Boodman
fyi... http://codereview.chromium.org/339064/diff/6010/6020 File chrome/renderer/render_view.cc (right): http://codereview.chromium.org/339064/diff/6010/6020#newcode1819 Line 1819: WebDataSource* ds = frame->dataSource(); On 2009/11/02 19:46:30, ...
11 years, 1 month ago (2009-11-03 05:03:11 UTC) #10
darin (slow to review)
11 years, 1 month ago (2009-11-03 05:10:59 UTC) #11
http://codereview.chromium.org/339064/diff/6010/6019
File chrome/renderer/navigation_state.h (right):

http://codereview.chromium.org/339064/diff/6010/6019#newcode185
Line 185: user_script_idle_scheduler_(NULL) {
nit: no need to NULL out a scoped_ptr

http://codereview.chromium.org/339064/diff/6010/6020
File chrome/renderer/render_view.cc (right):

http://codereview.chromium.org/339064/diff/6010/6020#newcode1819
Line 1819: WebDataSource* ds = frame->dataSource();
On 2009/11/03 05:03:11, Aaron Boodman wrote:
> On 2009/11/02 19:46:30, Matt Perry wrote:
> > Can this ever be NULL?
> 
> No, it is created in didCreateDataSource(), and many places in RenderView
assume
> it exists after that.

Right, it cannot be null!

Powered by Google App Engine
This is Rietveld 408576698