PageDataChild: Return null channelInfo on non-HTTP channel

Rather than throwing. Fixes requireSuccessfulStatus on file: (etc.)
URIs.
This commit is contained in:
Abe Jellinek 2024-05-06 13:21:26 -04:00 committed by Dan Stillman
parent 9b7d3edbb3
commit 5f8ea3af9c

View file

@ -31,6 +31,7 @@ class PageDataChild extends JSWindowActorChild {
case "channelInfo": {
let docShell = this.contentWindow.docShell;
try {
let channel = (docShell.currentDocumentChannel || docShell.failedChannel)
?.QueryInterface(Ci.nsIHttpChannel);
if (channel) {
@ -39,9 +40,9 @@ class PageDataChild extends JSWindowActorChild {
responseStatusText: channel.responseStatusText
};
}
else {
return null;
}
catch (e) {}
return null;
}
}
}