Move XPath from ExceptionCode to Exception
https://bugs.webkit.org/show_bug.cgi?id=163656

Reviewed by Chris Dumez.

Source/WebCore:

* dom/Document.cpp:
(WebCore::Document::createExpression): Use ExceptionOr.
(WebCore::Document::createNSResolver): Return Ref.
(WebCore::Document::evaluate): Use ExceptionOr.
* dom/Document.h: Updated for above changes.
* dom/Document.idl: Use non-legacy exceptions for the functions above.

* inspector/InspectorNodeFinder.cpp:
(WebCore::InspectorNodeFinder::searchUsingXPath): Call XPath functions
with new interface.

* xml/DOMParser.cpp:
(WebCore::DOMParser::DOMParser): Marked inline.
(WebCore::DOMParser::create): Moved here from header.
(WebCore::DOMParser::parseFromString): Use ExceptionOr.
* xml/DOMParser.h: Updated for above changes.
* xml/DOMParser.idl: Use non-legacy exception.

* xml/XPathEvaluator.cpp:
(WebCore::XPathEvaluator::createExpression): Use ExceptionOr.
(WebCore::XPathEvaluator::evaluate): Ditto.
* xml/XPathEvaluator.h: Updated for above changes.
* xml/XPathEvaluator.idl: Use non-legacy exceptions.

* xml/XPathExpression.cpp:
(WebCore::XPathExpression::createExpression): Use ExceptionOr.
(WebCore::XPathExpression::evaluate): Ditto.
* xml/XPathExpression.h: Updated for above changes.
* xml/XPathExpression.idl: Use non-legacy exceptions.

* xml/XPathGrammar.y: Added include of XPathStep.h.

* xml/XPathParser.cpp:
(WebCore::XPath::Parser::Parser): Initialize three scalar data members
in the class definition rather than here.
(WebCore::XPath::Parser::parseStatement): Use ExceptionOr.
* xml/XPathParser.h: Updated for above changes.

* xml/XPathResult.cpp:
(WebCore::XPathResult::XPathResult): Use a reference rather than a
pointer for the document. Alao initialize two scalar data members
in the class definition rather than here.
(WebCore::XPathResult::convertTo): Use ExceptionOr.
(WebCore::XPathResult::numberValue): Ditto.
(WebCore::XPathResult::stringValue): Ditto.
(WebCore::XPathResult::booleanValue): Ditto.
(WebCore::XPathResult::singleNodeValue): Ditto.
(WebCore::XPathResult::snapshotLength): Ditto.
(WebCore::XPathResult::iterateNext): Ditto.
(WebCore::XPathResult::snapshotItem): Ditto.
* xml/XPathResult.h: Updated for the changes above.
* xml/XPathResult.idl: Use non-legacy exceptions.

Source/WebKit/mac:

* DOM/DOMDocument.mm:
(wrap): Added. Helper function for wrapping a resolver.
(-[DOMDocument createExpression:resolver:]): Use raiseOnDOMError.
(-[DOMDocument evaluate:contextNode:resolver:type:inResult:]): Ditto.
* DOM/DOMXPathExpression.mm:
(-[DOMXPathExpression evaluate:type:inResult:]): Ditto.
* DOM/DOMXPathResult.mm:
(-[DOMXPathResult numberValue]): Ditto.
(-[DOMXPathResult stringValue]): Ditto.
(-[DOMXPathResult booleanValue]): Ditto.
(-[DOMXPathResult singleNodeValue]): Ditto.
(-[DOMXPathResult snapshotLength]): Ditto.
(-[DOMXPathResult iterateNext]): Ditto.
(-[DOMXPathResult snapshotItem:]): Ditto.

Source/WebKit2:

* WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDocument.cpp:
(webkit_dom_document_create_expression): Use ExceptionOr.
(webkit_dom_document_evaluate): Ditto.
* WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMXPathExpression.cpp:
(webkit_dom_xpath_expression_evaluate): Ditto.
* WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMXPathResult.cpp:
(webkit_dom_xpath_result_iterate_next): Ditto.
(webkit_dom_xpath_result_snapshot_item): Ditto.
(webkit_dom_xpath_result_get_number_value): Ditto.
(webkit_dom_xpath_result_get_string_value): Ditto.
(webkit_dom_xpath_result_get_boolean_value): Ditto.
(webkit_dom_xpath_result_get_single_node_value): Ditto.
(webkit_dom_xpath_result_get_snapshot_length): Ditto.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@207541 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WebCore/xml/DOMParser.h b/Source/WebCore/xml/DOMParser.h
index 817b01a..42ceeb9 100644
--- a/Source/WebCore/xml/DOMParser.h
+++ b/Source/WebCore/xml/DOMParser.h
@@ -1,5 +1,5 @@
 /*
- *  Copyright (C) 2003, 2006 Apple Inc.
+ *  Copyright (C) 2003, 2006 Apple Inc. All rights reserved.
  *
  *  This library is free software; you can redistribute it and/or
  *  modify it under the terms of the GNU Lesser General Public
@@ -16,27 +16,19 @@
  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
-#ifndef DOMParser_h
-#define DOMParser_h
+#pragma once
 
-#include <wtf/Forward.h>
-#include <wtf/RefCounted.h>
-#include <wtf/RefPtr.h>
+#include "ExceptionOr.h"
 #include <wtf/WeakPtr.h>
 
 namespace WebCore {
-typedef int ExceptionCode;
 
 class Document;
 
 class DOMParser : public RefCounted<DOMParser> {
 public:
-    static Ref<DOMParser> create(Document& contextDocument)
-    {
-        return adoptRef(*new DOMParser(contextDocument));
-    }
-
-    RefPtr<Document> parseFromString(const String&, const String& contentType, ExceptionCode&);
+    static Ref<DOMParser> create(Document& contextDocument);
+    ExceptionOr<Ref<Document>> parseFromString(const String&, const String& contentType);
 
 private:
     explicit DOMParser(Document& contextDocument);
@@ -45,5 +37,3 @@
 };
 
 }
-
-#endif // XMLSerializer.h