[Webkit-unassigned] [Bug 192728] wtf/Optional.h: move-constructor and move-assignment operator should disengage the value being moved from

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Sat Dec 15 14:09:22 PST 2018


https://bugs.webkit.org/show_bug.cgi?id=192728

--- Comment #22 from Chris Dumez <cdumez at apple.com> ---
(In reply to David Kilzer (:ddkilzer) from comment #20)
> (In reply to David Kilzer (:ddkilzer) from comment #15)
> > (In reply to Saam Barati from comment #9)
> > > I think we should move this out of namespace std if we’re going to add
> > > behavior like this that we’re going to rely on.
> > 
> > So wtf::optional?  I think we should ask whether the standard implementation
> > can also be fixed.
> > 
> > Looks like this change may have found a bug (a test now consistently failing
> > that didn't before the patch):
> > 
> > Regressions: Unexpected text-only failures (1)
> >   imported/w3c/web-platform-tests/fetch/api/request/request-disturbed.html [
> > Failure ]
> 
> So WebCore::FetchBodyOwner::isDisturbed() depends on
> WebCore::FetchBodyOwner::isBodyNull(), and isBodyNull() returns true if
> WebCore::FetchBodyOwner::m_body is "engaged" (which means it either
> currently holds a value or has held a value in the past, so it directly
> relies on the current std::optional<> behavior):
> 
>     std::optional<FetchBody> m_body;
> 
> Good times.

I believe the issue is with this move:
ExceptionOr<void> FetchRequest::setBody(FetchRequest& request)
{
    if (!request.isBodyNull()) {
        if (!methodCanHaveBody(m_request))
            return Exception { TypeError, makeString("Request has method '", m_request.httpMethod(), "' and cannot have a body") };
        // FIXME: If body has a readable stream, we should pipe it to this new body stream.
        m_body = WTFMove(request.m_body); // here
        request.setDisturbed();
    }

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20181215/06a08ac3/attachment.html>


More information about the webkit-unassigned mailing list