Bug 1452479 - Include timeout duration in ScriptTimeoutError. r?maja_zf
We don’t currently log what the script timeout was when throwing
ScriptTimeoutError. It would provide more value to the user to
include the timeout duration than to record "Timed out" as we do
currently.
MozReview-Commit-ID: 3DM1Xer3Qbz
--- a/testing/marionette/evaluate.js
+++ b/testing/marionette/evaluate.js
@@ -109,17 +109,17 @@ evaluate.sandbox = function(sb, script,
sandboxName = null,
timeout = DEFAULT_TIMEOUT,
} = {}) {
let scriptTimeoutID, timeoutHandler, unloadHandler;
let promise = new Promise((resolve, reject) => {
let src = "";
sb[COMPLETE] = resolve;
- timeoutHandler = () => reject(new ScriptTimeoutError("Timed out"));
+ timeoutHandler = () => reject(new ScriptTimeoutError(`Timed out after ${timeout} ms`));
unloadHandler = sandbox.cloneInto(
() => reject(new JavaScriptError("Document was unloaded")),
sb);
// wrap in function
if (!directInject) {
if (async) {
sb[CALLBACK] = sb[COMPLETE];