Bug 1430117 - Checking NS_BINDING_ABORTED to avoid dispatching navigate event r=ochameau

MozReview-Commit-ID: hMLQS7Sfhg

--HG--
extra : rebase_source : 3b91bcefb582a2373c74958cd1dafa33704cabcf
This commit is contained in:
Ricky Chien 2018-01-12 22:37:33 +08:00
Родитель 5ed414705f
Коммит f127cbaff3
1 изменённых файлов: 6 добавлений и 2 удалений

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

@ -1636,7 +1636,11 @@ DebuggerProgressListener.prototype = {
if (isWindow && isStop) {
// Don't dispatch "navigate" event just yet when there is a redirect to
// about:neterror page.
if (request.status != Cr.NS_OK) {
// Navigating to about:neterror will make `status` be something else than NS_OK.
// But for some error like NS_BINDING_ABORTED we don't want to emit any `navigate`
// event as the page load has been cancelled and the related page document is going
// to be a dead wrapper.
if (request.status != Cr.NS_OK && request.status != Cr.NS_BINDING_ABORTED) {
// Instead, listen for DOMContentLoaded as about:neterror is loaded
// with LOAD_BACKGROUND flags and never dispatches load event.
// That may be the same reason why there is no onStateChange event
@ -1644,7 +1648,7 @@ DebuggerProgressListener.prototype = {
let handler = getDocShellChromeEventHandler(progress);
let onLoad = evt => {
// Ignore events from iframes
if (!Cu.isDeadWrapper(window) && evt.target === window.document) {
if (evt.target === window.document) {
handler.removeEventListener("DOMContentLoaded", onLoad, true);
this._tabActor._navigate(window);
}