Backout f5aaf21d0a2b (bug 722596) for python 2.6 compat issues

This commit is contained in:
Ed Morley 2012-12-17 22:06:21 +00:00
parent 3db1ad17e1
commit 2426589905
2 changed files with 24 additions and 32 deletions

View File

@ -4,25 +4,27 @@
import os
from marionette_test import MarionetteTestCase
from errors import JavascriptException
# boiler plate for the initial navigation and frame switch
def switch_to_window_verify(test, start_url, frame, verify_title, verify_url):
test.assertTrue(test.marionette.execute_script("window.location.href = 'about:blank'; return true;"))
test.assertEqual("about:blank", test.marionette.execute_script("return window.location.href;"))
test_html = test.marionette.absolute_url(start_url)
test.marionette.navigate(test_html)
test.assertNotEqual("about:blank", test.marionette.execute_script("return window.location.href;"))
test.assertEqual(verify_title, test.marionette.title)
test.marionette.switch_to_frame(frame)
test.assertTrue(verify_url in test.marionette.get_url())
class TestSwitchFrame(MarionetteTestCase):
def test_switch_simple(self):
switch_to_window_verify(self, "test_iframe.html", "test_iframe", "Marionette IFrame Test", "test.html")
self.assertTrue(self.marionette.execute_script("window.location.href = 'about:blank'; return true;"))
self.assertEqual("about:blank", self.marionette.execute_script("return window.location.href;"))
test_html = self.marionette.absolute_url("test_iframe.html")
self.marionette.navigate(test_html)
self.assertNotEqual("about:blank", self.marionette.execute_script("return window.location.href;"))
self.assertEqual("Marionette IFrame Test", self.marionette.title)
self.marionette.switch_to_frame("test_iframe")
self.assertTrue("test.html" in self.marionette.get_url())
def test_switch_nested(self):
switch_to_window_verify(self, "test_nested_iframe.html", "test_iframe", "Marionette IFrame Test", "test_inner_iframe.html")
self.assertTrue(self.marionette.execute_script("window.location.href = 'about:blank'; return true;"))
self.assertEqual("about:blank", self.marionette.execute_script("return window.location.href;"))
test_html = self.marionette.absolute_url("test_nested_iframe.html")
self.marionette.navigate(test_html)
self.assertNotEqual("about:blank", self.marionette.execute_script("return window.location.href;"))
self.assertEqual("Marionette IFrame Test", self.marionette.title)
self.marionette.switch_to_frame("test_iframe")
self.assertTrue("test_inner_iframe.html" in self.marionette.get_url())
self.marionette.switch_to_frame("inner_frame")
self.assertTrue("test.html" in self.marionette.get_url())
self.marionette.switch_to_frame() # go back to main frame
@ -30,12 +32,6 @@ class TestSwitchFrame(MarionetteTestCase):
#test that we're using the right window object server-side
self.assertTrue("test_nested_iframe.html" in self.marionette.execute_script("return window.location.href;"))
def test_stack_trace(self):
switch_to_window_verify(self, "test_iframe.html", "test_iframe", "Marionette IFrame Test", "test.html")
with self.assertRaises(JavascriptException) as cm:
self.marionette.execute_async_script("foo();")
self.assertTrue("foo" in cm.exception.msg)
class TestSwitchFrameChrome(MarionetteTestCase):
def setUp(self):
MarionetteTestCase.setUp(self)
@ -66,9 +62,6 @@ class TestSwitchFrameChrome(MarionetteTestCase):
self.marionette.switch_to_frame()
self.assertTrue("test.xul" in self.marionette.get_url())
def test_stack_trace(self):
self.assertTrue("test.xul" in self.marionette.get_url())
self.marionette.switch_to_frame(0)
with self.assertRaises(JavascriptException) as cm:
self.marionette.execute_async_script("foo();")
self.assertTrue("foo" in cm.exception.msg)
#I can't seem to access a xul iframe within a xul iframe
def test_switch_nested(self):
pass

View File

@ -50,7 +50,6 @@ let sandbox;
let asyncTestRunning = false;
let asyncTestCommandId;
let asyncTestTimeoutId;
let originalOnError;
//timer for doc changes
let checkTimer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
@ -482,11 +481,11 @@ function executeWithCallback(msg, useFinish) {
sandbox.asyncComplete('timed out', 28);
}, msg.json.timeout);
originalOnError = curWindow.onerror;
curWindow.onerror = function errHandler(errMsg, url, line) {
sandbox.asyncComplete(errMsg, 17);
curWindow.onerror = originalOnError;
};
curWindow.addEventListener('error', function win__onerror(evt) {
curWindow.removeEventListener('error', win__onerror, true);
sandbox.asyncComplete(evt, 17);
return true;
}, true);
let scriptSrc;
if (useFinish) {