From ecde2809724201abf1efbdf62f1ff8ea420d830c Mon Sep 17 00:00:00 2001 From: Patrick Brosset Date: Tue, 16 Dec 2014 22:34:13 +0100 Subject: [PATCH] Bug 1104908 - 2 - Remove the timeout in styleinspector's waitforsuccess test helper function; r=harth --- browser/devtools/styleinspector/test/head.js | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/browser/devtools/styleinspector/test/head.js b/browser/devtools/styleinspector/test/head.js index 1d3250690ad..c030cf5770a 100644 --- a/browser/devtools/styleinspector/test/head.js +++ b/browser/devtools/styleinspector/test/head.js @@ -506,25 +506,19 @@ function fireCopyEvent(element) { * polling timeouts after several tries and the promise rejects. * @param {String} name Optional name of the test. This is used to generate * the success and failure messages. - * @param {Number} timeout Optional timeout for the validator function, in - * milliseconds. Default is 5000. * @return a promise that resolves when the function returned true or rejects * if the timeout is reached */ -function waitForSuccess(validatorFn, name="untitled", timeout=5000) { +function waitForSuccess(validatorFn, name="untitled") { let def = promise.defer(); let start = Date.now(); function wait(validatorFn) { - if ((Date.now() - start) > timeout) { - ok(false, "Validator function " + name + " timed out"); - return def.reject(); - } if (validatorFn()) { ok(true, "Validator function " + name + " returned true"); def.resolve(); } else { - setTimeout(() => wait(validatorFn), 100); + setTimeout(() => wait(validatorFn), 200); } } wait(validatorFn);