-
Notifications
You must be signed in to change notification settings - Fork 1.7k
dart:html XMLHttpRequest.responseXML throws an exception #1142
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Added Triaged label. |
Unlike the SVGDocument case, we don't really want to pretend an XMLDocument is an HTMLDocument. One solution would be to reintroduce the original bare bones Document class but with a different name. Ugly strawman: class XMLDocument { ... } class Document extends XMLDocument Set owner to @nex3. |
Removed the owner. |
This appears to be functioning correctly on the latest bits, though the hierarchy for Document is currently a bit odd. |
If you do an AJAX request for an XML document and then try to access the document using .responseXML, it fails to wrap it. Example:
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-type" content="text/html;charset=UTF-8" />
<script src="script.js"></script>
</head>
<body></body>
</html>
import('dart:html');
main() {
XMLHttpRequest a = new XMLHttpRequest();
a.open("GET", "http://localhost:8000/test.xml", true);
a.on.readyStateChange.add(void b(e) {
if (a.readyState == 4 && a.status == 200)
a.responseXML;
});
a.send();
}
When it gets to responseXML, it fails in wrapDocument:
static Document wrapDocument(raw) {
if (raw === null) { return null; }
if (raw.dartObjectLocalStorage !== null) {
return raw.dartObjectLocalStorage;
}
switch (raw.typeName) {
case "HTMLDocument":
return new DocumentWrappingImplementation._wrap(raw, raw.documentElement);
case "SVGDocument":
return new SVGDocumentWrappingImplementation._wrap(raw);
default:
throw new UnsupportedOperationException("Unknown type:" + raw.toString());
}
}
The problem is that the raw object is a base Document (i.e. XML), not HTMLDocument or SVGDocument. My guess is that we'll want an explicit XMLDocument type in dart:html to handle this.
The text was updated successfully, but these errors were encountered: