Title: [203313] trunk
Revision
203313
Author
[email protected]
Date
2016-07-15 17:46:23 -0700 (Fri, 15 Jul 2016)

Log Message

Update XPathException to use the description in toString().
https://bugs.webkit.org/show_bug.cgi?id=159848

Reviewed by Alex Christensen.

Source/WebCore:

No new tests (Covered by changes to existing tests).

* bindings/js/JSDOMBinding.cpp:
(WebCore::createDOMException):
* xml/XPathException.h:
(WebCore::XPathException::XPathException):

LayoutTests:

* fast/dom/DOMException/XPathException-expected.txt:
* fast/dom/DOMException/resources/XPathException.js:
* fast/xpath/4XPath/Core/test_parser-expected.txt:
* fast/xpath/invalid-functions-expected.txt:
* fast/xpath/py-dom-xpath/expressions-expected.txt:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (203312 => 203313)


--- trunk/LayoutTests/ChangeLog	2016-07-16 00:39:50 UTC (rev 203312)
+++ trunk/LayoutTests/ChangeLog	2016-07-16 00:46:23 UTC (rev 203313)
@@ -1,5 +1,18 @@
 2016-07-15  Brady Eidson  <[email protected]>
 
+        Update XPathException to use the description in toString().
+        https://bugs.webkit.org/show_bug.cgi?id=159848
+
+        Reviewed by Alex Christensen.
+
+        * fast/dom/DOMException/XPathException-expected.txt:
+        * fast/dom/DOMException/resources/XPathException.js:
+        * fast/xpath/4XPath/Core/test_parser-expected.txt:
+        * fast/xpath/invalid-functions-expected.txt:
+        * fast/xpath/py-dom-xpath/expressions-expected.txt:
+
+2016-07-15  Brady Eidson  <[email protected]>
+
         Change toString() behavior for exceptions constructed with "createWithDescriptionAsMessage".
         https://bugs.webkit.org/show_bug.cgi?id=159839
 

Modified: trunk/LayoutTests/fast/dom/DOMException/XPathException-expected.txt (203312 => 203313)


--- trunk/LayoutTests/fast/dom/DOMException/XPathException-expected.txt	2016-07-16 00:39:50 UTC (rev 203312)
+++ trunk/LayoutTests/fast/dom/DOMException/XPathException-expected.txt	2016-07-16 00:46:23 UTC (rev 203313)
@@ -3,7 +3,7 @@
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
 
-PASS e.toString() is "Error: TYPE_ERR: DOM XPath Exception 52"
+PASS e.toString() is "TYPE_ERR (DOM XPath Exception 52): The _expression_ could not be converted to return the specified type."
 PASS Object.prototype.toString.call(e) is "[object XPathException]"
 PASS Object.prototype.toString.call(e.__proto__) is "[object XPathExceptionPrototype]"
 PASS e.constructor.toString() is "function XPathException() {\n    [native code]\n}"

Modified: trunk/LayoutTests/fast/dom/DOMException/resources/XPathException.js (203312 => 203313)


--- trunk/LayoutTests/fast/dom/DOMException/resources/XPathException.js	2016-07-16 00:39:50 UTC (rev 203312)
+++ trunk/LayoutTests/fast/dom/DOMException/resources/XPathException.js	2016-07-16 00:46:23 UTC (rev 203313)
@@ -11,7 +11,7 @@
     e = err;
 }
 
-shouldBeEqualToString("e.toString()", "Error: TYPE_ERR: DOM XPath Exception 52");
+shouldBeEqualToString("e.toString()", "TYPE_ERR (DOM XPath Exception 52): The _expression_ could not be converted to return the specified type.");
 shouldBeEqualToString("Object.prototype.toString.call(e)", "[object XPathException]");
 shouldBeEqualToString("Object.prototype.toString.call(e.__proto__)", "[object XPathExceptionPrototype]");
 shouldBeEqualToString("e.constructor.toString()", "function XPathException() {\n    [native code]\n}");

Modified: trunk/LayoutTests/fast/xpath/4XPath/Core/test_parser-expected.txt (203312 => 203313)


--- trunk/LayoutTests/fast/xpath/4XPath/Core/test_parser-expected.txt	2016-07-16 00:39:50 UTC (rev 203312)
+++ trunk/LayoutTests/fast/xpath/4XPath/Core/test_parser-expected.txt	2016-07-16 00:46:23 UTC (rev 203313)
@@ -38,7 +38,7 @@
 PASS CHILD2/@CODE
 PASS DOM.evaluate("CHILD2/@CODE * 0", ROOT, null, XPathResult.NUMBER_TYPE, null).numberValue is 0
 PASS föø
-PASS DOM.evaluate("\\", ROOT, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null) threw exception Error: INVALID_EXPRESSION_ERR: DOM XPath Exception 51.
+PASS DOM.evaluate("\\", ROOT, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null) threw exception INVALID_EXPRESSION_ERR (DOM XPath Exception 51): The _expression_ had a syntax error or otherwise is not a legal _expression_ according to the rules of the specific XPathEvaluator..
 PASS successfullyParsed is true
 
 TEST COMPLETE

Modified: trunk/LayoutTests/fast/xpath/invalid-functions-expected.txt (203312 => 203313)


--- trunk/LayoutTests/fast/xpath/invalid-functions-expected.txt	2016-07-16 00:39:50 UTC (rev 203312)
+++ trunk/LayoutTests/fast/xpath/invalid-functions-expected.txt	2016-07-16 00:46:23 UTC (rev 203313)
@@ -1,12 +1,12 @@
-PASS document.createExpression("foobar()", null) threw exception Error: INVALID_EXPRESSION_ERR: DOM XPath Exception 51.
-PASS document.evaluate("foobar()", document, null, XPathResult.ANY_TYPE, null) threw exception Error: INVALID_EXPRESSION_ERR: DOM XPath Exception 51.
-PASS document.createExpression("position(//div)", null) threw exception Error: INVALID_EXPRESSION_ERR: DOM XPath Exception 51.
-PASS document.evaluate("position(//div)", document, null, XPathResult.ANY_TYPE, null) threw exception Error: INVALID_EXPRESSION_ERR: DOM XPath Exception 51.
-PASS document.createExpression("ceiling(1,2)", null) threw exception Error: INVALID_EXPRESSION_ERR: DOM XPath Exception 51.
-PASS document.evaluate("ceiling(1,2)", document, null, XPathResult.ANY_TYPE, null) threw exception Error: INVALID_EXPRESSION_ERR: DOM XPath Exception 51.
-PASS document.createExpression("ceiling(1,2)", null).evaluate(document, XPathResult.ANY_TYPE, null) threw exception Error: INVALID_EXPRESSION_ERR: DOM XPath Exception 51.
-PASS document.createExpression("boolean()", null) threw exception Error: INVALID_EXPRESSION_ERR: DOM XPath Exception 51.
-PASS document.evaluate("boolean()", document, null, XPathResult.ANY_TYPE, null) threw exception Error: INVALID_EXPRESSION_ERR: DOM XPath Exception 51.
+PASS document.createExpression("foobar()", null) threw exception INVALID_EXPRESSION_ERR (DOM XPath Exception 51): The _expression_ had a syntax error or otherwise is not a legal _expression_ according to the rules of the specific XPathEvaluator..
+PASS document.evaluate("foobar()", document, null, XPathResult.ANY_TYPE, null) threw exception INVALID_EXPRESSION_ERR (DOM XPath Exception 51): The _expression_ had a syntax error or otherwise is not a legal _expression_ according to the rules of the specific XPathEvaluator..
+PASS document.createExpression("position(//div)", null) threw exception INVALID_EXPRESSION_ERR (DOM XPath Exception 51): The _expression_ had a syntax error or otherwise is not a legal _expression_ according to the rules of the specific XPathEvaluator..
+PASS document.evaluate("position(//div)", document, null, XPathResult.ANY_TYPE, null) threw exception INVALID_EXPRESSION_ERR (DOM XPath Exception 51): The _expression_ had a syntax error or otherwise is not a legal _expression_ according to the rules of the specific XPathEvaluator..
+PASS document.createExpression("ceiling(1,2)", null) threw exception INVALID_EXPRESSION_ERR (DOM XPath Exception 51): The _expression_ had a syntax error or otherwise is not a legal _expression_ according to the rules of the specific XPathEvaluator..
+PASS document.evaluate("ceiling(1,2)", document, null, XPathResult.ANY_TYPE, null) threw exception INVALID_EXPRESSION_ERR (DOM XPath Exception 51): The _expression_ had a syntax error or otherwise is not a legal _expression_ according to the rules of the specific XPathEvaluator..
+PASS document.createExpression("ceiling(1,2)", null).evaluate(document, XPathResult.ANY_TYPE, null) threw exception INVALID_EXPRESSION_ERR (DOM XPath Exception 51): The _expression_ had a syntax error or otherwise is not a legal _expression_ according to the rules of the specific XPathEvaluator..
+PASS document.createExpression("boolean()", null) threw exception INVALID_EXPRESSION_ERR (DOM XPath Exception 51): The _expression_ had a syntax error or otherwise is not a legal _expression_ according to the rules of the specific XPathEvaluator..
+PASS document.evaluate("boolean()", document, null, XPathResult.ANY_TYPE, null) threw exception INVALID_EXPRESSION_ERR (DOM XPath Exception 51): The _expression_ had a syntax error or otherwise is not a legal _expression_ according to the rules of the specific XPathEvaluator..
 PASS successfullyParsed is true
 
 TEST COMPLETE

Modified: trunk/LayoutTests/fast/xpath/py-dom-xpath/expressions-expected.txt (203312 => 203313)


--- trunk/LayoutTests/fast/xpath/py-dom-xpath/expressions-expected.txt	2016-07-16 00:39:50 UTC (rev 203312)
+++ trunk/LayoutTests/fast/xpath/py-dom-xpath/expressions-expected.txt	2016-07-16 00:46:23 UTC (rev 203313)
@@ -1,16 +1,16 @@
 PASS //item[@id >= 2 and @id <= "4"]
 PASS //item[@id >= 2 and @id <= 3]
-PASS doc.evaluate("position(1)", doc.documentElement, null, XPathResult.ANY_TYPE, null) threw exception Error: INVALID_EXPRESSION_ERR: DOM XPath Exception 51.
-PASS doc.evaluate("not()", doc.documentElement, null, XPathResult.ANY_TYPE, null) threw exception Error: INVALID_EXPRESSION_ERR: DOM XPath Exception 51.
+PASS doc.evaluate("position(1)", doc.documentElement, null, XPathResult.ANY_TYPE, null) threw exception INVALID_EXPRESSION_ERR (DOM XPath Exception 51): The _expression_ had a syntax error or otherwise is not a legal _expression_ according to the rules of the specific XPathEvaluator..
+PASS doc.evaluate("not()", doc.documentElement, null, XPathResult.ANY_TYPE, null) threw exception INVALID_EXPRESSION_ERR (DOM XPath Exception 51): The _expression_ had a syntax error or otherwise is not a legal _expression_ according to the rules of the specific XPathEvaluator..
 PASS string-length(100)
-PASS doc.evaluate("count(100)", doc.documentElement, null, XPathResult.ANY_TYPE, null) threw exception Error: INVALID_EXPRESSION_ERR: DOM XPath Exception 51.
-PASS doc.evaluate("adumbrate()", doc.documentElement, null, XPathResult.ANY_TYPE, null) threw exception Error: INVALID_EXPRESSION_ERR: DOM XPath Exception 51.
+PASS doc.evaluate("count(100)", doc.documentElement, null, XPathResult.ANY_TYPE, null) threw exception INVALID_EXPRESSION_ERR (DOM XPath Exception 51): The _expression_ had a syntax error or otherwise is not a legal _expression_ according to the rules of the specific XPathEvaluator..
+PASS doc.evaluate("adumbrate()", doc.documentElement, null, XPathResult.ANY_TYPE, null) threw exception INVALID_EXPRESSION_ERR (DOM XPath Exception 51): The _expression_ had a syntax error or otherwise is not a legal _expression_ according to the rules of the specific XPathEvaluator..
 PASS //item[@id mod 2 = 0] | //item[@id mod 3 = 0]
