diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 6fccc82ca7..3d261e65c5 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -8,6 +8,9 @@
+
+ DOMParser.parseFromString() throws a TypeError.
+
Window.postMessage() throws a SyntaxError.
diff --git a/src/main/java/org/htmlunit/javascript/host/dom/DOMParser.java b/src/main/java/org/htmlunit/javascript/host/dom/DOMParser.java
index ecbaed1503..495aade45f 100644
--- a/src/main/java/org/htmlunit/javascript/host/dom/DOMParser.java
+++ b/src/main/java/org/htmlunit/javascript/host/dom/DOMParser.java
@@ -69,12 +69,12 @@ public Document parseFromString(final String str, final Object type) {
try {
final Document document = parseFromString(this, str, type);
if (document == null) {
- throw JavaScriptEngine.reportRuntimeError("Invalid 'type' parameter: " + type);
+ throw JavaScriptEngine.typeError("Invalid 'type' parameter: " + type);
}
return document;
}
catch (final IOException e) {
- throw JavaScriptEngine.reportRuntimeError("Parsing failed" + e.getMessage());
+ throw JavaScriptEngine.syntaxError("Parsing failed" + e.getMessage());
}
}
@@ -93,7 +93,7 @@ public Document parseFromString(final String str, final Object type) {
public static Document parseFromString(final HtmlUnitScriptable scriptable, final String str, final Object type)
throws IOException {
if (type == null || JavaScriptEngine.isUndefined(type)) {
- throw JavaScriptEngine.reportRuntimeError("Missing 'type' parameter");
+ throw JavaScriptEngine.typeError("Missing 'type' parameter");
}
if (MimeType.TEXT_XML.equals(type)