Sync XML-related interfaces with their specs, or lack thereof

The inResult arguments in XPathEvaluator and XPathExpression are called
just result in the spec, but that conflicts with other variables in the
generated code, so leave that as it is.

BUG=460722

Review URL: https://codereview.chromium.org/1222503003

git-svn-id: svn://svn.chromium.org/blink/trunk@198201 bbb929c8-8fbe-4397-9dbb-9b2b20218538
diff --git a/third_party/WebKit/Source/core/frame/UseCounter.h b/third_party/WebKit/Source/core/frame/UseCounter.h
index d9668fa..c34ee3a 100644
--- a/third_party/WebKit/Source/core/frame/UseCounter.h
+++ b/third_party/WebKit/Source/core/frame/UseCounter.h
@@ -754,6 +754,10 @@
         NavigatorVibrate = 850,
         NavigatorVibrateSubFrame = 851,
         PermissionStatusStatus = 852,
+        V8XPathEvaluator_Constructor = 853,
+        V8XPathEvaluator_CreateExpression_Method = 854,
+        V8XPathEvaluator_CreateNSResolver_Method = 855,
+        V8XPathEvaluator_Evaluate_Method = 856,
 
         // Add new features immediately above this line. Don't change assigned
         // numbers of any item, and don't reuse removed slots.
diff --git a/third_party/WebKit/Source/core/xml/DOMParser.idl b/third_party/WebKit/Source/core/xml/DOMParser.idl
index 347a770..f817255 100644
--- a/third_party/WebKit/Source/core/xml/DOMParser.idl
+++ b/third_party/WebKit/Source/core/xml/DOMParser.idl
@@ -32,5 +32,5 @@
     ConstructorCallWith=Document,
     GarbageCollected,
 ] interface DOMParser {
-    Document parseFromString(DOMString str, SupportedType type);
+    [NewObject] Document parseFromString(DOMString str, SupportedType type);
 };
diff --git a/third_party/WebKit/Source/core/xml/DocumentXPathEvaluator.idl b/third_party/WebKit/Source/core/xml/DocumentXPathEvaluator.idl
index 8d795da..12c03ff 100644
--- a/third_party/WebKit/Source/core/xml/DocumentXPathEvaluator.idl
+++ b/third_party/WebKit/Source/core/xml/DocumentXPathEvaluator.idl
@@ -17,10 +17,11 @@
  * Boston, MA 02110-1301, USA.
  */
 
