Title: [209134] trunk/Source/WebCore
Revision
209134
Author
commit-qu...@webkit.org
Date
2016-11-30 10:01:36 -0800 (Wed, 30 Nov 2016)

Log Message

Web Inspector: Null ResourceResponse Preflight requests cause crash
https://bugs.webkit.org/show_bug.cgi?id=165120
<rdar://problem/27911350>

Patch by Joseph Pecoraro <pecor...@apple.com> on 2016-11-30
Reviewed by Brian Burg.

* loader/CrossOriginPreflightChecker.cpp:
(WebCore::CrossOriginPreflightChecker::validatePreflightResponse):
Only inform Web Inspector about successful responses. Informing with a
null response would break the expected Inspector API contract when
notifying about did receive response. Also, when informing Web Inspector
include a didFinishLoading event so the frontend knows this pre-flight
request is complete.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (209133 => 209134)


--- trunk/Source/WebCore/ChangeLog	2016-11-30 17:53:12 UTC (rev 209133)
+++ trunk/Source/WebCore/ChangeLog	2016-11-30 18:01:36 UTC (rev 209134)
@@ -1,3 +1,19 @@
+2016-11-30  Joseph Pecoraro  <pecor...@apple.com>
+
+        Web Inspector: Null ResourceResponse Preflight requests cause crash
+        https://bugs.webkit.org/show_bug.cgi?id=165120
+        <rdar://problem/27911350>
+
+        Reviewed by Brian Burg.
+
+        * loader/CrossOriginPreflightChecker.cpp:
+        (WebCore::CrossOriginPreflightChecker::validatePreflightResponse):
+        Only inform Web Inspector about successful responses. Informing with a
+        null response would break the expected Inspector API contract when
+        notifying about did receive response. Also, when informing Web Inspector
+        include a didFinishLoading event so the frontend knows this pre-flight
+        request is complete.
+
 2016-11-30  Brady Eidson  <beid...@apple.com>
 
         REGRESSION (209086): IDB tests crash under GuardMalloc.

Modified: trunk/Source/WebCore/loader/CrossOriginPreflightChecker.cpp (209133 => 209134)


--- trunk/Source/WebCore/loader/CrossOriginPreflightChecker.cpp	2016-11-30 17:53:12 UTC (rev 209133)
+++ trunk/Source/WebCore/loader/CrossOriginPreflightChecker.cpp	2016-11-30 18:01:36 UTC (rev 209134)
@@ -60,8 +60,6 @@
 {
     Frame* frame = loader.document().frame();
     ASSERT(frame);
-    auto cookie = InspectorInstrumentation::willReceiveResourceResponse(frame);
-    InspectorInstrumentation::didReceiveResourceResponse(cookie, identifier, frame->loader().documentLoader(), response, 0);
 
     if (!response.isSuccessful()) {
         loader.preflightFailure(identifier, ResourceError(errorDomainWebKitInternal, 0, request.url(), ASCIILiteral("Preflight response is not successful"), ResourceError::Type::AccessControl));
@@ -82,6 +80,13 @@
         return;
     }
 
+    // FIXME: <https://webkit.org/b/164889> Web Inspector: Show Preflight Request information in inspector
+    // This is only showing success preflight requests and responses but we should show network events
+    // for preflight failures and distinguish them better from non-preflight requests.
+    auto cookie = InspectorInstrumentation::willReceiveResourceResponse(frame);
+    InspectorInstrumentation::didReceiveResourceResponse(cookie, identifier, frame->loader().documentLoader(), response, nullptr);
+    InspectorInstrumentation::didFinishLoading(frame, frame->loader().documentLoader(), identifier, 0);
+
     CrossOriginPreflightResultCache::singleton().appendEntry(loader.securityOrigin().toString(), request.url(), WTFMove(result));
     loader.preflightSuccess(WTFMove(request));
 }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to