Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(207)

Unified Diff: LayoutTests/fast/dom/domparser-parsefromstring-mimetype-support.html

Issue 24483007: Make DOMParser::parseFromString specification compliant and throw exception in error scenario. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Patch after adding descriptive message. Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | LayoutTests/fast/dom/domparser-parsefromstring-mimetype-support-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/fast/dom/domparser-parsefromstring-mimetype-support.html
diff --git a/LayoutTests/fast/dom/domparser-parsefromstring-mimetype-support.html b/LayoutTests/fast/dom/domparser-parsefromstring-mimetype-support.html
index 4c7f080bc5a852a2bcc2161481fcbe2a2afa5072..69540dadfdefff7d4d7ae3f8b94a72cd897c7fbf 100644
--- a/LayoutTests/fast/dom/domparser-parsefromstring-mimetype-support.html
+++ b/LayoutTests/fast/dom/domparser-parsefromstring-mimetype-support.html
@@ -109,24 +109,28 @@ function shouldSupport(content, mimeType)
document.body.appendChild(document.createElement("br"));
}
-function shouldNotSupport(content, mimeType)
+function shouldThrowException(content, mimeType)
{
var description = document.createElement("div");
- description.innerHTML = (++count) + ". Should NOT support mime-type = \"" + mimeType + "\"";
+ description.innerHTML = (++count) + ". Should THROW exception for mime-type = \"" + mimeType + "\"";
document.body.appendChild(description);
var parser = new DOMParser();
- var resultDocument = parser.parseFromString(content, mimeType);
- if (!resultDocument) {
- var result = document.createElement("div");
- result.className = "pass";
- result.textContent = "PASS";
- document.body.appendChild(result);
- } else {
+ try {
+ parser.parseFromString(content, mimeType);
var result = document.createElement("div");
result.className = "fail";
result.textContent = "FAIL";
document.body.appendChild(result);
+ } catch (exception) {
+ var message = document.createElement("div");
+ message.className = "pass";
+ message.textContent = exception;
+ document.body.appendChild(message);
+ var result = document.createElement("div");
+ result.className = "pass";
+ result.textContent = "PASS";
+ document.body.appendChild(result);
}
document.body.appendChild(document.createElement("br"));
}
@@ -141,7 +145,10 @@ function runTest()
shouldSupport(xmlContent, "application/xml");
shouldSupport(xhtmlContent, "application/xhtml+xml");
shouldSupport(svgImageContent, "image/svg+xml");
- shouldNotSupport(xslContent, "text/xsl");
+ shouldThrowException(xslContent, "text/xsl");
+ shouldThrowException(xmlContent, "text/dummy+xml");
+ shouldThrowException(xmlContent, "text/XML");
+ shouldThrowException(xmlContent, "TEXT/html");
}
</script>
</head>
« no previous file with comments | « no previous file | LayoutTests/fast/dom/domparser-parsefromstring-mimetype-support-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698