Bug 1312674 - Navigating to about:blank for a new docshell should not timeout. r=ato

MozReview-Commit-ID: 3nmqJKEmu0p

--HG--
extra : rebase_source : 0c75d7259f9c377087300c8c3d2d59724614ed10
This commit is contained in:
Henrik Skupin 2016-11-28 13:32:11 +01:00
Родитель c8bf6d2c07
Коммит d892209f99
2 изменённых файлов: 26 добавлений и 7 удалений

Просмотреть файл

@ -6,7 +6,7 @@ import time
import urllib
import contextlib
from marionette import MarionetteTestCase
from marionette import MarionetteTestCase, WindowManagerMixin
from marionette_driver import errors, By, Wait
@ -14,14 +14,20 @@ def inline(doc):
return "data:text/html;charset=utf-8,%s" % urllib.quote(doc)
class TestNavigate(MarionetteTestCase):
class TestNavigate(WindowManagerMixin, MarionetteTestCase):
def setUp(self):
MarionetteTestCase.setUp(self)
super(TestNavigate, self).setUp()
self.marionette.navigate("about:")
self.test_doc = self.marionette.absolute_url("test.html")
self.iframe_doc = self.marionette.absolute_url("test_iframe.html")
def tearDown(self):
self.close_all_windows()
super(TestNavigate, self).tearDown()
@property
def location_href(self):
return self.marionette.execute_script("return window.location.href")
@ -141,6 +147,17 @@ class TestNavigate(MarionetteTestCase):
self.assertTrue(self.marionette.execute_script(
"return window.visited", sandbox=None))
def test_about_blank_for_new_docshell(self):
""" Bug 1312674 - Hang when loading about:blank for a new docshell."""
# Open a window to get a new docshell created for the first tab
with self.marionette.using_context("chrome"):
tab = self.open_tab(lambda: self.marionette.execute_script(" window.open() "))
self.marionette.switch_to_window(tab)
self.marionette.navigate('about:blank')
self.marionette.close()
self.marionette.switch_to_window(self.start_window)
def test_error_on_tls_navigation(self):
self.assertRaises(errors.InsecureCertificateException,
self.marionette.navigate, self.fixtures.where_is("/test.html", on="https"))

Просмотреть файл

@ -996,11 +996,13 @@ function get(msg) {
sawLoad = true;
}
// We also need to make sure that the DOMContentLoaded we saw isn't
// for the initial about:blank of a newly created docShell.
let loadedNonAboutBlank = docShell.hasLoadedNonBlankURI;
// We also need to make sure that if the requested URL is not about:blank
// the DOMContentLoaded we saw isn't for the initial about:blank of a newly
// created docShell.
let loadedRequestedURI = (requestedURL == "about:blank") ||
docShell.hasLoadedNonBlankURI;
if (correctFrame && sawLoad && loadedNonAboutBlank) {
if (correctFrame && sawLoad && loadedRequestedURI) {
webProgress.removeProgressListener(loadListener);
pollForReadyState(msg, start, () => {
removeEventListener("DOMContentLoaded", onDOMContentLoaded, false);