-PASS doc.evaluate("//item | 42", doc.documentElement, null, XPathResult.ANY_TYPE, null) threw exception Error: INVALID_EXPRESSION_ERR: DOM XPath Exception 51.
-PASS doc.evaluate("/doc/(item[@id = 2] | item[@id = 6])/@id", doc.documentElement, null, XPathResult.ANY_TYPE, null) threw exception Error: INVALID_EXPRESSION_ERR: DOM XPath Exception 51.
-PASS doc.evaluate('"monty"/anaconda', doc.documentElement, null, XPathResult.ANY_TYPE, null) threw exception Error: INVALID_EXPRESSION_ERR: DOM XPath Exception 51.
-PASS doc.evaluate('/doc/string(item[@id = 2])/@id', doc.documentElement, null, XPathResult.ANY_TYPE, null) threw exception Error: INVALID_EXPRESSION_ERR: DOM XPath Exception 51.
-PASS doc.evaluate('(1)[1]', doc.documentElement, null, XPathResult.ANY_TYPE, null) threw exception Error: INVALID_EXPRESSION_ERR: DOM XPath Exception 51.
+PASS doc.evaluate("//item | 42", doc.documentElement, null, XPathResult.ANY_TYPE, null) threw exception INVALID_EXPRESSION_ERR (DOM XPath Exception 51): The _expression_ had a syntax error or otherwise is not a legal _expression_ according to the rules of the specific XPathEvaluator..
+PASS doc.evaluate("/doc/(item[@id = 2] | item[@id = 6])/@id", doc.documentElement, null, XPathResult.ANY_TYPE, null) threw exception INVALID_EXPRESSION_ERR (DOM XPath Exception 51): The _expression_ had a syntax error or otherwise is not a legal _expression_ according to the rules of the specific XPathEvaluator..
+PASS doc.evaluate('"monty"/anaconda', doc.documentElement, null, XPathResult.ANY_TYPE, null) threw exception INVALID_EXPRESSION_ERR (DOM XPath Exception 51): The _expression_ had a syntax error or otherwise is not a legal _expression_ according to the rules of the specific XPathEvaluator..
+PASS doc.evaluate('/doc/string(item[@id = 2])/@id', doc.documentElement, null, XPathResult.ANY_TYPE, null) threw exception INVALID_EXPRESSION_ERR (DOM XPath Exception 51): The _expression_ had a syntax error or otherwise is not a legal _expression_ according to the rules of the specific XPathEvaluator..
+PASS doc.evaluate('(1)[1]', doc.documentElement, null, XPathResult.ANY_TYPE, null) threw exception INVALID_EXPRESSION_ERR (DOM XPath Exception 51): The _expression_ had a syntax error or otherwise is not a legal _expression_ according to the rules of the specific XPathEvaluator..
 PASS (1)
 PASS ((1 + 1))
 PASS 1 or 1

Modified: trunk/Source/WebCore/ChangeLog (203312 => 203313)


--- trunk/Source/WebCore/ChangeLog	2016-07-16 00:39:50 UTC (rev 203312)
+++ trunk/Source/WebCore/ChangeLog	2016-07-16 00:46:23 UTC (rev 203313)
@@ -1,5 +1,19 @@
 2016-07-15  Brady Eidson  <[email protected]>
 
+        Update XPathException to use the description in toString().
+        https://bugs.webkit.org/show_bug.cgi?id=159848
+
+        Reviewed by Alex Christensen.
+
+        No new tests (Covered by changes to existing tests).
+
+        * bindings/js/JSDOMBinding.cpp:
+        (WebCore::createDOMException):
+        * xml/XPathException.h:
+        (WebCore::XPathException::XPathException):
+
+2016-07-15  Brady Eidson  <[email protected]>
+
         Change toString() behavior for exceptions constructed with "createWithDescriptionAsMessage".
         https://bugs.webkit.org/show_bug.cgi?id=159839
 

Modified: trunk/Source/WebCore/bindings/js/JSDOMBinding.cpp (203312 => 203313)


--- trunk/Source/WebCore/bindings/js/JSDOMBinding.cpp	2016-07-16 00:39:50 UTC (rev 203312)
+++ trunk/Source/WebCore/bindings/js/JSDOMBinding.cpp	2016-07-16 00:46:23 UTC (rev 203313)
@@ -273,7 +273,21 @@
 
     JSValue errorObject;
     switch (description.type) {
-        DOM_EXCEPTION_INTERFACES_FOR_EACH(TRY_TO_CREATE_EXCEPTION)
+    case DOMCoreExceptionType:
+        errorObject = toJS(exec, globalObject, DOMCoreException::create(description));
+        break;
+    case FileExceptionType:
+        errorObject = toJS(exec, globalObject, FileException::create(description));
+        break;
+    case SQLExceptionType:
+        errorObject = toJS(exec, globalObject, SQLException::create(description));
+        break;
+    case SVGExceptionType:
+        errorObject = toJS(exec, globalObject, SVGException::create(description));
+        break;
+    case XPathExceptionType:
+        errorObject = toJS(exec, globalObject, XPathException::create(description));
+        break;
 #if ENABLE(INDEXED_DATABASE)
     case IDBDatabaseExceptionType:
         errorObject = toJS(exec, globalObject, DOMCoreException::createWithDescriptionAsMessage(description));

Modified: trunk/Source/WebCore/xml/XPathException.h (203312 => 203313)


--- trunk/Source/WebCore/xml/XPathException.h	2016-07-16 00:39:50 UTC (rev 203312)
+++ trunk/Source/WebCore/xml/XPathException.h	2016-07-16 00:46:23 UTC (rev 203313)
@@ -52,7 +52,7 @@
 
 private:
     explicit XPathException(const ExceptionCodeDescription& description)
-        : ExceptionBase(description)
+        : ExceptionBase(description, ExceptionBase::MessageSource::UseDescription)
     {
     }
 };
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to