diff options
author | mpcomplete@chromium.org <mpcomplete@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-12-09 01:24:13 +0000 |
---|---|---|
committer | mpcomplete@chromium.org <mpcomplete@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-12-09 01:24:13 +0000 |
commit | 4056cc7450d6eb5790360713661a7aa22499fd34 (patch) | |
tree | 8eb36e9695109b9a60815ee138d0433d75c5c001 /chrome/renderer | |
parent | 0f2d94ed76e5892f6e4a8ded5259aa63d1d96ca0 (diff) | |
download | chromium_src-4056cc7450d6eb5790360713661a7aa22499fd34.zip chromium_src-4056cc7450d6eb5790360713661a7aa22499fd34.tar.gz chromium_src-4056cc7450d6eb5790360713661a7aa22499fd34.tar.bz2 |
Fix a bug where content scripts would get run twice in some cases.
BUG=29644
Review URL: http://codereview.chromium.org/466079
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@34122 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer')
-rw-r--r-- | chrome/renderer/user_script_idle_scheduler.cc | 9 |
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; } |