PageDataChild: Return null channelInfo on non-HTTP channel
Rather than throwing. Fixes requireSuccessfulStatus on file: (etc.) URIs.
This commit is contained in:
parent
9b7d3edbb3
commit
5f8ea3af9c
1 changed files with 11 additions and 10 deletions
|
@ -31,17 +31,18 @@ class PageDataChild extends JSWindowActorChild {
|
|||
|
||||
case "channelInfo": {
|
||||
let docShell = this.contentWindow.docShell;
|
||||
let channel = (docShell.currentDocumentChannel || docShell.failedChannel)
|
||||
?.QueryInterface(Ci.nsIHttpChannel);
|
||||
if (channel) {
|
||||
return {
|
||||
responseStatus: channel.responseStatus,
|
||||
responseStatusText: channel.responseStatusText
|
||||
};
|
||||
}
|
||||
else {
|
||||
return null;
|
||||
try {
|
||||
let channel = (docShell.currentDocumentChannel || docShell.failedChannel)
|
||||
?.QueryInterface(Ci.nsIHttpChannel);
|
||||
if (channel) {
|
||||
return {
|
||||
responseStatus: channel.responseStatus,
|
||||
responseStatusText: channel.responseStatusText
|
||||
};
|
||||
}
|
||||
}
|
||||
catch (e) {}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue