LayoutTests/imported/w3c:
preflight checker should add a console message when preflight load is blocked
https://bugs.webkit.org/show_bug.cgi?id=185021
Reviewed by Chris Dumez.
* web-platform-tests/XMLHttpRequest/send-authentication-basic-cors-expected.txt:
* web-platform-tests/cors/late-upload-events-expected.txt:
Source/WebCore:
CORS preflight checker should add a console message when preflight load is blocked
https://bugs.webkit.org/show_bug.cgi?id=185021
Reviewed by Chris Dumez.
No change of behavior, adding a JS console message when preflight load is blocked.
This mirrors what is being done in preflighting done from NetworkProcess.
Covered by existing tests.
* loader/CrossOriginPreflightChecker.cpp:
(WebCore::CrossOriginPreflightChecker::notifyFinished):
(WebCore::CrossOriginPreflightChecker::doPreflight):
LayoutTests:
CORS preflight checker should add a console message when preflight load is blocked
https://bugs.webkit.org/show_bug.cgi?id=185021
Reviewed by Chris Dumez.
* TestExpectations: Skipping console JS logging for some WPT tests to keep them consistent between WK1 and WK2.
* http/tests/xmlhttprequest/redirect-cross-origin-post-expected.txt:
* http/tests/xmlhttprequest/simple-cross-origin-denied-events-post-expected.txt:
* platform/mac-wk1/imported/w3c/web-platform-tests/XMLHttpRequest/send-authentication-cors-basic-setrequestheader-expected.txt: Removed.
* platform/mac-wk1/imported/w3c/web-platform-tests/XMLHttpRequest/send-authentication-cors-setrequestheader-no-cred-expected.txt: Removed.
* platform/mac-wk1/imported/w3c/web-platform-tests/cors/request-headers-expected.txt: Removed.
* platform/win/imported/w3c/web-platform-tests/XMLHttpRequest/send-authentication-cors-basic-setrequestheader-expected.txt: Removed.
* platform/win/imported/w3c/web-platform-tests/XMLHttpRequest/send-authentication-cors-setrequestheader-no-cred-expected.txt: Removed.
* platform/win/imported/w3c/web-platform-tests/cors/request-headers-expected.txt: Removed.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@231056 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WebCore/loader/CrossOriginPreflightChecker.cpp b/Source/WebCore/loader/CrossOriginPreflightChecker.cpp
index f2c5f5c..7e55616 100644
--- a/Source/WebCore/loader/CrossOriginPreflightChecker.cpp
+++ b/Source/WebCore/loader/CrossOriginPreflightChecker.cpp
@@ -92,6 +92,8 @@
if (preflightError.isNull() || preflightError.isCancellation() || preflightError.isGeneral())
preflightError.setType(ResourceError::Type::AccessControl);
+ if (!preflightError.isTimeout())
+ m_loader.document().addConsoleMessage(MessageSource::Security, MessageLevel::Error, ASCIILiteral("CORS-preflight request was blocked"));
m_loader.preflightFailure(m_resource->identifier(), preflightError);
return;
}
@@ -140,6 +142,10 @@
// FIXME:: According fetch, we should just pass the error to the layer above. But this may impact some clients like XHR or EventSource.
if (error.isCancellation() || error.isGeneral())
error.setType(ResourceError::Type::AccessControl);
+
+ if (!error.isTimeout())
+ loader.document().addConsoleMessage(MessageSource::Security, MessageLevel::Error, ASCIILiteral("CORS-preflight request was blocked"));
+
loader.preflightFailure(identifier, error);
return;
}