Closed
Bug 1486698
Opened 6 years ago
Closed 6 years ago
Throw for disturbed/locked streams more often
Categories
(Core :: DOM: Core & HTML, enhancement, P2)
Core
DOM: Core & HTML
Tracking
()
RESOLVED
FIXED
mozilla65
Tracking | Status | |
---|---|---|
firefox65 | --- | fixed |
People
(Reporter: annevk, Assigned: baku)
References
(Blocks 1 open bug)
Details
Attachments
(1 file, 1 obsolete file)
14.54 KB,
patch
|
bzbarsky
:
review+
|
Details | Diff | Splinter Review |
In https://github.com/whatwg/fetch/pull/801, tests synced by bug 1485601, the decision was made to throw for more ReadableStream states. It'd be good to align with that before streams are shipped.
Updated•6 years ago
|
Priority: -- → P2
Assignee | ||
Comment 1•6 years ago
|
||
Assignee: nobody → amarchesini
Assignee | ||
Comment 2•6 years ago
|
||
Attachment #9021429 -
Attachment is obsolete: true
Comment 4•6 years ago
|
||
Comment on attachment 9021430 [details] [diff] [review]
stream_busy.patch
>+++ b/dom/cache/Cache.cpp
>- ErrorResult result;
>+ IgnoredErrorResult result;
If this is just working around the JS exception asserts, then the right thing is not this change but to call result.WouldReportJSException() right before the check that ensures that failures are handled.
>+++ b/dom/fetch/Fetch.cpp
> FetchBody<Derived>::GetBodyUsed(ErrorResult& aRv) const
>- // If this stream is disturbed or locked, return true.
>+ // If this stream is disturbed, return true.
I don't see this change in the referenced PR. Was this code wrong even before that? I assume there are now tests that catch this (by passing in locked or non-readable streams and expecting this to not throw)?
>+++ b/dom/fetch/FetchStreamReader.cpp
>- MOZ_ASSERT(mReader);
>+ if (aCx && mReader) {
Why this change? Commit message should explain.
>+++ b/dom/fetch/Response.cpp
>- if (disturbed || locked || !readable) {
>+ if (disturbed || locked) {
So this also used to not match the spec? Again, there are tests covering this?
> Response::Clone(JSContext* aCx, ErrorResult& aRv)
>+++ b/dom/serviceworkers/ServiceWorkerEvents.cpp
>- ErrorResult error;
>+ IgnoredErrorResult error;
Again, WouldReportJSException() before the Failed() check would be better.
>@@ -752,17 +752,17 @@ RespondWithHandler::ResolvedCallback(JSC
>- ErrorResult error;
>+ IgnoredErrorResult error;
And here.
>+++ b/dom/serviceworkers/ServiceWorkerScriptCache.cpp
>@@ -645,26 +643,28 @@ private:
>+ IgnoredErrorResult result;
> RefPtr<Promise> cachePromise = aCache->Put(aCx, request, *response, result);
And here.
>+ result.WouldReportJSException();
Doing this on the path where we're not reporting the exception is ... odd. ;) Again, do it right before the Failed() check.
>+++ b/dom/workers/ScriptLoader.cpp
>- ErrorResult error;
>+ IgnoredErrorResult error;
Same thing as above.
r=me
Flags: needinfo?(bzbarsky)
Attachment #9021430 -
Flags: review+
Assignee | ||
Comment 5•6 years ago
|
||
> I don't see this change in the referenced PR. Was this code wrong even
> before that? I assume there are now tests that catch this (by passing in
> locked or non-readable streams and expecting this to not throw)?
Yes. It was already broken. There are tests, and we were failing them all. The patch contains the removal of a .ini file for WPTs.
> >+++ b/dom/fetch/FetchStreamReader.cpp
> >- MOZ_ASSERT(mReader);
> >+ if (aCx && mReader) {
>
> Why this change? Commit message should explain.
Because of this: https://searchfox.org/mozilla-central/rev/fc3d974254660b34638b2af9d5431618b191b233/dom/fetch/FetchStreamReader.cpp#160-167
if the reader creation fails, we call CloseAndRelease() without having mReader. I'll update the commit message.
> >+++ b/dom/fetch/Response.cpp
> >- if (disturbed || locked || !readable) {
> >+ if (disturbed || locked) {
>
> So this also used to not match the spec? Again, there are tests covering
> this?
Yes. In response-stream-disturbed-6.html.
Pushed by amarchesini@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/544498045a9c
Update Fetch+Stream implementation to throw when the stream is disturbed or locked, r=bz
Comment 7•6 years ago
|
||
bugherder |
Status: NEW → RESOLVED
Closed: 6 years ago
status-firefox65:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla65
Updated•6 years ago
|
Component: DOM → DOM: Core & HTML
Updated•5 years ago
|
Regressions: CVE-2019-9819
You need to log in
before you can comment on or make changes to this bug.
Description
•