Loading testing/marionette/client/marionette/marionette.py +2 −2 Original line number Diff line number Diff line Loading @@ -421,7 +421,7 @@ class Marionette(object): return unwrapped def execute_js_script(self, script, script_args=None, timeout=True, new_sandbox=True, special_powers=False): def execute_js_script(self, script, script_args=None, async=True, new_sandbox=True, special_powers=False): if script_args is None: script_args = [] args = self.wrapArguments(script_args) Loading @@ -429,7 +429,7 @@ class Marionette(object): 'value', value=script, args=args, timeout=timeout, async=async, newSandbox=new_sandbox, specialPowers=special_powers) return self.unwrapValue(response) Loading testing/marionette/marionette-actors.js +11 −7 Original line number Diff line number Diff line Loading @@ -444,6 +444,7 @@ MarionetteDriverActor.prototype = { * */ newSession: function MDA_newSession() { this.scriptTimeout = 10000; function waitForWindow() { let checkTimer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer); Loading Loading @@ -685,7 +686,8 @@ MarionetteDriverActor.prototype = { if (this.context == "content") { this.sendAsync("executeScript", {value: aRequest.value, args: aRequest.args, newSandbox:aRequest.newSandbox}); newSandbox: aRequest.newSandbox, timeout: this.scriptTimeout}); return; } Loading Loading @@ -732,7 +734,7 @@ MarionetteDriverActor.prototype = { } else { this.scriptTimeout = timeout; this.sendAsync("setScriptTimeout", {value: timeout}); this.sendOk(); } }, Loading Loading @@ -763,7 +765,8 @@ MarionetteDriverActor.prototype = { this.sendAsync("executeJSScript", { value: aRequest.value, args: aRequest.args, newSandbox: aRequest.newSandbox, timeout:aRequest.timeout }); async: aRequest.async, timeout: this.scriptTimeout }); } }, Loading Loading @@ -794,7 +797,8 @@ MarionetteDriverActor.prototype = { this.sendAsync("executeAsyncScript", {value: aRequest.value, args: aRequest.args, id: this.command_id, newSandbox: aRequest.newSandbox}); newSandbox: aRequest.newSandbox, timeout: this.scriptTimeout}); return; } Loading testing/marionette/marionette-listener.js +10 −22 Original line number Diff line number Diff line Loading @@ -33,7 +33,6 @@ let marionettePerf = new MarionettePerfData(); let isB2G = false; let marionetteTimeout = null; let marionetteTestName; let winUtil = content.QueryInterface(Ci.nsIInterfaceRequestor) .getInterface(Ci.nsIDOMWindowUtils); Loading Loading @@ -90,7 +89,6 @@ function removeMessageListenerId(messageName, handler) { function startListeners() { addMessageListenerId("Marionette:newSession", newSession); addMessageListenerId("Marionette:executeScript", executeScript); addMessageListenerId("Marionette:setScriptTimeout", setScriptTimeout); addMessageListenerId("Marionette:executeAsyncScript", executeAsyncScript); addMessageListenerId("Marionette:executeJSScript", executeJSScript); addMessageListenerId("Marionette:setSearchTimeout", setSearchTimeout); Loading Loading @@ -172,7 +170,6 @@ function restart() { function deleteSession(msg) { removeMessageListenerId("Marionette:newSession", newSession); removeMessageListenerId("Marionette:executeScript", executeScript); removeMessageListenerId("Marionette:setScriptTimeout", setScriptTimeout); removeMessageListenerId("Marionette:executeAsyncScript", executeAsyncScript); removeMessageListenerId("Marionette:executeJSScript", executeJSScript); removeMessageListenerId("Marionette:setSearchTimeout", setSearchTimeout); Loading Loading @@ -262,7 +259,6 @@ function sendError(message, status, trace, command_id) { */ function resetValues() { sandbox = null; marionetteTimeout = null; curWindow = content; } Loading @@ -280,7 +276,7 @@ function errUnload() { /** * Returns a content sandbox that can be used by the execute_foo functions. */ function createExecuteContentSandbox(aWindow) { function createExecuteContentSandbox(aWindow, timeout) { let sandbox = new Cu.Sandbox(aWindow); sandbox.global = sandbox; sandbox.window = aWindow; Loading @@ -291,7 +287,7 @@ function createExecuteContentSandbox(aWindow) { let marionette = new Marionette(this, aWindow, "content", marionetteLogObj, marionettePerf, marionetteTimeout, marionetteTestName); timeout, marionetteTestName); sandbox.marionette = marionette; marionette.exports.forEach(function(fn) { try { Loading Loading @@ -357,7 +353,7 @@ function executeScript(msg, directInject) { let script = msg.json.value; if (msg.json.newSandbox || !sandbox) { sandbox = createExecuteContentSandbox(curWindow); sandbox = createExecuteContentSandbox(curWindow, msg.json.timeout); if (!sandbox) { sendError("Could not create sandbox!"); return; Loading Loading @@ -426,14 +422,6 @@ function setTestName(msg) { sendOk(); } /** * Function to set the timeout of asynchronous scripts */ function setScriptTimeout(msg) { marionetteTimeout = msg.json.value; sendOk(); } /** * Execute async script */ Loading @@ -445,8 +433,8 @@ function executeAsyncScript(msg) { * Execute pure JS test. Handles both async and sync cases. */ function executeJSScript(msg) { if (msg.json.timeout) { executeWithCallback(msg, msg.json.timeout); if (msg.json.async) { executeWithCallback(msg, msg.json.async); } else { executeScript(msg, true); Loading @@ -461,13 +449,13 @@ function executeJSScript(msg) { * For executeAsync, it will return a response when marionetteScriptFinished/arguments[arguments.length-1] * method is called, or if it times out. */ function executeWithCallback(msg, timeout) { function executeWithCallback(msg, async) { curWindow.addEventListener("unload", errUnload, false); let script = msg.json.value; asyncTestCommandId = msg.json.id; if (msg.json.newSandbox || !sandbox) { sandbox = createExecuteContentSandbox(curWindow); sandbox = createExecuteContentSandbox(curWindow, msg.json.timeout); if (!sandbox) { sendError("Could not create sandbox!"); return; Loading @@ -481,7 +469,7 @@ function executeWithCallback(msg, timeout) { // We'll stay compatible with the Selenium code. asyncTestTimeoutId = curWindow.setTimeout(function() { sandbox.asyncComplete('timed out', 28); }, marionetteTimeout); }, msg.json.timeout); curWindow.addEventListener('error', function win__onerror(evt) { curWindow.removeEventListener('error', win__onerror, true); Loading @@ -490,8 +478,8 @@ function executeWithCallback(msg, timeout) { }, true); let scriptSrc; if (timeout) { if (marionetteTimeout == null || marionetteTimeout == 0) { if (async) { if (msg.json.timeout == null || msg.json.timeout == 0) { sendError("Please set a timeout", 21, null); } scriptSrc = script; Loading Loading
testing/marionette/client/marionette/marionette.py +2 −2 Original line number Diff line number Diff line Loading @@ -421,7 +421,7 @@ class Marionette(object): return unwrapped def execute_js_script(self, script, script_args=None, timeout=True, new_sandbox=True, special_powers=False): def execute_js_script(self, script, script_args=None, async=True, new_sandbox=True, special_powers=False): if script_args is None: script_args = [] args = self.wrapArguments(script_args) Loading @@ -429,7 +429,7 @@ class Marionette(object): 'value', value=script, args=args, timeout=timeout, async=async, newSandbox=new_sandbox, specialPowers=special_powers) return self.unwrapValue(response) Loading
testing/marionette/marionette-actors.js +11 −7 Original line number Diff line number Diff line Loading @@ -444,6 +444,7 @@ MarionetteDriverActor.prototype = { * */ newSession: function MDA_newSession() { this.scriptTimeout = 10000; function waitForWindow() { let checkTimer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer); Loading Loading @@ -685,7 +686,8 @@ MarionetteDriverActor.prototype = { if (this.context == "content") { this.sendAsync("executeScript", {value: aRequest.value, args: aRequest.args, newSandbox:aRequest.newSandbox}); newSandbox: aRequest.newSandbox, timeout: this.scriptTimeout}); return; } Loading Loading @@ -732,7 +734,7 @@ MarionetteDriverActor.prototype = { } else { this.scriptTimeout = timeout; this.sendAsync("setScriptTimeout", {value: timeout}); this.sendOk(); } }, Loading Loading @@ -763,7 +765,8 @@ MarionetteDriverActor.prototype = { this.sendAsync("executeJSScript", { value: aRequest.value, args: aRequest.args, newSandbox: aRequest.newSandbox, timeout:aRequest.timeout }); async: aRequest.async, timeout: this.scriptTimeout }); } }, Loading Loading @@ -794,7 +797,8 @@ MarionetteDriverActor.prototype = { this.sendAsync("executeAsyncScript", {value: aRequest.value, args: aRequest.args, id: this.command_id, newSandbox: aRequest.newSandbox}); newSandbox: aRequest.newSandbox, timeout: this.scriptTimeout}); return; } Loading
testing/marionette/marionette-listener.js +10 −22 Original line number Diff line number Diff line Loading @@ -33,7 +33,6 @@ let marionettePerf = new MarionettePerfData(); let isB2G = false; let marionetteTimeout = null; let marionetteTestName; let winUtil = content.QueryInterface(Ci.nsIInterfaceRequestor) .getInterface(Ci.nsIDOMWindowUtils); Loading Loading @@ -90,7 +89,6 @@ function removeMessageListenerId(messageName, handler) { function startListeners() { addMessageListenerId("Marionette:newSession", newSession); addMessageListenerId("Marionette:executeScript", executeScript); addMessageListenerId("Marionette:setScriptTimeout", setScriptTimeout); addMessageListenerId("Marionette:executeAsyncScript", executeAsyncScript); addMessageListenerId("Marionette:executeJSScript", executeJSScript); addMessageListenerId("Marionette:setSearchTimeout", setSearchTimeout); Loading Loading @@ -172,7 +170,6 @@ function restart() { function deleteSession(msg) { removeMessageListenerId("Marionette:newSession", newSession); removeMessageListenerId("Marionette:executeScript", executeScript); removeMessageListenerId("Marionette:setScriptTimeout", setScriptTimeout); removeMessageListenerId("Marionette:executeAsyncScript", executeAsyncScript); removeMessageListenerId("Marionette:executeJSScript", executeJSScript); removeMessageListenerId("Marionette:setSearchTimeout", setSearchTimeout); Loading Loading @@ -262,7 +259,6 @@ function sendError(message, status, trace, command_id) { */ function resetValues() { sandbox = null; marionetteTimeout = null; curWindow = content; } Loading @@ -280,7 +276,7 @@ function errUnload() { /** * Returns a content sandbox that can be used by the execute_foo functions. */ function createExecuteContentSandbox(aWindow) { function createExecuteContentSandbox(aWindow, timeout) { let sandbox = new Cu.Sandbox(aWindow); sandbox.global = sandbox; sandbox.window = aWindow; Loading @@ -291,7 +287,7 @@ function createExecuteContentSandbox(aWindow) { let marionette = new Marionette(this, aWindow, "content", marionetteLogObj, marionettePerf, marionetteTimeout, marionetteTestName); timeout, marionetteTestName); sandbox.marionette = marionette; marionette.exports.forEach(function(fn) { try { Loading Loading @@ -357,7 +353,7 @@ function executeScript(msg, directInject) { let script = msg.json.value; if (msg.json.newSandbox || !sandbox) { sandbox = createExecuteContentSandbox(curWindow); sandbox = createExecuteContentSandbox(curWindow, msg.json.timeout); if (!sandbox) { sendError("Could not create sandbox!"); return; Loading Loading @@ -426,14 +422,6 @@ function setTestName(msg) { sendOk(); } /** * Function to set the timeout of asynchronous scripts */ function setScriptTimeout(msg) { marionetteTimeout = msg.json.value; sendOk(); } /** * Execute async script */ Loading @@ -445,8 +433,8 @@ function executeAsyncScript(msg) { * Execute pure JS test. Handles both async and sync cases. */ function executeJSScript(msg) { if (msg.json.timeout) { executeWithCallback(msg, msg.json.timeout); if (msg.json.async) { executeWithCallback(msg, msg.json.async); } else { executeScript(msg, true); Loading @@ -461,13 +449,13 @@ function executeJSScript(msg) { * For executeAsync, it will return a response when marionetteScriptFinished/arguments[arguments.length-1] * method is called, or if it times out. */ function executeWithCallback(msg, timeout) { function executeWithCallback(msg, async) { curWindow.addEventListener("unload", errUnload, false); let script = msg.json.value; asyncTestCommandId = msg.json.id; if (msg.json.newSandbox || !sandbox) { sandbox = createExecuteContentSandbox(curWindow); sandbox = createExecuteContentSandbox(curWindow, msg.json.timeout); if (!sandbox) { sendError("Could not create sandbox!"); return; Loading @@ -481,7 +469,7 @@ function executeWithCallback(msg, timeout) { // We'll stay compatible with the Selenium code. asyncTestTimeoutId = curWindow.setTimeout(function() { sandbox.asyncComplete('timed out', 28); }, marionetteTimeout); }, msg.json.timeout); curWindow.addEventListener('error', function win__onerror(evt) { curWindow.removeEventListener('error', win__onerror, true); Loading @@ -490,8 +478,8 @@ function executeWithCallback(msg, timeout) { }, true); let scriptSrc; if (timeout) { if (marionetteTimeout == null || marionetteTimeout == 0) { if (async) { if (msg.json.timeout == null || msg.json.timeout == 0) { sendError("Please set a timeout", 21, null); } scriptSrc = script; Loading