Diff
Modified: trunk/LayoutTests/ChangeLog (204162 => 204163)
--- trunk/LayoutTests/ChangeLog 2016-08-05 06:46:55 UTC (rev 204162)
+++ trunk/LayoutTests/ChangeLog 2016-08-05 07:25:15 UTC (rev 204163)
@@ -1,3 +1,17 @@
+2016-08-05 Youenn Fablet <you...@apple.com>
+
+ DocumentThreadableLoader should report an error when getting a null CachedResource
+ https://bugs.webkit.org/show_bug.cgi?id=160444
+
+ Reviewed by Alex Christensen.
+
+ * fast/frames/frame-unload-crash.html:
+ * http/tests/contentextensions/async-xhr-onerror-expected.txt:
+ * http/tests/eventsource/eventsource-reconnect-during-navigate-crash-expected.txt:
+ * http/tests/navigation/subframe-pagehide-handler-starts-load-expected.txt:
+ * http/tests/navigation/subframe-pagehide-handler-starts-load2-expected.txt:
+ * http/tests/security/mixedContent/insecure-xhr-in-main-frame-expected.txt:
+
2016-08-04 Chris Dumez <cdu...@apple.com>
Move insertAdjacent*() API from HTMLElement to Element
Modified: trunk/LayoutTests/fast/frames/frame-unload-crash-expected.txt (204162 => 204163)
--- trunk/LayoutTests/fast/frames/frame-unload-crash-expected.txt 2016-08-05 06:46:55 UTC (rev 204162)
+++ trunk/LayoutTests/fast/frames/frame-unload-crash-expected.txt 2016-08-05 07:25:15 UTC (rev 204163)
@@ -1,4 +1,5 @@
frame "<!--framePath //<!--frame0-->/<!--frame0-->-->" - has 1 onunload handler(s)
+CONSOLE MESSAGE: line 13: XMLHttpRequest cannot load frame-unload-crash-2.html due to access control checks.
This is a test for bug 25136: CRASH in DocumentLoader::removeSubresourceLoader due to null m_frame. If successful, PASS should be printed below.
PASS
Modified: trunk/LayoutTests/http/tests/contentextensions/async-xhr-onerror-expected.txt (204162 => 204163)
--- trunk/LayoutTests/http/tests/contentextensions/async-xhr-onerror-expected.txt 2016-08-05 06:46:55 UTC (rev 204162)
+++ trunk/LayoutTests/http/tests/contentextensions/async-xhr-onerror-expected.txt 2016-08-05 07:25:15 UTC (rev 204163)
@@ -1,5 +1,7 @@
CONSOLE MESSAGE: line 30: Content blocker prevented frame displaying http://127.0.0.1:8000/contentextensions/async-xhr-onerror.html from loading a resource from http://127.0.0.1:8000/contentextensions/resources/url-blocking-test.js
+CONSOLE MESSAGE: line 30: XMLHttpRequest cannot load http://127.0.0.1:8000/contentextensions/resources/url-blocking-test.js due to access control checks.
CONSOLE MESSAGE: line 30: Content blocker prevented frame displaying http://127.0.0.1:8000/contentextensions/async-xhr-onerror.html from loading a resource from http://127.0.0.1:8000/contentextensions/resources/url-blocking-test.js
+CONSOLE MESSAGE: line 30: XMLHttpRequest cannot load http://127.0.0.1:8000/contentextensions/resources/url-blocking-test.js due to access control checks.
Asynchronous onreadystatechange status: 0, readyState:1, responseText:
Finished runTest. Waiting for callbacks
Asynchronous onreadystatechange status: 0, readyState:1, responseText:
Modified: trunk/LayoutTests/http/tests/eventsource/eventsource-reconnect-during-navigate-crash-expected.txt (204162 => 204163)
--- trunk/LayoutTests/http/tests/eventsource/eventsource-reconnect-during-navigate-crash-expected.txt 2016-08-05 06:46:55 UTC (rev 204162)
+++ trunk/LayoutTests/http/tests/eventsource/eventsource-reconnect-during-navigate-crash-expected.txt 2016-08-05 07:25:15 UTC (rev 204163)
@@ -1 +1,2 @@
+CONSOLE MESSAGE: EventSource cannot load http://127.0.0.1:8000/eventsource/resources/reconnect.php.
Modified: trunk/LayoutTests/http/tests/navigation/subframe-pagehide-handler-starts-load-expected.txt (204162 => 204163)
--- trunk/LayoutTests/http/tests/navigation/subframe-pagehide-handler-starts-load-expected.txt 2016-08-05 06:46:55 UTC (rev 204162)
+++ trunk/LayoutTests/http/tests/navigation/subframe-pagehide-handler-starts-load-expected.txt 2016-08-05 07:25:15 UTC (rev 204163)
@@ -1,3 +1,4 @@
+CONSOLE MESSAGE: line 8: XMLHttpRequest cannot load http://127.0.0.1:8000/navigation/resources/resources/slow-resource.pl?delay=3000 due to access control checks.
Tests that we don't crash when a load is started in a subframe on 'pagehide' handling
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
Modified: trunk/LayoutTests/http/tests/navigation/subframe-pagehide-handler-starts-load2-expected.txt (204162 => 204163)
--- trunk/LayoutTests/http/tests/navigation/subframe-pagehide-handler-starts-load2-expected.txt 2016-08-05 06:46:55 UTC (rev 204162)
+++ trunk/LayoutTests/http/tests/navigation/subframe-pagehide-handler-starts-load2-expected.txt 2016-08-05 07:25:15 UTC (rev 204163)
@@ -1,3 +1,4 @@
+CONSOLE MESSAGE: line 9: XMLHttpRequest cannot load http://127.0.0.1:8000/navigation/resources/resources/slow-resource.pl?delay=3000 due to access control checks.
Tests that we don't crash when a load is started in a subframe on 'pagehide' handling
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
Modified: trunk/LayoutTests/http/tests/security/mixedContent/insecure-xhr-in-main-frame-expected.txt (204162 => 204163)
--- trunk/LayoutTests/http/tests/security/mixedContent/insecure-xhr-in-main-frame-expected.txt 2016-08-05 06:46:55 UTC (rev 204162)
+++ trunk/LayoutTests/http/tests/security/mixedContent/insecure-xhr-in-main-frame-expected.txt 2016-08-05 07:25:15 UTC (rev 204163)
@@ -1,3 +1,4 @@
CONSOLE MESSAGE: line 28: [blocked] The page at https://127.0.0.1:8443/security/mixedContent/resources/insecure-xhr-in-main-frame-window.html was not allowed to display insecure content from http://127.0.0.1:8000/.
+CONSOLE MESSAGE: line 28: XMLHttpRequest cannot load http://127.0.0.1:8000/ due to access control checks.
This test opens a HTTPS window that loads insecure data via XHR. We should trigger a mixed content callback because the main frame in the window is HTTPS but now has insecure data.
Modified: trunk/LayoutTests/imported/w3c/ChangeLog (204162 => 204163)
--- trunk/LayoutTests/imported/w3c/ChangeLog 2016-08-05 06:46:55 UTC (rev 204162)
+++ trunk/LayoutTests/imported/w3c/ChangeLog 2016-08-05 07:25:15 UTC (rev 204163)
@@ -1,3 +1,16 @@
+2016-08-05 Youenn Fablet <you...@apple.com>
+
+ DocumentThreadableLoader should report an error when getting a null CachedResource
+ https://bugs.webkit.org/show_bug.cgi?id=160444
+
+ Reviewed by Alex Christensen.
+
+ * web-platform-tests/XMLHttpRequest/event-error-expected.txt:
+ * web-platform-tests/XMLHttpRequest/getresponseheader-error-state-expected.txt:
+ * web-platform-tests/XMLHttpRequest/timeout-cors-async-expected.txt:
+ * web-platform-tests/fetch/api/cors/cors-cookies-expected.txt:
+ * web-platform-tests/fetch/api/cors/cors-cookies-worker-expected.txt:
+
2016-08-04 Chris Dumez <cdu...@apple.com>
Add support for DOMTokenList.replace()
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/event-error-expected.txt (204162 => 204163)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/event-error-expected.txt 2016-08-05 06:46:55 UTC (rev 204162)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/event-error-expected.txt 2016-08-05 07:25:15 UTC (rev 204163)
@@ -1,4 +1,5 @@
Blocked access to external URL http://example.nonexist/
+CONSOLE MESSAGE: line 22: XMLHttpRequest cannot load http://example.nonexist/ due to access control checks.
PASS XMLHttpRequest Test: event - error
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/getresponseheader-error-state-expected.txt (204162 => 204163)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/getresponseheader-error-state-expected.txt 2016-08-05 06:46:55 UTC (rev 204162)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/getresponseheader-error-state-expected.txt 2016-08-05 07:25:15 UTC (rev 204163)
@@ -1,4 +1,5 @@
Blocked access to external URL http://www1.localhost:8800/XMLHttpRequest/resources/nocors/folder.txt
+CONSOLE MESSAGE: line 32: XMLHttpRequest cannot load http://www1.localhost:8800/XMLHttpRequest/resources/nocors/folder.txt due to access control checks.
PASS XMLHttpRequest: getResponseHeader() in error state (failing cross-origin test)
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/timeout-cors-async-expected.txt (204162 => 204163)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/timeout-cors-async-expected.txt 2016-08-05 06:46:55 UTC (rev 204162)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/timeout-cors-async-expected.txt 2016-08-05 07:25:15 UTC (rev 204163)
@@ -1,4 +1,5 @@
Blocked access to external URL http://www2.localhost:8800/XMLHttpRequest/resources/corsenabled.py?delay=2&code=200
+CONSOLE MESSAGE: line 40: XMLHttpRequest cannot load http://www2.localhost:8800/XMLHttpRequest/resources/corsenabled.py?delay=2&code=200 due to access control checks.
FAIL XMLHttpRequest: timeout event and cross-origin request assert_true: timeout event should fire expected true got false
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-cookies-expected.txt (204162 => 204163)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-cookies-expected.txt 2016-08-05 06:46:55 UTC (rev 204162)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-cookies-expected.txt 2016-08-05 07:25:15 UTC (rev 204163)
@@ -1,11 +1,9 @@
Blocked access to external URL http://www.localhost:8800/fetch/api/resources/inspect-headers.py?cors&headers=cookie
-Harness Error (TIMEOUT), message = null
-
PASS Omit mode: no cookie sent
FAIL Include mode: 1 cookie assert_equals: Request includes cookie(s) expected (string) "a=1" but got (object) null
PASS Include mode: local cookies are not sent with remote request
PASS Include mode: remote cookies are not sent with local request
PASS Same-origin mode: cookies are discarded in cors request
-TIMEOUT Include mode: remote cookies are not sent with other remote request Test timed out
+FAIL Include mode: remote cookies are not sent with other remote request promise_test: Unhandled rejection with value: object "TypeError: Type error"
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-cookies-worker-expected.txt (204162 => 204163)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-cookies-worker-expected.txt 2016-08-05 06:46:55 UTC (rev 204162)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-cookies-worker-expected.txt 2016-08-05 07:25:15 UTC (rev 204163)
@@ -1,11 +1,9 @@
Blocked access to external URL http://www.localhost:8800/fetch/api/resources/inspect-headers.py?cors&headers=cookie
-Harness Error (TIMEOUT), message = null
-
PASS Omit mode: no cookie sent
FAIL Include mode: 1 cookie assert_equals: Request includes cookie(s) expected (string) "a=1" but got (object) null
PASS Include mode: local cookies are not sent with remote request
PASS Include mode: remote cookies are not sent with local request
PASS Same-origin mode: cookies are discarded in cors request
-TIMEOUT Include mode: remote cookies are not sent with other remote request Test timed out
+FAIL Include mode: remote cookies are not sent with other remote request promise_test: Unhandled rejection with value: object "TypeError: Type error"
Modified: trunk/Source/WebCore/ChangeLog (204162 => 204163)
--- trunk/Source/WebCore/ChangeLog 2016-08-05 06:46:55 UTC (rev 204162)
+++ trunk/Source/WebCore/ChangeLog 2016-08-05 07:25:15 UTC (rev 204163)
@@ -1,3 +1,22 @@
+2016-08-05 Youenn Fablet <you...@apple.com>
+
+ DocumentThreadableLoader should report an error when getting a null CachedResource
+ https://bugs.webkit.org/show_bug.cgi?id=160444
+
+ Reviewed by Alex Christensen.
+
+ Covered by existing and rebased tests.
+
+ * loader/DocumentThreadableLoader.cpp:
+ (WebCore::DocumentThreadableLoader::loadRequest): Calling didFail with an AccessControl error if unable to have a CachedResource.
+ The resource error type AccessControl is important as it indicates to some clients that they should not retry loading the same resource (EventSource notably).
+ * xml/XMLHttpRequest.cpp:
+ (WebCore::XMLHttpRequest::createRequest): Removed handling of ThreadableLoader::create returning null.
+ This should be handled in didFail callback. This allows aligning behavior of
+ WorkerThreadableLoaderi::MainThreadBridge and XMLHttpRequest as ThreadableLoader clients.
+ (WebCore::XMLHttpRequest::didFail): Handle the case of didFail being called synchronously from ThreadableLoader::create.
+ In that case, use a timer to dispatch network events asynchronously.
+
2016-08-04 Chris Dumez <cdu...@apple.com>
Add support for DOMTokenList.replace()
Modified: trunk/Source/WebCore/loader/DocumentThreadableLoader.cpp (204162 => 204163)
--- trunk/Source/WebCore/loader/DocumentThreadableLoader.cpp 2016-08-05 06:46:55 UTC (rev 204162)
+++ trunk/Source/WebCore/loader/DocumentThreadableLoader.cpp 2016-08-05 07:25:15 UTC (rev 204163)
@@ -368,7 +368,10 @@
m_resource = m_document.cachedResourceLoader().requestRawResource(newRequest);
if (m_resource)
m_resource->addClient(this);
-
+ else {
+ // FIXME: Since we receive a synchronous error, this is probably due to some AccessControl checks. We should try to retrieve the actual error.
+ m_client->didFail(ResourceError(String(), 0, newRequest.resourceRequest().url(), String(), ResourceError::Type::AccessControl));
+ }
return;
}
Modified: trunk/Source/WebCore/xml/XMLHttpRequest.cpp (204162 => 204163)
--- trunk/Source/WebCore/xml/XMLHttpRequest.cpp 2016-08-05 06:46:55 UTC (rev 204162)
+++ trunk/Source/WebCore/xml/XMLHttpRequest.cpp 2016-08-05 07:25:15 UTC (rev 204163)
@@ -715,15 +715,14 @@
// FIXME: Maybe we need to be able to send XMLHttpRequests from onunload, <http://bugs.webkit.org/show_bug.cgi?id=10904>.
m_loader = ThreadableLoader::create(*scriptExecutionContext(), *this, WTFMove(request), options);
+ // Either loader is null or some error was synchronously sent to us.
+ ASSERT(m_loader || !m_sendFlag);
+
// Neither this object nor the _javascript_ wrapper should be deleted while
// a request is in progress because we need to keep the listeners alive,
// and they are referenced by the _javascript_ wrapper.
- setPendingActivity(this);
- if (!m_loader) {
- m_sendFlag = false;
- m_timeoutTimer.stop();
- m_networkErrorTimer.startOneShot(0);
- }
+ if (m_loader)
+ setPendingActivity(this);
} else {
InspectorInstrumentation::willLoadXHRSynchronously(scriptExecutionContext());
ThreadableLoader::loadResourceSynchronously(*scriptExecutionContext(), WTFMove(request), *this, options);
@@ -956,7 +955,6 @@
void XMLHttpRequest::didFail(const ResourceError& error)
{
-
// If we are already in an error state, for instance we called abort(), bail out early.
if (m_error)
return;
@@ -982,6 +980,14 @@
logConsoleError(scriptExecutionContext(), message);
}
+ // In case didFail is called synchronously on an asynchronous XHR call, let's dispatch network error asynchronously
+ if (m_async && m_sendFlag && !m_loader) {
+ m_sendFlag = false;
+ setPendingActivity(this);
+ m_timeoutTimer.stop();
+ m_networkErrorTimer.startOneShot(0);
+ return;
+ }
m_exceptionCode = NETWORK_ERR;
networkError();
}