[Fetch] "NetworkError when attempting to fetch resource" exception when redirecting
Categories
(Core :: DOM: Networking, defect, P3)
Tracking
()
People
(Reporter: christian.hersevoort, Unassigned)
References
(Blocks 1 open bug)
Details
(Whiteboard: [necko-triaged][necko-priority-next])
Attachments
(1 file)
|
290 bytes,
text/html
|
Details |
Comment 1•9 years ago
|
||
Comment 2•9 years ago
|
||
Comment 3•9 years ago
|
||
| Reporter | ||
Comment 4•9 years ago
|
||
Comment 5•9 years ago
|
||
Comment 6•9 years ago
|
||
Comment 7•9 years ago
|
||
Comment 8•9 years ago
|
||
Comment 9•9 years ago
|
||
Comment 10•9 years ago
|
||
Comment 11•9 years ago
|
||
Comment 12•9 years ago
|
||
Comment 13•8 years ago
|
||
Comment 14•8 years ago
|
||
Comment 15•8 years ago
|
||
Comment 16•8 years ago
|
||
Comment 17•8 years ago
|
||
Comment 18•8 years ago
|
||
Comment 19•8 years ago
|
||
Comment 20•8 years ago
|
||
| Reporter | ||
Comment 21•8 years ago
|
||
Updated•8 years ago
|
Updated•8 years ago
|
Comment 22•7 years ago
|
||
| Assignee | ||
Updated•6 years ago
|
Comment 23•6 years ago
|
||
I believe I am still seeing this issue as well on Firefox 68. Here's my small repro: https://jsfiddle.net/jc4wku5a/
When I watch the debugger when executing this fiddle, I get:
starting
navigating away
caught TypeError: "NetworkError when attempting to fetch resource." TypeError
I see a TypeError instead of an AbortError
Comment 24•6 years ago
|
||
So is the issue in comment 23 just that the rejection is with a TypeError, not an AbortError?
Comment 25•6 years ago
|
||
(In reply to Boris Zbarsky [:bzbarsky, bz on IRC] from comment #24)
So is the issue in comment 23 just that the rejection is with a TypeError, not an AbortError?
Yes. comment 18 sounds like there was a change in FF57 that would cause an AbortError. Today in FF68, running the repro from comment 18 and my repro in comment 23 result in a TypeError, not AbortError.
Comment 26•6 years ago
|
||
OK. Andrew, do we want to just mutate this to do the "fire AbortError" thing, or should that be a separate bug (and mark this one invalid, since we do in fact want to terminate fetches on navigation)?
I should note that calling window.stop() while fetching on https://fetch-abort-demo.glitch.me/ throws a TypeError in Chrome and Safari, so we may need to file bugs on them too... It does look to me like the Fetch spec says to reject with an AbortError DOMException in that case, right?
Comment 27•6 years ago
|
||
Possibly-relevant spots are the hits on https://searchfox.org/mozilla-central/search?q=MSG_FETCH_FAILED&case=true in the tree and the caller at https://searchfox.org/mozilla-central/rev/053579099d936e26393ac10b809b14fb5841c0f0/dom/base/BodyStream.cpp#313 which is what I think the demo at https://fetch-abort-demo.glitch.me/ hits.
Updated•6 years ago
|
Comment 28•6 years ago
|
||
I think so, yes. Jake designed this and I thought he also added tests for this scenario, but maybe not.
Updated•6 years ago
|
Updated•5 years ago
|
Updated•5 years ago
|
Comment 29•4 years ago
|
||
In Firefox 94.0.2, reloading or clicking a link while a fetch request is being processed still throws a NetworkError. To reproduce, carry out any slow fetch and reload before it is complete.
Comment 30•3 years ago
|
||
Any progress with this here? I am getting this error a lot now (FF 100.01... )
Comment 31•3 years ago
|
||
We have trouble with this too. At least this request could be marked as 'aborted' not as an 'error' to handle ist correctly.
Comment 32•2 years ago
|
||
Hi, Is this still being worked on or is there a work around to handles NetworkError for this case only? Our monitoring system is logging a lot of NetworkError errors because of this and we don't have a clear way of handling them without missing on the actual NetworkErrors.
Comment 33•2 years ago
|
||
Redirect a needinfo that is pending on an inactive user to the triage owner.
:jesup, since the bug has recent activity, could you have a look please?
For more information, please visit BugBot documentation.
Comment 34•2 years ago
|
||
This still seems like it's something that we're following the spec on, and chrome & safari aren't, correct Olli?
Is there work to do here that would help with regards to AbortError? (see comment 25)
Updated•2 years ago
|
Comment 35•2 years ago
|
||
Attaching the repro in comment #23 as a static file.
The error is from mPromise->MaybeRejectWithTypeError<MSG_FETCH_FAILED>(); where the stack is:
xul.dll!mozilla::dom::MainThreadFetchResolver::OnResponseAvailableInternal(mozilla::SafeRefPtr<mozilla::dom::InternalResponse> aResponse) Line 761 (c:\Users\sasch\Documents\GitHub\gecko-dev\dom\fetch\Fetch.cpp:761)
xul.dll!mozilla::dom::FetchDriverObserver::OnResponseAvailable(mozilla::SafeRefPtr<mozilla::dom::InternalResponse> aResponse) Line 346 (c:\Users\sasch\Documents\GitHub\gecko-dev\dom\fetch\Fetch.cpp:346)
xul.dll!mozilla::dom::FetchDriver::FailWithNetworkError(nsresult rv) Line 943 (c:\Users\sasch\Documents\GitHub\gecko-dev\dom\fetch\FetchDriver.cpp:943)
xul.dll!mozilla::dom::FetchDriver::OnStartRequest(nsIRequest * aRequest) Line 979 (c:\Users\sasch\Documents\GitHub\gecko-dev\dom\fetch\FetchDriver.cpp:979)
xul.dll!nsCORSListenerProxy::OnStartRequest(nsIRequest * aRequest) Line 512 (c:\Users\sasch\Documents\GitHub\gecko-dev\netwerk\protocol\http\nsCORSListenerProxy.cpp:512)
xul.dll!mozilla::net::HttpChannelChild::DoNotifyListener() Line 1252 (c:\Users\sasch\Documents\GitHub\gecko-dev\netwerk\protocol\http\HttpChannelChild.cpp:1252)
xul.dll!mozilla::net::HttpAsyncAborter<mozilla::net::HttpChannelChild>::HandleAsyncAbort() Line 1119 (c:\Users\sasch\Documents\GitHub\gecko-dev\obj-x86_64-pc-windows-msvc\dist\include\mozilla\net\HttpBaseChannel.h:1119)
xul.dll!mozilla::net::HttpChannelChild::HandleAsyncAbort() Line 1135 (c:\Users\sasch\Documents\GitHub\gecko-dev\netwerk\protocol\http\HttpChannelChild.cpp:1135)
xul.dll!mozilla::net::HttpChannelChild::FailedAsyncOpen(const nsresult & status) Line 1158 (c:\Users\sasch\Documents\GitHub\gecko-dev\netwerk\protocol\http\HttpChannelChild.cpp:1158)
xul.dll!mozilla::net::HttpChannelChild::RecvFailedAsyncOpen::<lambda_24>::operator()() Line 1127 (c:\Users\sasch\Documents\GitHub\gecko-dev\netwerk\protocol\http\HttpChannelChild.cpp:1127)
xul.dll!std::invoke<`lambda at C:/Users/sasch/Documents/GitHub/gecko-dev/netwerk/protocol/http/HttpChannelChild.cpp:1125:13' &>(mozilla::net::HttpChannelChild::RecvFailedAsyncOpen::<lambda_24> & _Obj) Line 1524 (c:\Users\sasch\.mozbuild\vs\VC\Tools\MSVC\14.29.30133\include\type_traits:1524)
xul.dll!std::_Invoker_ret<void,1>::_Call<`lambda at C:/Users/sasch/Documents/GitHub/gecko-dev/netwerk/protocol/http/HttpChannelChild.cpp:1125:13' &>(mozilla::net::HttpChannelChild::RecvFailedAsyncOpen::<lambda_24> & _Func) Line 652 (c:\Users\sasch\.mozbuild\vs\VC\Tools\MSVC\14.29.30133\include\functional:652)
xul.dll!std::_Func_impl_no_alloc<`lambda at C:/Users/sasch/Documents/GitHub/gecko-dev/netwerk/protocol/http/HttpChannelChild.cpp:1125:13',void>::_Do_call() Line 822 (c:\Users\sasch\.mozbuild\vs\VC\Tools\MSVC\14.29.30133\include\functional:822)
xul.dll!std::_Func_class<void>::operator()() Line 869 (c:\Users\sasch\.mozbuild\vs\VC\Tools\MSVC\14.29.30133\include\functional:869)
xul.dll!mozilla::net::ChannelFunctionEvent::Run() Line 55 (c:\Users\sasch\Documents\GitHub\gecko-dev\obj-x86_64-pc-windows-msvc\dist\include\mozilla\net\ChannelEventQueue.h:55)
xul.dll!mozilla::net::ChannelEventQueue::RunOrEnqueue(mozilla::net::ChannelEvent * aCallback, bool aAssertionWhenNotQueued) Line 248 (c:\Users\sasch\Documents\GitHub\gecko-dev\obj-x86_64-pc-windows-msvc\dist\include\mozilla\net\ChannelEventQueue.h:248)
xul.dll!mozilla::net::HttpChannelChild::RecvFailedAsyncOpen(const nsresult & aStatus) Line 1124 (c:\Users\sasch\Documents\GitHub\gecko-dev\netwerk\protocol\http\HttpChannelChild.cpp:1124)
xul.dll!mozilla::net::PHttpChannelChild::OnMessageReceived(const IPC::Message & msg__) Line 532 (c:\Users\sasch\Documents\GitHub\gecko-dev\obj-x86_64-pc-windows-msvc\ipc\ipdl\PHttpChannelChild.cpp:532)
xul.dll!mozilla::dom::PContentChild::OnMessageReceived(const IPC::Message & msg__) Line 8818 (c:\Users\sasch\Documents\GitHub\gecko-dev\obj-x86_64-pc-windows-msvc\ipc\ipdl\PContentChild.cpp:8818)
xul.dll!mozilla::dom::ContentChild::OnMessageReceived(const IPC::Message & aMsg) Line 3765 (c:\Users\sasch\Documents\GitHub\gecko-dev\dom\ipc\ContentChild.cpp:3765)
xul.dll!mozilla::ipc::MessageChannel::DispatchAsyncMessage(mozilla::ipc::ActorLifecycleProxy * aProxy, const IPC::Message & aMsg) Line 1811 (c:\Users\sasch\Documents\GitHub\gecko-dev\ipc\glue\MessageChannel.cpp:1811)
...
And the spec says in step 12.3:
If response is a network error, then reject p with a TypeError and abort these steps.
So the error being TypeError is probably fine. But I think the core issue is that we get an error when Blink does not, rather than the type of the error?
Comment 36•2 years ago
|
||
Also the spec:
The user agent may terminate an ongoing fetch if that termination is not observable through script.
(Example) The user agent cannot terminate the fetch because the termination can be observed through the promise.
So we incorrectly expose the termination as a form of error.
Comment 37•2 years ago
|
||
(In reply to Kagami [:saschanaz] from comment #36)
So we incorrectly expose the termination as a form of error.
I guess that suggests that FetchDriver should specially handle NS_BINDING_ABORTED to eat the error and potentially neuter the promise if we think this is from coming from some variation of the load group canceling everything (also happens in the LoadGroup destructor, or maybe there are other ways for it to happen too?).
Updated•2 years ago
|
Updated•2 years ago
|
Comment 38•1 year ago
|
||
Typo sent this to neck-next I think
Description
•