Fix erroneous ASSERT in DocumentThreadableLoader::didFail
https://bugs.webkit.org/show_bug.cgi?id=180549

Patch by Youenn Fablet <youenn@apple.com> on 2017-12-07
Reviewed by Alex Christensen.

* loader/DocumentThreadableLoader.cpp:
(WebCore::DocumentThreadableLoader::didFail): ASSERT was checking whether the optional was null.
This could never be the case since we move the value of the optional, not the optional itself.
Ensure that the optional value is null so that we are sure request is being loaded and make the optional null just after that.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@225648 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WebCore/loader/DocumentThreadableLoader.cpp b/Source/WebCore/loader/DocumentThreadableLoader.cpp
index 385ae2e3..102cd56 100644
--- a/Source/WebCore/loader/DocumentThreadableLoader.cpp
+++ b/Source/WebCore/loader/DocumentThreadableLoader.cpp
@@ -410,7 +410,8 @@
 
         m_options.serviceWorkersMode = ServiceWorkersMode::None;
         makeCrossOriginAccessRequestWithPreflight(WTFMove(m_bypassingPreflightForServiceWorkerRequest.value()));
-        ASSERT(!m_bypassingPreflightForServiceWorkerRequest);
+        ASSERT(m_bypassingPreflightForServiceWorkerRequest->isNull());
+        m_bypassingPreflightForServiceWorkerRequest = std::nullopt;
         return;
     }
 #endif