+// http://www.w3.org/TR/DOM-Level-3-XPath/xpath.html#XPathEvaluator
+
 [
     TypeChecking=Interface,
 ] partial interface Document {
-    // DOM Level 3 XPath (XPathEvaluator interface)
     [MeasureAs=DocumentXPathCreateExpression, RaisesException] XPathExpression createExpression(DOMString expression, optional XPathNSResolver? resolver = null);
 
     [MeasureAs=DocumentXPathCreateNSResolver] XPathNSResolver createNSResolver(Node nodeResolver);
diff --git a/third_party/WebKit/Source/core/xml/XMLSerializer.idl b/third_party/WebKit/Source/core/xml/XMLSerializer.idl
index a5a55bd3..ee2e83c 100644
--- a/third_party/WebKit/Source/core/xml/XMLSerializer.idl
+++ b/third_party/WebKit/Source/core/xml/XMLSerializer.idl
@@ -18,6 +18,8 @@
  * Boston, MA 02110-1301, USA.
  */
 
+// https://dvcs.w3.org/hg/innerhtml/raw-file/tip/index.html#the-xmlserializer-interface
+
 [
     Constructor,
     GarbageCollected,
diff --git a/third_party/WebKit/Source/core/xml/XPathEvaluator.idl b/third_party/WebKit/Source/core/xml/XPathEvaluator.idl
index 3e92523e..70f258f 100644
--- a/third_party/WebKit/Source/core/xml/XPathEvaluator.idl
+++ b/third_party/WebKit/Source/core/xml/XPathEvaluator.idl
@@ -17,14 +17,23 @@
  * Boston, MA 02110-1301, USA.
  */
 
+// http://www.w3.org/TR/DOM-Level-3-XPath/xpath.html#XPathEvaluator
+
+// Note: The spec says "the XPathEvaluator interface will be implemented on the
+// same object which implements the Document interface" and does not define a
+// constructor or other means to create an XPathEvaluator object. Nonetheless,
+// Blink, Gecko, Presto, WebKit and all have these APIs on both Document and the
+// constructable XPathEvaluator interface.
+
 [
     Constructor,
     GarbageCollected,
+    Measure,
     TypeChecking=Interface,
 ] interface XPathEvaluator {
-    [RaisesException] XPathExpression createExpression(DOMString expression, optional XPathNSResolver? resolver = null);
+    [Measure, RaisesException] XPathExpression createExpression(DOMString expression, optional XPathNSResolver? resolver = null);
 
-    XPathNSResolver createNSResolver(Node nodeResolver);
+    [Measure] XPathNSResolver createNSResolver(Node nodeResolver);
 
-    [RaisesException] XPathResult evaluate(DOMString expression, Node contextNode, optional XPathNSResolver? resolver = null, optional unsigned short type = 0, optional object? inResult = null);
+    [Measure, RaisesException] XPathResult evaluate(DOMString expression, Node contextNode, optional XPathNSResolver? resolver = null, optional unsigned short type = 0, optional object? inResult = null);
 };
diff --git a/third_party/WebKit/Source/core/xml/XPathExpression.idl b/third_party/WebKit/Source/core/xml/XPathExpression.idl
index 7cf2819..397fb25 100644
--- a/third_party/WebKit/Source/core/xml/XPathExpression.idl
+++ b/third_party/WebKit/Source/core/xml/XPathExpression.idl
@@ -18,6 +18,8 @@
  * Boston, MA 02110-1301, USA.
  */
 
+// http://www.w3.org/TR/DOM-Level-3-XPath/xpath.html#XPathExpression
+
 [
     GarbageCollected,
     TypeChecking=Interface,
diff --git a/third_party/WebKit/Source/core/xml/XPathNSResolver.idl b/third_party/WebKit/Source/core/xml/XPathNSResolver.idl
index 37f45a5..e5888ee 100644
--- a/third_party/WebKit/Source/core/xml/XPathNSResolver.idl
+++ b/third_party/WebKit/Source/core/xml/XPathNSResolver.idl
@@ -18,10 +18,16 @@
  * Boston, MA 02110-1301, USA.
  */
 
+// http://www.w3.org/TR/DOM-Level-3-XPath/xpath.html#XPathNSResolver
+
+// TODO(philipj): XPathNSResolver should be a callback interface. The spec
+// doesn't say so, but doing so would allow the custom bindings to be removed.
+// createNSResolver(Node nodeResolver) could simply return its argument, which
+// is what Gecko does. crbug.com/345529
+
 [
     GarbageCollected,
     NoInterfaceObject
 ] interface XPathNSResolver {
     DOMString? lookupNamespaceURI([Default=Undefined] optional DOMString prefix);
 };
-
diff --git a/third_party/WebKit/Source/core/xml/XPathResult.idl b/third_party/WebKit/Source/core/xml/XPathResult.idl
index f1add510..319b719 100644
--- a/third_party/WebKit/Source/core/xml/XPathResult.idl
+++ b/third_party/WebKit/Source/core/xml/XPathResult.idl
@@ -17,9 +17,12 @@
  * Boston, MA 02110-1301, USA.
  */
 
+// http://www.w3.org/TR/DOM-Level-3-XPath/xpath.html#XPathResult
+
 [
     GarbageCollected
 ] interface XPathResult {
+    // XPathResultType
     const unsigned short ANY_TYPE                       = 0;
     const unsigned short NUMBER_TYPE                    = 1;
     const unsigned short STRING_TYPE                    = 2;
diff --git a/third_party/WebKit/Source/core/xml/XSLTProcessor.idl b/third_party/WebKit/Source/core/xml/XSLTProcessor.idl
index 1198d41..221628f 100644
--- a/third_party/WebKit/Source/core/xml/XSLTProcessor.idl
+++ b/third_party/WebKit/Source/core/xml/XSLTProcessor.idl
@@ -26,9 +26,9 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-// Eventually we should implement XSLTException:
-// http://lxr.mozilla.org/seamonkey/source/content/xsl/public/nsIXSLTException.idl
-// http://bugs.webkit.org/show_bug.cgi?id=5446
+// There is no spec for XSLTProcessor. It was first implemented in Gecko and
+// their interface definition remains the closest thing to a spec:
+// https://hg.mozilla.org/mozilla-central/file/012853bd80b7/dom/webidl/XSLTProcessor.webidl
 
 [
     GarbageCollected,
@@ -39,11 +39,14 @@
     TypeChecking=Interface,
 ] interface XSLTProcessor {
 
-    void importStylesheet(Node stylesheet);
-    // FIXME: These return null on failure; should throw exceptions instead.
-    [CustomElementCallbacks] DocumentFragment? transformToFragment(Node source, Document docVal);
+    void importStylesheet(Node style);
+    // TODO(philipj): In Gecko, the transformTo*() methods throw an exception in
+    // case of error instead of returning null.
+    [CustomElementCallbacks] DocumentFragment? transformToFragment(Node source, Document output);
     [CustomElementCallbacks] Document? transformToDocument(Node source);
 
+    // TODO(philipj): In Gecko, it's possible to set and get back any parameter
+    // value, not just DOMString.
     void setParameter(DOMString? namespaceURI, DOMString localName, DOMString value);
     DOMString? getParameter(DOMString? namespaceURI, DOMString localName);
     void removeParameter(DOMString? namespaceURI, DOMString localName);
@@ -52,4 +55,3 @@
     void reset();
 
 };
-