diff options
Diffstat (limited to 'chrome/test/functional/ispy/wait_on_ajax.js')
-rw-r--r-- | chrome/test/functional/ispy/wait_on_ajax.js | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/chrome/test/functional/ispy/wait_on_ajax.js b/chrome/test/functional/ispy/wait_on_ajax.js new file mode 100644 index 0000000..da1fce9 --- /dev/null +++ b/chrome/test/functional/ispy/wait_on_ajax.js @@ -0,0 +1,18 @@ +// Copyright 2013 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +var target = document.body; +var callback = arguments[arguments.length - 1] + +var timeout_id = setTimeout(function() { + callback() +}, 5000); + +var observer = new MutationObserver(function(mutations) { + clearTimeout(timeout_id); + timeout_id = setTimeout(function() { + callback(); + }, 5000); +}).observe(target, {attributes: true, childList: true, + characterData: true, subtree: true}); |