Diff
Modified: trunk/LayoutTests/imported/w3c/ChangeLog (222689 => 222690)
--- trunk/LayoutTests/imported/w3c/ChangeLog 2017-10-01 17:23:29 UTC (rev 222689)
+++ trunk/LayoutTests/imported/w3c/ChangeLog 2017-10-01 21:12:48 UTC (rev 222690)
@@ -1,3 +1,21 @@
+2017-10-01 Sam Weinig <s...@webkit.org>
+
+ XMLHttpRequest's responseXML should be annotated with [Exposed=Window]
+ https://bugs.webkit.org/show_bug.cgi?id=177714
+
+ Reviewed by Darin Adler.
+
+ * web-platform-tests/XMLHttpRequest/resources/responseType-document-in-worker.js: Added.
+ * web-platform-tests/XMLHttpRequest/resources/responseXML-unavailable-in-worker.js: Added.
+ * web-platform-tests/XMLHttpRequest/resources/w3c-import.log:
+ * web-platform-tests/XMLHttpRequest/responseType-document-in-worker.html: Added.
+ * web-platform-tests/XMLHttpRequest/responseXML-unavailable-in-worker.html: Added.
+ * web-platform-tests/XMLHttpRequest/w3c-import.log:
+
+ Import latest XMLHttpRequest tests that include tests for responseXML not
+ being available in workers and setting a responseType of 'document' being
+ a no-op in workers.
+
2017-09-27 Chris Dumez <cdu...@apple.com>
cssFloat missing in CSSPropertyDeclaration.prototype
Added: trunk/LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/resources/responseType-document-in-worker.js (0 => 222690)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/resources/responseType-document-in-worker.js (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/resources/responseType-document-in-worker.js 2017-10-01 21:12:48 UTC (rev 222690)
@@ -0,0 +1,9 @@
+self.importScripts('/resources/testharness.js');
+
+test(function() {
+ let xhr = new XMLHttpRequest();
+ xhr.responseType = "document";
+ assert_not_equals(xhr.responseType, "document");
+}, "Setting XMLHttpRequest responseType to 'document' in a worker should have no effect.");
+
+done();
Added: trunk/LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/resources/responseXML-unavailable-in-worker.js (0 => 222690)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/resources/responseXML-unavailable-in-worker.js (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/resources/responseXML-unavailable-in-worker.js 2017-10-01 21:12:48 UTC (rev 222690)
@@ -0,0 +1,9 @@
+self.importScripts('/resources/testharness.js');
+
+test(function() {
+ let xhr = new XMLHttpRequest();
+ assert_not_exists(xhr, "responseXML", "responseXML should not be available on instances.");
+ assert_not_exists(XMLHttpRequest.prototype, "responseXML", "responseXML should not be on the prototype.");
+}, "XMLHttpRequest's responseXML property should not be exposed in workers.");
+
+done();
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/resources/w3c-import.log (222689 => 222690)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/resources/w3c-import.log 2017-10-01 17:23:29 UTC (rev 222689)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/resources/w3c-import.log 2017-10-01 21:12:48 UTC (rev 222690)
@@ -71,6 +71,8 @@
/LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/resources/redirect.py
/LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/resources/requri.py
/LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/resources/reset-token.py
+/LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/resources/responseType-document-in-worker.js
+/LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/resources/responseXML-unavailable-in-worker.js
/LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/resources/send-after-setting-document-domain-window-1.htm
/LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/resources/send-after-setting-document-domain-window-2.htm
/LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/resources/send-after-setting-document-domain-window-helper.js
Added: trunk/LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/responseType-document-in-worker.html (0 => 222690)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/responseType-document-in-worker.html (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/responseType-document-in-worker.html 2017-10-01 21:12:48 UTC (rev 222690)
@@ -0,0 +1,13 @@
+<!doctype html>
+<html>
+<head>
+ <meta charset="utf-8">
+ <script src=""
+ <script src=""
+</head>
+<body>
+<script>
+ fetch_tests_from_worker(new Worker("resources/responseType-document-in-worker.js"));
+</script>
+</body>
+</html>
Added: trunk/LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/responseXML-unavailable-in-worker.html (0 => 222690)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/responseXML-unavailable-in-worker.html (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/responseXML-unavailable-in-worker.html 2017-10-01 21:12:48 UTC (rev 222690)
@@ -0,0 +1,13 @@
+<!doctype html>
+<html>
+<head>
+ <meta charset="utf-8">
+ <script src=""
+ <script src=""
+</head>
+<body>
+<script>
+ fetch_tests_from_worker(new Worker("resources/responseXML-unavailable-in-worker.js"));
+</script>
+</body>
+</html>
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/w3c-import.log (222689 => 222690)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/w3c-import.log 2017-10-01 17:23:29 UTC (rev 222689)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/w3c-import.log 2017-10-01 21:12:48 UTC (rev 222690)
@@ -169,6 +169,8 @@
/LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/response-json.htm
/LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/response-method.htm
/LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/responseText-status.html
+/LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/responseType-document-in-worker.html
+/LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/responseXML-unavailable-in-worker.html
/LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/responsetext-decoding.htm
/LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/responsetype.html
/LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/responseurl.html
Modified: trunk/Source/WebCore/ChangeLog (222689 => 222690)
--- trunk/Source/WebCore/ChangeLog 2017-10-01 17:23:29 UTC (rev 222689)
+++ trunk/Source/WebCore/ChangeLog 2017-10-01 21:12:48 UTC (rev 222690)
@@ -1,3 +1,29 @@
+2017-10-01 Sam Weinig <s...@webkit.org>
+
+ XMLHttpRequest's responseXML should be annotated with [Exposed=Window]
+ https://bugs.webkit.org/show_bug.cgi?id=177714
+
+ Reviewed by Darin Adler.
+
+ Tests: imported/w3c/web-platform-tests/XMLHttpRequest/responseType-document-in-worker.html
+ imported/w3c/web-platform-tests/XMLHttpRequest/responseXML-unavailable-in-worker.html
+
+ * xml/XMLHttpRequest.cpp:
+ (WebCore::XMLHttpRequest::responseXML):
+
+ Replace returning null for non-document contexts with an assertion now
+ that the bindings layer ensures this doesn't get called.
+
+ (WebCore::XMLHttpRequest::setResponseType):
+
+ Match the spec and turn attempts to set a responseType of 'document' in
+ non-documents contexts as a no-op.
+
+ * xml/XMLHttpRequest.idl:
+
+ Address FIXME and annotate responseXML with [Exposed=Window] now that it
+ is supported.
+
2017-09-30 Ryosuke Niwa <rn...@webkit.org>
Don't reveal file URL when pasting an image
Modified: trunk/Source/WebCore/xml/XMLHttpRequest.cpp (222689 => 222690)
--- trunk/Source/WebCore/xml/XMLHttpRequest.cpp 2017-10-01 17:23:29 UTC (rev 222689)
+++ trunk/Source/WebCore/xml/XMLHttpRequest.cpp 2017-10-01 21:12:48 UTC (rev 222690)
@@ -172,6 +172,8 @@
ExceptionOr<Document*> XMLHttpRequest::responseXML()
{
+ ASSERT(scriptExecutionContext()->isDocument());
+
if (m_responseType != ResponseType::EmptyString && m_responseType != ResponseType::Document)
return Exception { InvalidStateError };
@@ -185,8 +187,7 @@
// The W3C spec requires the final MIME type to be some valid XML type, or text/html.
// If it is text/html, then the responseType of "document" must have been supplied explicitly.
if ((m_response.isHTTP() && !responseIsXML() && !isHTML)
- || (isHTML && m_responseType == ResponseType::EmptyString)
- || scriptExecutionContext()->isWorkerGlobalScope()) {
+ || (isHTML && m_responseType == ResponseType::EmptyString)) {
m_responseDocument = nullptr;
} else {
if (isHTML)
@@ -252,6 +253,9 @@
ExceptionOr<void> XMLHttpRequest::setResponseType(ResponseType type)
{
+ if (!scriptExecutionContext()->isDocument() && type == ResponseType::Document)
+ return { };
+
if (m_state >= LOADING)
return Exception { InvalidStateError };
Modified: trunk/Source/WebCore/xml/XMLHttpRequest.idl (222689 => 222690)
--- trunk/Source/WebCore/xml/XMLHttpRequest.idl 2017-10-01 17:23:29 UTC (rev 222689)
+++ trunk/Source/WebCore/xml/XMLHttpRequest.idl 2017-10-01 21:12:48 UTC (rev 222690)
@@ -79,6 +79,5 @@
attribute XMLHttpRequestResponseType responseType;
[CachedAttribute, CustomGetter] readonly attribute any response;
readonly attribute USVString responseText;
- // FIXME: responseXML should be annotated with [Exposed=Window].
- readonly attribute Document? responseXML;
+ [Exposed=Window] readonly attribute Document? responseXML;
};