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

Unified Diff: chrome/renderer/user_script_idle_scheduler.cc

Issue 466079: Fix a bug where content scripts would get run twice in some cases. (Closed)
Patch Set: Created 11 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/renderer/user_script_idle_scheduler.cc
diff --git a/chrome/renderer/user_script_idle_scheduler.cc b/chrome/renderer/user_script_idle_scheduler.cc
index 2468bf13e4ded8254c356ba828c21fdef2ac788a..9336a9de147631cbc27a7b1ed7edd0899d5765ca 100644
--- a/chrome/renderer/user_script_idle_scheduler.cc
+++ b/chrome/renderer/user_script_idle_scheduler.cc
@@ -37,11 +37,16 @@ void UserScriptIdleScheduler::Cancel() {
}
void UserScriptIdleScheduler::MaybeRun() {
- if (!view_)
+ if (!view_ || has_run())
return;
+ // Note: we must set this before calling OnUserScriptIdleTriggered, because
+ // that may result in a synchronous call back into MaybeRun if there is a
+ // pending task currently in the queue.
+ // http://code.google.com/p/chromium/issues/detail?id=29644
+ has_run_ = true;
+
DCHECK(frame_);
view_->OnUserScriptIdleTriggered(frame_);
Cancel();
- has_run_ = true;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698