Bug 196757

Summary: Cache API should return Abort error in case of putting an aborted fetch
Product: WebKit Reporter: youenn fablet <youennf>
Component: Service WorkersAssignee: youenn fablet <youennf>
Status: RESOLVED FIXED    
Severity: Normal CC: achristensen, beidson, cdumez, commit-queue, darin, ryanhaddad, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch for landing none

Description youenn fablet 2019-04-09 18:26:34 PDT
Cache API should return Abort error in case of putting an aborted fetch
Comment 1 youenn fablet 2019-04-09 18:27:54 PDT
<rdar://problem/49755566>
Comment 2 youenn fablet 2019-04-09 18:31:13 PDT
Created attachment 367093 [details]
Patch
Comment 3 Ryan Haddad 2019-04-12 11:46:58 PDT
Looks like EWS is all green. Who should review this?
Comment 4 Darin Adler 2019-04-13 13:49:42 PDT
Comment on attachment 367093 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=367093&action=review

> Source/WebCore/ChangeLog:8
> +        In case of an aborted fetch, return consume callback with an AbortError.

I don’t understand what "return consume callback" means. I think you mean "invoke consume callback" or "call consume callback".

> Source/WebCore/Modules/fetch/FetchResponse.cpp:217
> +        if (auto bodyLoader = WTFMove(m_bodyLoader))

I am not sure that just doing std::move is a resilient design in cases like this. Using std::exchange gives a stronger guarantee that m_bodyLoader will actually become null and likely generates identical code. I have used std::move for this in the past but I am less sure now than I was then.
Comment 5 youenn fablet 2019-04-22 13:21:31 PDT
Comment on attachment 367093 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=367093&action=review

>> Source/WebCore/ChangeLog:8
>> +        In case of an aborted fetch, return consume callback with an AbortError.
> 
> I don’t understand what "return consume callback" means. I think you mean "invoke consume callback" or "call consume callback".

Right, call consume callback is more appropriate.

>> Source/WebCore/Modules/fetch/FetchResponse.cpp:217
>> +        if (auto bodyLoader = WTFMove(m_bodyLoader))
> 
> I am not sure that just doing std::move is a resilient design in cases like this. Using std::exchange gives a stronger guarantee that m_bodyLoader will actually become null and likely generates identical code. I have used std::move for this in the past but I am less sure now than I was then.

True. That said, we forked std::optional specifically to use this pattern.
Comment 6 youenn fablet 2019-04-22 13:28:50 PDT
Created attachment 367965 [details]
Patch for landing
Comment 7 WebKit Commit Bot 2019-04-22 15:12:09 PDT
Comment on attachment 367965 [details]
Patch for landing

Clearing flags on attachment: 367965

Committed r244515: <https://trac.webkit.org/changeset/244515>
Comment 8 WebKit Commit Bot 2019-04-22 15:12:11 PDT
All reviewed patches have been landed.  Closing bug.