mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-01 08:42:13 +00:00
Bug 1271758 - Ensure that execute_script does not fail on closed chrome windows. r=ato
MozReview-Commit-ID: 7SMV36KuFCe --HG-- extra : rebase_source : a15078b9f40c845945fbd6061cac0711a792e342
This commit is contained in:
parent
c17f3a2733
commit
a3814775bf
@ -8,6 +8,7 @@ const {classes: Cc, interfaces: Ci, utils: Cu} = Components;
|
||||
|
||||
Cu.import("resource://gre/modules/Log.jsm");
|
||||
Cu.import("resource://gre/modules/NetUtil.jsm");
|
||||
Cu.import("resource://gre/modules/Timer.jsm");
|
||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
|
||||
Cu.import("chrome://marionette/content/error.js");
|
||||
@ -133,7 +134,7 @@ evaluate.sandbox = function(sb, script, args = [], opts = {}) {
|
||||
}
|
||||
|
||||
// timeout and unload handlers
|
||||
timeoutId = sb.window.setTimeout(
|
||||
timeoutId = setTimeout(
|
||||
timeoutHandler, opts.timeout || DEFAULT_TIMEOUT);
|
||||
sb.window.addEventListener("unload", unloadHandler);
|
||||
|
||||
|
@ -266,3 +266,14 @@ class TestExecuteChrome(TestExecuteContent):
|
||||
var cb = arguments[arguments.length - 1];
|
||||
setTimeout(function() { cb() }, 250);
|
||||
""", script_timeout=100)
|
||||
|
||||
def test_invalid_chrome_handle(self):
|
||||
# Close second chrome window and don't switch back to the original one
|
||||
self.marionette.close_chrome_window()
|
||||
self.assertEqual(len(self.marionette.chrome_window_handles), 1)
|
||||
|
||||
# Call execute_script on an invalid chrome handle
|
||||
with self.marionette.using_context('chrome'):
|
||||
self.marionette.execute_script("""
|
||||
return true;
|
||||
""")
|
||||
|
Loading…
Reference in New Issue
Block a user