Diff
Modified: branches/safari-605-branch/LayoutTests/ChangeLog (227115 => 227116)
--- branches/safari-605-branch/LayoutTests/ChangeLog 2018-01-18 05:47:43 UTC (rev 227115)
+++ branches/safari-605-branch/LayoutTests/ChangeLog 2018-01-18 05:47:47 UTC (rev 227116)
@@ -1,3 +1,23 @@
+2018-01-17 Jason Marcell <[email protected]>
+
+ Cherry-pick r227074. rdar://problem/36598123
+
+ 2018-01-17 Daniel Bates <[email protected]>
+
+ ASSERTION FAILED: !m_completionHandler in PingHandle::~PingHandle()
+ https://bugs.webkit.org/show_bug.cgi?id=181746
+ <rdar://problem/36586248>
+
+ Reviewed by Chris Dumez.
+
+ Adds a test to ensure that loading a protected image from a beforeunload handler
+ does not cause an assertion failure.
+
+ * http/tests/misc/before-unload-load-image-expected.txt: Added.
+ * http/tests/misc/before-unload-load-image.html: Added.
+ * http/tests/misc/resources/before-unload-in-subframe-child.html: Added.
+ * http/tests/misc/resources/protected/protected-image.php: Added.
+
2018-01-16 Jason Marcell <[email protected]>
Cherry-pick r226916. rdar://problem/36568057
Added: branches/safari-605-branch/LayoutTests/http/tests/misc/before-unload-load-image-expected.txt (0 => 227116)
--- branches/safari-605-branch/LayoutTests/http/tests/misc/before-unload-load-image-expected.txt (rev 0)
+++ branches/safari-605-branch/LayoutTests/http/tests/misc/before-unload-load-image-expected.txt 2018-01-18 05:47:47 UTC (rev 227116)
@@ -0,0 +1,2 @@
+PASS did not cause assertion failure.
+
Added: branches/safari-605-branch/LayoutTests/http/tests/misc/before-unload-load-image.html (0 => 227116)
--- branches/safari-605-branch/LayoutTests/http/tests/misc/before-unload-load-image.html (rev 0)
+++ branches/safari-605-branch/LayoutTests/http/tests/misc/before-unload-load-image.html 2018-01-18 05:47:47 UTC (rev 227116)
@@ -0,0 +1,49 @@
+<!DOCTYPE html>
+<html>
+<body>
+<pre id="log">FAIL did cause assertion failure.</pre>
+<script>
+if (window.testRunner) {
+ testRunner.dumpAsText();
+ testRunner.setHandlesAuthenticationChallenges(true);
+ testRunner.setAuthenticationUsername("testUser");
+ testRunner.setAuthenticationPassword("testPassword");
+ testRunner.waitUntilDone();
+}
+
+var log = document.getElementById("log");
+var isDone = false;
+
+function done()
+{
+ isDone = true;
+ window.setTimeout(() => {
+ log.innerHTML = "PASS did not cause assertion failure.";
+ if (window.testRunner)
+ testRunner.notifyDone();
+ }, 0);
+}
+
+function test(iframe)
+{
+ if (iframe.didLoad) {
+ done();
+ return;
+ }
+ iframe.didLoad = true;
+ iframe.contentWindow.location.href = ""
+}
+
+function fired(contentWindow)
+{
+ if (isDone)
+ return;
+ var image = new contentWindow.Image;
+ image.src = ""
+}
+
+
+</script>
+<iframe _onload_="test(this);" src=""
+</body>
+</html>
Added: branches/safari-605-branch/LayoutTests/http/tests/misc/resources/before-unload-in-subframe-child.html (0 => 227116)
--- branches/safari-605-branch/LayoutTests/http/tests/misc/resources/before-unload-in-subframe-child.html (rev 0)
+++ branches/safari-605-branch/LayoutTests/http/tests/misc/resources/before-unload-in-subframe-child.html 2018-01-18 05:47:47 UTC (rev 227116)
@@ -0,0 +1,12 @@
+<!DOCTYPE html>
+<html>
+<body _onbeforeunload_="top.fired(window); return null;">
+Child loaded.
+<script>
+
+if (top.loaded)
+ top.loaded();
+
+</script>
+</body>
+</html>
Added: branches/safari-605-branch/LayoutTests/http/tests/misc/resources/protected/protected-image.php (0 => 227116)
--- branches/safari-605-branch/LayoutTests/http/tests/misc/resources/protected/protected-image.php (rev 0)
+++ branches/safari-605-branch/LayoutTests/http/tests/misc/resources/protected/protected-image.php 2018-01-18 05:47:47 UTC (rev 227116)
@@ -0,0 +1,12 @@
+<?php
+header("Cache-Control: no-store");
+header("Connection: close");
+if (!isset($_SERVER["PHP_AUTH_USER"])) {
+ header("WWW-authenticate: Basic realm=\"" . $_SERVER["REQUEST_URI"] . "\"");
+ header("HTTP/1.0 401 Unauthorized");
+ exit;
+}
+// Authenticated
+header("Content-Type: image/png");
+echo file_get_contents("../../../security/contentSecurityPolicy/block-all-mixed-content/resources/red-square.png");
+?>
Modified: branches/safari-605-branch/Source/WebCore/ChangeLog (227115 => 227116)
--- branches/safari-605-branch/Source/WebCore/ChangeLog 2018-01-18 05:47:43 UTC (rev 227115)
+++ branches/safari-605-branch/Source/WebCore/ChangeLog 2018-01-18 05:47:47 UTC (rev 227116)
@@ -1,5 +1,27 @@
2018-01-17 Jason Marcell <[email protected]>
+ Cherry-pick r227074. rdar://problem/36598123
+
+ 2018-01-17 Daniel Bates <[email protected]>
+
+ ASSERTION FAILED: !m_completionHandler in PingHandle::~PingHandle()
+ https://bugs.webkit.org/show_bug.cgi?id=181746
+ <rdar://problem/36586248>
+
+ Reviewed by Chris Dumez.
+
+ Call PingHandle::pingLoadComplete() with an error when NSURLConnection queries
+ whether the ping is able to respond to an authentication request. (Pings do not
+ respond to authenticate requests.) It will call the completion handler, nullify
+ the completion handler, and deallocate the PingHandle. Nullifying the completion
+ handler is necessary to avoid the assertion failure in ~PingHandle().
+
+ Test: http/tests/misc/before-unload-load-image.html
+
+ * platform/network/PingHandle.h:
+
+2018-01-17 Jason Marcell <[email protected]>
+
Cherry-pick r227073. rdar://problem/36598265
2018-01-17 Daniel Bates <[email protected]>
Modified: branches/safari-605-branch/Source/WebCore/platform/network/PingHandle.h (227115 => 227116)
--- branches/safari-605-branch/Source/WebCore/platform/network/PingHandle.h 2018-01-18 05:47:43 UTC (rev 227115)
+++ branches/safari-605-branch/Source/WebCore/platform/network/PingHandle.h 2018-01-18 05:47:47 UTC (rev 227116)
@@ -81,7 +81,7 @@
void canAuthenticateAgainstProtectionSpaceAsync(ResourceHandle*, const ProtectionSpace&)
{
m_handle->continueCanAuthenticateAgainstProtectionSpace(false);
- delete this;
+ pingLoadComplete(ResourceError { String { }, 0, m_currentRequest.url(), ASCIILiteral("Not allowed to authenticate"), ResourceError::Type::AccessControl });
}
#endif