mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 06:11:37 +00:00
Bug 1099331 - Allow navigation resulting in about:blocked or about:error pages when explicitly requested without returning an error from the marionette server.;r=automatedtester
This allows navigation resulting in a blocked or error page without returning an error to the client. If an error page is reached, an error is returned in cases this was not specifically requested in the client: client.navigate("about:neterror") will navigate to this page and return to the client without an error, but client.navigate("does.not.exist.") will return to the client with an error as it has previously.
This commit is contained in:
parent
11a1ff5261
commit
a641e6246c
@ -90,6 +90,14 @@ class TestNavigate(MarionetteTestCase):
|
||||
print traceback.format_exc()
|
||||
self.fail("Should have thrown a MarionetteException instead of %s" % type(inst))
|
||||
|
||||
@skip_if_b2g # about:blocked isn't a well formed uri on b2g
|
||||
def test_should_navigate_to_requested_about_page(self):
|
||||
self.marionette.navigate("about:neterror")
|
||||
self.assertEqual(self.marionette.get_url(), "about:neterror")
|
||||
self.marionette.navigate(self.marionette.absolute_url("test.html"))
|
||||
self.marionette.navigate("about:blocked")
|
||||
self.assertEqual(self.marionette.get_url(), "about:blocked")
|
||||
|
||||
def test_find_element_state_complete(self):
|
||||
test_html = self.marionette.absolute_url("test.html")
|
||||
self.marionette.navigate(test_html)
|
||||
|
@ -1281,19 +1281,23 @@ function get(msg) {
|
||||
function checkLoad() {
|
||||
checkTimer.cancel();
|
||||
end = new Date().getTime();
|
||||
let errorRegex = /about:.+(error)|(blocked)\?/;
|
||||
let aboutErrorRegex = /about:.+(error)\?/;
|
||||
let elapse = end - start;
|
||||
if (msg.json.pageTimeout == null || elapse <= msg.json.pageTimeout) {
|
||||
if (curFrame.document.readyState == "complete") {
|
||||
removeEventListener("DOMContentLoaded", onDOMContentLoaded, false);
|
||||
sendOk(command_id);
|
||||
}
|
||||
else if (curFrame.document.readyState == "interactive" &&
|
||||
errorRegex.exec(curFrame.document.baseURI)) {
|
||||
} else if (curFrame.document.readyState == "interactive" &&
|
||||
aboutErrorRegex.exec(curFrame.document.baseURI) &&
|
||||
!curFrame.document.baseURI.startsWith(msg.json.url)) {
|
||||
// We have reached an error url without requesting it.
|
||||
removeEventListener("DOMContentLoaded", onDOMContentLoaded, false);
|
||||
sendError("Error loading page", 13, null, command_id);
|
||||
}
|
||||
else {
|
||||
} else if (curFrame.document.readyState == "interactive" &&
|
||||
curFrame.document.baseURI.startsWith("about:")) {
|
||||
removeEventListener("DOMContentLoaded", onDOMContentLoaded, false);
|
||||
sendOk(command_id);
|
||||
} else {
|
||||
checkTimer.initWithCallback(checkLoad, 100, Ci.nsITimer.TYPE_ONE_SHOT);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user