Bug 1734573 - Call errorCheck after onStartRequest, r=mixedpuppy

Differential Revision: https://phabricator.services.mozilla.com/D132358
This commit is contained in:
Kershaw Chang 2021-12-07 11:45:39 +00:00
Родитель 0d043867db
Коммит 84ce7c5e68
1 изменённых файлов: 8 добавлений и 6 удалений

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

@ -744,11 +744,12 @@ HttpObserverManager = {
lastActivity &&
lastActivity !== this.GOOD_LAST_ACTIVITY
) {
// Make a trip through the event loop to make sure errors have a
// chance to be processed before we fall back to a generic error
// string.
Services.tm.dispatchToMainThread(() => {
channel.errorCheck();
// Since the channel's security info is assigned in onStartRequest and
// errorCheck is called in ChannelWrapper::onStartRequest, we should check
// the errorString after onStartRequest to make sure errors have a chance
// to be processed before we fall back to a generic error string.
let onStart = function() {
channel.removeEventListener("start", onStart);
if (!channel.errorString) {
this.runChannelListener(channel, "onErrorOccurred", {
error:
@ -756,7 +757,8 @@ HttpObserverManager = {
`NS_ERROR_NET_UNKNOWN_${lastActivity}`,
});
}
});
};
channel.addEventListener("start", onStart);
} else if (
lastActivity !== this.GOOD_LAST_ACTIVITY &&
lastActivity !==