summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/renderer/user_script_idle_scheduler.cc9
1 files changed, 7 insertions, 2 deletions
diff --git a/chrome/renderer/user_script_idle_scheduler.cc b/chrome/renderer/user_script_idle_scheduler.cc
index 2468bf1..9336a9d 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;
}