Backed out changeset 012853bd80b7 (bug 844457) for likely being the real cause of the mochitest-dt failures.
authorRyan VanderMeulen <ryanvm@gmail.com>
Thu, 09 Oct 2014 13:39:14 -0400
changeset 234124 cff6335a600972067f0fe41293b52003b0d1fa24
parent 234123 299fd510e40557b9d964ec0b9b497f5ce07a4d0f
child 234125 f5557f04db0bd89aef0b7606f6479b24ad6f7724
child 234240 ecf7c54a9dce5c5a37e66b177d69c8b9eb688fad
push id611
push userraliiev@mozilla.com
push dateMon, 05 Jan 2015 23:23:16 +0000
treeherdermozilla-release@345cd3b9c445 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs844457
milestone35.0a1
backs out012853bd80b779c08a7bd89424eec47b50c2b0e1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Backed out changeset 012853bd80b7 (bug 844457) for likely being the real cause of the mochitest-dt failures. CLOSED TREE
dom/base/nsDOMClassInfo.cpp
dom/base/nsDOMClassInfoClasses.h
dom/bindings/Bindings.conf
dom/webidl/XSLTProcessor.webidl
dom/webidl/moz.build
dom/xslt/base/moz.build
dom/xslt/base/txExpandedName.cpp
dom/xslt/base/txExpandedName.h
dom/xslt/base/txExpandedNameMap.h
dom/xslt/tests/mochitest/mochitest.ini
dom/xslt/tests/mochitest/test_parameter.html
dom/xslt/xml/txXMLUtils.cpp
dom/xslt/xml/txXMLUtils.h
dom/xslt/xslt/moz.build
dom/xslt/xslt/txInstructions.h
dom/xslt/xslt/txMozillaXSLTProcessor.cpp
dom/xslt/xslt/txMozillaXSLTProcessor.h
dom/xslt/xslt/txOutputFormat.cpp
dom/xslt/xslt/txXSLTEnvironmentFunctionCall.cpp
dom/xslt/xslt/txXSLTPatterns.h
--- a/dom/base/nsDOMClassInfo.cpp
+++ b/dom/base/nsDOMClassInfo.cpp
@@ -67,16 +67,20 @@
 #include "nsIDOMEventTarget.h"
 
 // CSS related includes
 #include "nsCSSRules.h"
 #include "nsIDOMCSSRule.h"
 #include "nsAutoPtr.h"
 #include "nsMemory.h"
 
+// Tranformiix
+#include "nsIXSLTProcessor.h"
+#include "nsIXSLTProcessorPrivate.h"
+
 // includes needed for the prototype chain interfaces
 #include "nsIDOMCSSCharsetRule.h"
 #include "nsIDOMCSSImportRule.h"
 #include "nsIDOMCSSMediaRule.h"
 #include "nsIDOMCSSFontFaceRule.h"
 #include "nsIDOMCSSMozDocumentRule.h"
 #include "nsIDOMCSSSupportsRule.h"
 #include "nsIDOMMozCSSKeyframeRule.h"
@@ -274,16 +278,19 @@ static nsDOMClassInfoData sClassInfoData
 #endif
 
   NS_DEFINE_CLASSINFO_DATA(CSSMozDocumentRule, nsDOMGenericSH,
                            DOM_DEFAULT_SCRIPTABLE_FLAGS)
 
   NS_DEFINE_CLASSINFO_DATA(CSSSupportsRule, nsDOMGenericSH,
                            DOM_DEFAULT_SCRIPTABLE_FLAGS)
 
+  NS_DEFINE_CLASSINFO_DATA(XSLTProcessor, nsDOMGenericSH,
+                           DOM_DEFAULT_SCRIPTABLE_FLAGS)
+
   NS_DEFINE_CLASSINFO_DATA(XPathNSResolver, nsDOMGenericSH,
                            DOM_DEFAULT_SCRIPTABLE_FLAGS)
 
   NS_DEFINE_CLASSINFO_DATA(MozSmsMessage, nsDOMGenericSH,
                            DOM_DEFAULT_SCRIPTABLE_FLAGS)
 
   NS_DEFINE_CLASSINFO_DATA(MozMmsMessage, nsDOMGenericSH,
                            DOM_DEFAULT_SCRIPTABLE_FLAGS)
@@ -324,16 +331,46 @@ static nsDOMClassInfoData sClassInfoData
   NS_DEFINE_CHROME_XBL_CLASSINFO_DATA(XULButtonElement, nsDOMGenericSH,
                                       DOM_DEFAULT_SCRIPTABLE_FLAGS)
   NS_DEFINE_CHROME_XBL_CLASSINFO_DATA(XULCheckboxElement, nsDOMGenericSH,
                                       DOM_DEFAULT_SCRIPTABLE_FLAGS)
   NS_DEFINE_CHROME_XBL_CLASSINFO_DATA(XULPopupElement, nsDOMGenericSH,
                                       DOM_DEFAULT_SCRIPTABLE_FLAGS)
 };
 
+#define NS_DEFINE_CONTRACT_CTOR(_class, _contract_id)                           \
+  static nsresult                                                               \
+  _class##Ctor(nsISupports** aInstancePtrResult)                                \
+  {                                                                             \
+    nsresult rv = NS_OK;                                                        \
+    nsCOMPtr<nsISupports> native = do_CreateInstance(_contract_id, &rv);        \
+    native.forget(aInstancePtrResult);                                          \
+    return rv;                                                                  \
+  }
+
+NS_DEFINE_CONTRACT_CTOR(XSLTProcessor,
+                        "@mozilla.org/document-transformer;1?type=xslt")
+
+#undef NS_DEFINE_CONTRACT_CTOR
+
+struct nsConstructorFuncMapData
+{
+  int32_t mDOMClassInfoID;
+  nsDOMConstructorFunc mConstructorFunc;
+};
+
+#define NS_DEFINE_CONSTRUCTOR_FUNC_DATA(_class, _func)                        \
+  { eDOMClassInfo_##_class##_id, _func },
+
+static const nsConstructorFuncMapData kConstructorFuncMap[] =
+{
+  NS_DEFINE_CONSTRUCTOR_FUNC_DATA(XSLTProcessor, XSLTProcessorCtor)
+};
+#undef NS_DEFINE_CONSTRUCTOR_FUNC_DATA
+
 nsIXPConnect *nsDOMClassInfo::sXPConnect = nullptr;
 bool nsDOMClassInfo::sIsInitialized = false;
 
 
 jsid nsDOMClassInfo::sConstructor_id     = JSID_VOID;
 jsid nsDOMClassInfo::sWrappedJSObject_id = JSID_VOID;
 
 static const JSClass *sObjectClass = nullptr;
@@ -732,16 +769,21 @@ nsDOMClassInfo::Init()
   DOM_CLASSINFO_MAP_BEGIN(CSSMozDocumentRule, nsIDOMCSSMozDocumentRule)
     DOM_CLASSINFO_MAP_ENTRY(nsIDOMCSSMozDocumentRule)
   DOM_CLASSINFO_MAP_END
 
   DOM_CLASSINFO_MAP_BEGIN(CSSSupportsRule, nsIDOMCSSSupportsRule)
     DOM_CLASSINFO_MAP_ENTRY(nsIDOMCSSSupportsRule)
   DOM_CLASSINFO_MAP_END
 
+  DOM_CLASSINFO_MAP_BEGIN(XSLTProcessor, nsIXSLTProcessor)
+    DOM_CLASSINFO_MAP_ENTRY(nsIXSLTProcessor)
+    DOM_CLASSINFO_MAP_ENTRY(nsIXSLTProcessorPrivate)
+  DOM_CLASSINFO_MAP_END
+
   DOM_CLASSINFO_MAP_BEGIN(XPathNSResolver, nsIDOMXPathNSResolver)
     DOM_CLASSINFO_MAP_ENTRY(nsIDOMXPathNSResolver)
   DOM_CLASSINFO_MAP_END
 
   DOM_CLASSINFO_MAP_BEGIN(MozSmsMessage, nsIDOMMozSmsMessage)
      DOM_CLASSINFO_MAP_ENTRY(nsIDOMMozSmsMessage)
   DOM_CLASSINFO_MAP_END
 
@@ -1390,16 +1432,22 @@ nsDOMClassInfo::ShutDown()
 
   NS_IF_RELEASE(sXPConnect);
   sIsInitialized = false;
 }
 
 static nsDOMConstructorFunc
 FindConstructorFunc(const nsDOMClassInfoData *aDOMClassInfoData)
 {
+  for (uint32_t i = 0; i < ArrayLength(kConstructorFuncMap); ++i) {
+    if (&sClassInfoData[kConstructorFuncMap[i].mDOMClassInfoID] ==
+        aDOMClassInfoData) {
+      return kConstructorFuncMap[i].mConstructorFunc;
+    }
+  }
   return nullptr;
 }
 
 static nsresult
 BaseStubConstructor(nsIWeakReference* aWeakOwner,
                     const nsGlobalNameStruct *name_struct, JSContext *cx,
                     JS::Handle<JSObject*> obj, const JS::CallArgs &args)
 {
--- a/dom/base/nsDOMClassInfoClasses.h
+++ b/dom/base/nsDOMClassInfoClasses.h
@@ -32,16 +32,19 @@ DOMCI_CLASS(XULTreeBuilder)
 
 #ifdef MOZ_XUL
 DOMCI_CLASS(TreeColumn)
 #endif
 
 DOMCI_CLASS(CSSMozDocumentRule)
 DOMCI_CLASS(CSSSupportsRule)
 
+// XSLTProcessor
+DOMCI_CLASS(XSLTProcessor)
+
 // DOM Level 3 XPath objects
 DOMCI_CLASS(XPathNSResolver)
 
 DOMCI_CLASS(MozSmsMessage)
 DOMCI_CLASS(MozMmsMessage)
 DOMCI_CLASS(MozMobileMessageThread)
 
 // @font-face in CSS
--- a/dom/bindings/Bindings.conf
+++ b/dom/bindings/Bindings.conf
@@ -1528,20 +1528,16 @@ DOMInterfaces = {
     'wrapperCache': False
 },
 
 'XPathExpression': {
     'wrapperCache': False,
     'nativeOwnership': 'owned',
 },
 
-'XSLTProcessor': {
-    'nativeType': 'txMozillaXSLTProcessor',
-},
-
 'XULDocument': {
     'headerFile': 'XULDocument.h'
 },
 
 'XULElement': {
     'nativeType': 'nsXULElement',
 },
 
deleted file mode 100644
--- a/dom/webidl/XSLTProcessor.webidl
+++ /dev/null
@@ -1,109 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-interface nsIVariant;
-
-[Constructor]
-interface XSLTProcessor {
-    /**
-     * Import the stylesheet into this XSLTProcessor for transformations.
-     *
-     * @param style The root-node of a XSLT stylesheet. This can be either
-     *              a document node or an element node. If a document node
-     *              then the document can contain either a XSLT stylesheet
-     *              or a LRE stylesheet.
-     *              If the argument is an element node it must be the
-     *              xsl:stylesheet (or xsl:transform) element of an XSLT
-     *              stylesheet.
-     */
-    [Throws]
-    void importStylesheet(Node style);
-
-    /**
-     * Transforms the node source applying the stylesheet given by
-     * the importStylesheet() function. The owner document of the output node
-     * owns the returned document fragment.
-     *
-     * @param source The node to be transformed
-     * @param output This document is used to generate the output
-     * @return DocumentFragment The result of the transformation
-     */
-    [Throws]
-    DocumentFragment transformToFragment(Node source,
-                                         Document output);
-
-    /**
-     * Transforms the node source applying the stylesheet given by the
-     * importStylesheet() function.
-     *
-     * @param source The node to be transformed
-     * @return Document The result of the transformation
-     */
-    [Throws]
-    Document transformToDocument(Node source);
-
-    /**
-     * Sets a parameter to be used in subsequent transformations with this
-     * nsIXSLTProcessor. If the parameter doesn't exist in the stylesheet the
-     * parameter will be ignored.
-     *
-     * @param namespaceURI The namespaceURI of the XSLT parameter
-     * @param localName    The local name of the XSLT parameter
-     * @param value        The new value of the XSLT parameter
-     */
-    [Throws]
-    void setParameter([TreatNullAs=EmptyString] DOMString namespaceURI,
-                      DOMString localName,
-                      any value);
-
-    /**
-     * Gets a parameter if previously set by setParameter. Returns null
-     * otherwise.
-     *
-     * @param namespaceURI The namespaceURI of the XSLT parameter
-     * @param localName    The local name of the XSLT parameter
-     * @return nsIVariant  The value of the XSLT parameter
-     */
-    [Throws]
-    nsIVariant? getParameter([TreatNullAs=EmptyString] DOMString namespaceURI,
-                             DOMString localName);
-    /**
-     * Removes a parameter, if set. This will make the processor use the
-     * default-value for the parameter as specified in the stylesheet.
-     *
-     * @param namespaceURI The namespaceURI of the XSLT parameter
-     * @param localName    The local name of the XSLT parameter
-     */
-    [Throws]
-    void removeParameter([TreatNullAs=EmptyString] DOMString namespaceURI,
-                         DOMString localName);
-
-    /**
-     * Removes all set parameters from this nsIXSLTProcessor. This will make
-     * the processor use the default-value for all parameters as specified in
-     * the stylesheet.
-     */
-    void clearParameters();
-
-    /**
-     * Remove all parameters and stylesheets from this nsIXSLTProcessor.
-     */
-    void reset();
-
-    /**
-    * Disables all loading of external documents, such as from
-    * <xsl:import> and document()
-    * Defaults to off and is *not* reset by calls to reset()
-    */
-    [ChromeOnly]
-    const unsigned long DISABLE_ALL_LOADS = 1;
-
-    /**
-    * Flags for this processor. Defaults to 0. See individual flags above
-    * for documentation for effect of reset()
-    */
-    [ChromeOnly]
-    attribute unsigned long flags;
-};
--- a/dom/webidl/moz.build
+++ b/dom/webidl/moz.build
@@ -523,17 +523,16 @@ WEBIDL_FILES = [
     'XMLHttpRequest.webidl',
     'XMLHttpRequestEventTarget.webidl',
     'XMLHttpRequestUpload.webidl',
     'XMLSerializer.webidl',
     'XMLStylesheetProcessingInstruction.webidl',
     'XPathEvaluator.webidl',
     'XPathExpression.webidl',
     'XPathResult.webidl',
-    'XSLTProcessor.webidl',
     'XULCommandEvent.webidl',
     'XULDocument.webidl',
     'XULElement.webidl',
 ]
 
 if CONFIG['MOZ_AUDIO_CHANNEL_MANAGER']:
     WEBIDL_FILES += [
         'AudioChannelManager.webidl',
--- a/dom/xslt/base/moz.build
+++ b/dom/xslt/base/moz.build
@@ -1,17 +1,16 @@
 # -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 UNIFIED_SOURCES += [
     'txDouble.cpp',
-    'txExpandedName.cpp',
     'txExpandedNameMap.cpp',
     'txList.cpp',
     'txNamespaceMap.cpp',
     'txURIUtils.cpp',
 ]
 
 FAIL_ON_WARNINGS = True
 
deleted file mode 100644
--- a/dom/xslt/base/txExpandedName.cpp
+++ /dev/null
@@ -1,41 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#include "txExpandedName.h"
-#include "nsString.h"
-#include "nsReadableUtils.h"
-#include "txStringUtils.h"
-#include "txNamespaceMap.h"
-#include "txXMLUtils.h"
-
-nsresult
-txExpandedName::init(const nsAString& aQName, txNamespaceMap* aResolver,
-                     bool aUseDefault)
-{
-    const nsAFlatString& qName = PromiseFlatString(aQName);
-    const char16_t* colon;
-    bool valid = XMLUtils::isValidQName(qName, &colon);
-    if (!valid) {
-        return NS_ERROR_FAILURE;
-    }
-
-    if (colon) {
-        nsCOMPtr<nsIAtom> prefix = do_GetAtom(Substring(qName.get(), colon));
-        int32_t namespaceID = aResolver->lookupNamespace(prefix);
-        if (namespaceID == kNameSpaceID_Unknown)
-            return NS_ERROR_FAILURE;
-        mNamespaceID = namespaceID;
-
-        const char16_t *end;
-        qName.EndReading(end);
-        mLocalName = do_GetAtom(Substring(colon + 1, end));
-    }
-    else {
-        mNamespaceID = aUseDefault ? aResolver->lookupNamespace(nullptr) :
-                                     kNameSpaceID_None;
-        mLocalName = do_GetAtom(aQName);
-    }
-    return NS_OK;
-}
deleted file mode 100644
--- a/dom/xslt/base/txExpandedName.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#ifndef TRANSFRMX_EXPANDEDNAME_H
-#define TRANSFRMX_EXPANDEDNAME_H
-
-#include "nsCOMPtr.h"
-#include "nsIAtom.h"
-#include "mozilla/dom/NameSpaceConstants.h"
-
-class txNamespaceMap;
-
-class txExpandedName {
-public:
-    txExpandedName() : mNamespaceID(kNameSpaceID_None)
-    {
-    }
-
-    txExpandedName(int32_t aNsID,
-                   nsIAtom* aLocalName) : mNamespaceID(aNsID),
-                                          mLocalName(aLocalName)
-    {
-    }
-
-    txExpandedName(const txExpandedName& aOther) :
-        mNamespaceID(aOther.mNamespaceID),
-        mLocalName(aOther.mLocalName)
-    {
-    }
-
-    nsresult init(const nsAString& aQName, txNamespaceMap* aResolver,
-                  bool aUseDefault);
-
-    void reset()
-    {
-        mNamespaceID = kNameSpaceID_None;
-        mLocalName = nullptr;
-    }
-
-    bool isNull()
-    {
-        return mNamespaceID == kNameSpaceID_None && !mLocalName;
-    }
-
-    txExpandedName& operator = (const txExpandedName& rhs)
-    {
-        mNamespaceID = rhs.mNamespaceID;
-        mLocalName = rhs.mLocalName;
-        return *this;
-    }
-
-    bool operator == (const txExpandedName& rhs) const
-    {
-        return ((mLocalName == rhs.mLocalName) &&
-                (mNamespaceID == rhs.mNamespaceID));
-    }
-
-    bool operator != (const txExpandedName& rhs) const
-    {
-        return ((mLocalName != rhs.mLocalName) ||
-                (mNamespaceID != rhs.mNamespaceID));
-    }
-
-    int32_t mNamespaceID;
-    nsCOMPtr<nsIAtom> mLocalName;
-};
-
-#endif
--- a/dom/xslt/base/txExpandedNameMap.h
+++ b/dom/xslt/base/txExpandedNameMap.h
@@ -1,19 +1,18 @@
 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef TRANSFRMX_EXPANDEDNAMEMAP_H
 #define TRANSFRMX_EXPANDEDNAMEMAP_H
 
-#include "nsAutoPtr.h"
 #include "nsError.h"
-#include "txExpandedName.h"
+#include "txXMLUtils.h"
 #include "nsTArray.h"
 
 class txExpandedNameMap_base {
 protected:
     /**
      * Adds an item, if an item with this key already exists an error is
      * returned
      * @param  aKey   key for item to add
--- a/dom/xslt/tests/mochitest/mochitest.ini
+++ b/dom/xslt/tests/mochitest/mochitest.ini
@@ -10,9 +10,8 @@
 [test_bug551412.html]
 [test_bug551654.html]
 [test_bug566629.html]
 [test_bug566629.xhtml]
 [test_bug603159.html]
 [test_bug616774.html]
 [test_bug667315.html]
 [test_exslt_regex.html]
-[test_parameter.html]
deleted file mode 100644
--- a/dom/xslt/tests/mochitest/test_parameter.html
+++ /dev/null
@@ -1,31 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<head>
-  <title>Test for setParameter/getParameter</title>
-  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
-  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
-</head>
-<body>
-<p id="display"></p>
-<div id="content" style="display: none"></div>
-<pre id="test">
-<script>
-  var processor = new XSLTProcessor();
-
-  processor.setParameter(null, "test", "hello");
-  is(processor.getParameter(null, "test"), "hello", "null namespace works");
-
-  processor.setParameter("foo", "bar", "foobar");
-  is(processor.getParameter("foo", "bar"), "foobar", "non-null namespace works");
-
-  processor.setParameter(null, "test", 123);
-  is(processor.getParameter(null, "test"), 123, "number value works");
-
-  processor.removeParameter(null, "test");
-  is(processor.getParameter(null, "test"), null, "removeParameter works");
-
-  is(processor.getParameter(null, "not-here"), null, "nonexistant parameter");
-</script>
-</pre>
-</body>
-</html>
--- a/dom/xslt/xml/txXMLUtils.cpp
+++ b/dom/xslt/xml/txXMLUtils.cpp
@@ -11,18 +11,48 @@
 #include "nsString.h"
 #include "nsReadableUtils.h"
 #include "nsGkAtoms.h"
 #include "txStringUtils.h"
 #include "txNamespaceMap.h"
 #include "txXPathTreeWalker.h"
 #include "nsContentUtils.h"
 
-//------------------------------/
-//- Implementation of XMLUtils -/
+nsresult
+txExpandedName::init(const nsAString& aQName, txNamespaceMap* aResolver,
+                     bool aUseDefault)
+{
+    const nsAFlatString& qName = PromiseFlatString(aQName);
+    const char16_t* colon;
+    bool valid = XMLUtils::isValidQName(qName, &colon);
+    if (!valid) {
+        return NS_ERROR_FAILURE;
+    }
+
+    if (colon) {
+        nsCOMPtr<nsIAtom> prefix = do_GetAtom(Substring(qName.get(), colon));
+        int32_t namespaceID = aResolver->lookupNamespace(prefix);
+        if (namespaceID == kNameSpaceID_Unknown)
+            return NS_ERROR_FAILURE;
+        mNamespaceID = namespaceID;
+
+        const char16_t *end;
+        qName.EndReading(end);
+        mLocalName = do_GetAtom(Substring(colon + 1, end));
+    }
+    else {
+        mNamespaceID = aUseDefault ? aResolver->lookupNamespace(nullptr) :
+                                     kNameSpaceID_None;
+        mLocalName = do_GetAtom(aQName);
+    }
+    return NS_OK;
+}
+
+  //------------------------------/
+ //- Implementation of XMLUtils -/
 //------------------------------/
 
 // static
 nsresult
 XMLUtils::splitExpatName(const char16_t *aExpatName, nsIAtom **aPrefix,
                          nsIAtom **aLocalName, int32_t* aNameSpaceID)
 {
     /**
--- a/dom/xslt/xml/txXMLUtils.h
+++ b/dom/xslt/xml/txXMLUtils.h
@@ -6,25 +6,83 @@
 /**
  * An XML Utility class
 **/
 
 #ifndef MITRE_XMLUTILS_H
 #define MITRE_XMLUTILS_H
 
 #include "txCore.h"
+#include "nsCOMPtr.h"
 #include "nsDependentSubstring.h"
+#include "nsIAtom.h"
 #include "txXPathNode.h"
 
 #define kExpatSeparatorChar 0xFFFF
 
 extern "C" int MOZ_XMLIsLetter(const char* ptr);
 extern "C" int MOZ_XMLIsNCNameChar(const char* ptr);
 
 class nsIAtom;
+class txNamespaceMap;
+
+class txExpandedName {
+public:
+    txExpandedName() : mNamespaceID(kNameSpaceID_None)
+    {
+    }
+
+    txExpandedName(int32_t aNsID,
+                   nsIAtom* aLocalName) : mNamespaceID(aNsID),
+                                          mLocalName(aLocalName)
+    {
+    }
+
+    txExpandedName(const txExpandedName& aOther) :
+        mNamespaceID(aOther.mNamespaceID),
+        mLocalName(aOther.mLocalName)
+    {
+    }
+
+    nsresult init(const nsAString& aQName, txNamespaceMap* aResolver,
+                  bool aUseDefault);
+
+    void reset()
+    {
+        mNamespaceID = kNameSpaceID_None;
+        mLocalName = nullptr;
+    }
+
+    bool isNull()
+    {
+        return mNamespaceID == kNameSpaceID_None && !mLocalName;
+    }
+
+    txExpandedName& operator = (const txExpandedName& rhs)
+    {
+        mNamespaceID = rhs.mNamespaceID;
+        mLocalName = rhs.mLocalName;
+        return *this;
+    }
+
+    bool operator == (const txExpandedName& rhs) const
+    {
+        return ((mLocalName == rhs.mLocalName) &&
+                (mNamespaceID == rhs.mNamespaceID));
+    }
+
+    bool operator != (const txExpandedName& rhs) const
+    {
+        return ((mLocalName != rhs.mLocalName) ||
+                (mNamespaceID != rhs.mNamespaceID));
+    }
+
+    int32_t mNamespaceID;
+    nsCOMPtr<nsIAtom> mLocalName;
+};
 
 class XMLUtils {
 
 public:
     static nsresult splitExpatName(const char16_t *aExpatName,
                                    nsIAtom **aPrefix, nsIAtom **aLocalName,
                                    int32_t* aNameSpaceID);
     static nsresult splitQName(const nsAString& aName, nsIAtom** aPrefix,
--- a/dom/xslt/xslt/moz.build
+++ b/dom/xslt/xslt/moz.build
@@ -1,18 +1,14 @@
 # -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
-EXPORTS.mozilla.dom += [
-    'txMozillaXSLTProcessor.h'
-]
-
 UNIFIED_SOURCES += [
     'txBufferingHandler.cpp',
     'txCurrentFunctionCall.cpp',
     'txDocumentFunctionCall.cpp',
     'txExecutionState.cpp',
     'txEXSLTFunctions.cpp',
     'txFormatNumberFunctionCall.cpp',
     'txGenerateIdFunctionCall.cpp',
--- a/dom/xslt/xslt/txInstructions.h
+++ b/dom/xslt/xslt/txInstructions.h
@@ -5,17 +5,16 @@
 
 #ifndef TRANSFRMX_TXINSTRUCTIONS_H
 #define TRANSFRMX_TXINSTRUCTIONS_H
 
 #include "nsCOMPtr.h"
 #include "txCore.h"
 #include "nsString.h"
 #include "txXMLUtils.h"
-#include "txExpandedName.h"
 #include "txNamespaceMap.h"
 #include "nsAutoPtr.h"
 #include "txXSLTNumber.h"
 #include "nsTArray.h"
 
 class nsIAtom;
 class txExecutionState;
 
--- a/dom/xslt/xslt/txMozillaXSLTProcessor.cpp
+++ b/dom/xslt/xslt/txMozillaXSLTProcessor.cpp
@@ -6,16 +6,17 @@
 #include "txMozillaXSLTProcessor.h"
 #include "nsContentCID.h"
 #include "nsError.h"
 #include "nsIChannel.h"
 #include "mozilla/dom/Element.h"
 #include "nsIDOMElement.h"
 #include "nsIDOMText.h"
 #include "nsIDocument.h"
+#include "nsDOMClassInfoID.h"
 #include "nsIDOMDocument.h"
 #include "nsIDOMDocumentFragment.h"
 #include "nsIDOMNodeList.h"
 #include "nsIIOService.h"
 #include "nsILoadGroup.h"
 #include "nsIStringBundle.h"
 #include "nsIURI.h"
 #include "nsNetUtil.h"
@@ -30,18 +31,16 @@
 #include "nsIPrincipal.h"
 #include "nsThreadUtils.h"
 #include "jsapi.h"
 #include "txExprParser.h"
 #include "nsIErrorService.h"
 #include "nsIScriptSecurityManager.h"
 #include "nsJSUtils.h"
 #include "nsIXPConnect.h"
-#include "mozilla/dom/DocumentFragment.h"
-#include "mozilla/dom/XSLTProcessorBinding.h"
 
 using namespace mozilla::dom;
 
 static NS_DEFINE_CID(kXMLDocumentCID, NS_XMLDOCUMENT_CID);
 
 /**
  * Output Handler Factories
  */
@@ -322,47 +321,37 @@ ImplCycleCollectionTraverse(nsCycleColle
                                     aName, aFlags);
     }
 }
 
 /**
  * txMozillaXSLTProcessor
  */
 
-NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(txMozillaXSLTProcessor,
-                                      mOwner, mEmbeddedStylesheetRoot,
-                                      mSource, mVariables)
+NS_IMPL_CYCLE_COLLECTION(txMozillaXSLTProcessor, mEmbeddedStylesheetRoot,
+                         mSource, mVariables)
 
 NS_IMPL_CYCLE_COLLECTING_ADDREF(txMozillaXSLTProcessor)
 NS_IMPL_CYCLE_COLLECTING_RELEASE(txMozillaXSLTProcessor)
 
+DOMCI_DATA(XSLTProcessor, txMozillaXSLTProcessor)
+
 NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(txMozillaXSLTProcessor)
-    NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
     NS_INTERFACE_MAP_ENTRY(nsIXSLTProcessor)
     NS_INTERFACE_MAP_ENTRY(nsIXSLTProcessorPrivate)
     NS_INTERFACE_MAP_ENTRY(nsIDocumentTransformer)
     NS_INTERFACE_MAP_ENTRY(nsIMutationObserver)
     NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIXSLTProcessor)
+    NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(XSLTProcessor)
 NS_INTERFACE_MAP_END
 
-txMozillaXSLTProcessor::txMozillaXSLTProcessor()
-  : mOwner(nullptr),
-    mStylesheetDocument(nullptr),
-    mTransformResult(NS_OK),
-    mCompileResult(NS_OK),
-    mFlags(0)
-{
-}
-
-txMozillaXSLTProcessor::txMozillaXSLTProcessor(nsISupports* aOwner)
-  : mOwner(aOwner),
-    mStylesheetDocument(nullptr),
-    mTransformResult(NS_OK),
-    mCompileResult(NS_OK),
-    mFlags(0)
+txMozillaXSLTProcessor::txMozillaXSLTProcessor() : mStylesheetDocument(nullptr),
+                                                   mTransformResult(NS_OK),
+                                                   mCompileResult(NS_OK),
+                                                   mFlags(0)
 {
 }
 
 txMozillaXSLTProcessor::~txMozillaXSLTProcessor()
 {
     if (mStylesheetDocument) {
         mStylesheetDocument->RemoveMutationObserver(this);
     }
@@ -1268,90 +1257,16 @@ txMozillaXSLTProcessor::ContentRemoved(n
                                        nsIContent* aContainer,
                                        nsIContent* aChild,
                                        int32_t aIndexInContainer,
                                        nsIContent* aPreviousSibling)
 {
     mStylesheet = nullptr;
 }
 
-/* virtual */ JSObject*
-txMozillaXSLTProcessor::WrapObject(JSContext* aCx)
-{
-    return XSLTProcessorBinding::Wrap(aCx, this);
-}
-
-
-/* static */ already_AddRefed<txMozillaXSLTProcessor>
-txMozillaXSLTProcessor::Constructor(const GlobalObject& aGlobal,
-                                    mozilla::ErrorResult& aRv)
-{
-    nsRefPtr<txMozillaXSLTProcessor> processor =
-        new txMozillaXSLTProcessor(aGlobal.GetAsSupports());
-    return processor.forget();
-}
-
-void
-txMozillaXSLTProcessor::ImportStylesheet(nsINode& stylesheet,
-                                         mozilla::ErrorResult& aRv)
-{
-    aRv = ImportStylesheet(stylesheet.AsDOMNode());
-}
-
-already_AddRefed<DocumentFragment>
-txMozillaXSLTProcessor::TransformToFragment(nsINode& source,
-                                            nsIDocument& docVal,
-                                            mozilla::ErrorResult& aRv)
-{
-    nsCOMPtr<nsIDOMDocumentFragment> fragment;
-    nsCOMPtr<nsIDOMDocument> domDoc = do_QueryInterface(&docVal);
-    if (!domDoc) {
-        aRv.Throw(NS_ERROR_FAILURE);
-        return nullptr;
-    }
-    aRv = TransformToFragment(source.AsDOMNode(), domDoc, getter_AddRefs(fragment));
-    return fragment.forget().downcast<DocumentFragment>();
-}
-
-already_AddRefed<nsIDocument>
-txMozillaXSLTProcessor::TransformToDocument(nsINode& source,
-                                            mozilla::ErrorResult& aRv)
-{
-    nsCOMPtr<nsIDOMDocument> document;
-    aRv = TransformToDocument(source.AsDOMNode(), getter_AddRefs(document));
-    nsCOMPtr<nsIDocument> domDoc = do_QueryInterface(document);
-    return domDoc.forget();
-}
-
-void
-txMozillaXSLTProcessor::SetParameter(JSContext* aCx,
-                                     const nsAString& aNamespaceURI,
-                                     const nsAString& aLocalName,
-                                     JS::Handle<JS::Value> aValue,
-                                     mozilla::ErrorResult& aRv)
-{
-    nsCOMPtr<nsIVariant> val;
-    aRv = nsContentUtils::XPConnect()->JSToVariant(aCx, aValue,
-                                                   getter_AddRefs(val));
-    if (aRv.Failed()) {
-        return;
-    }
-    aRv = SetParameter(aNamespaceURI, aLocalName, val);
-}
-
-nsIVariant*
-txMozillaXSLTProcessor::GetParameter(const nsAString& aNamespaceURI,
-                                     const nsAString& aLocalName,
-                                     mozilla::ErrorResult& aRv)
-{
-    nsCOMPtr<nsIVariant> val;
-    aRv = GetParameter(aNamespaceURI, aLocalName, getter_AddRefs(val));
-    return val;
-}
-
 /* static*/
 nsresult
 txMozillaXSLTProcessor::Startup()
 {
     if (!txXSLTProcessor::init()) {
         return NS_ERROR_OUT_OF_MEMORY;
     }
 
--- a/dom/xslt/xslt/txMozillaXSLTProcessor.h
+++ b/dom/xslt/xslt/txMozillaXSLTProcessor.h
@@ -9,66 +9,52 @@
 #include "nsAutoPtr.h"
 #include "nsStubMutationObserver.h"
 #include "nsIDocumentTransformer.h"
 #include "nsIXSLTProcessor.h"
 #include "nsIXSLTProcessorPrivate.h"
 #include "txExpandedNameMap.h"
 #include "txNamespaceMap.h"
 #include "nsCycleCollectionParticipant.h"
-#include "nsWrapperCache.h"
 #include "mozilla/Attributes.h"
-#include "mozilla/ErrorResult.h"
 
-class nsINode;
 class nsIDOMNode;
 class nsIURI;
 class nsIXMLContentSink;
 class txStylesheet;
 class txResultRecycler;
 class txIGlobalParameter;
 
-namespace mozilla {
-namespace dom {
-
-class Document;
-class DocumentFragment;
-class GlobalObject;
-
-}
-}
-
 /* bacd8ad0-552f-11d3-a9f7-000064657374 */
 #define TRANSFORMIIX_XSLT_PROCESSOR_CID   \
 { 0x618ee71d, 0xd7a7, 0x41a1, {0xa3, 0xfb, 0xc2, 0xbe, 0xdc, 0x6a, 0x21, 0x7e} }
 
 #define TRANSFORMIIX_XSLT_PROCESSOR_CONTRACTID \
 "@mozilla.org/document-transformer;1?type=xslt"
 
 #define XSLT_MSGS_URL  "chrome://global/locale/xslt/xslt.properties"
 
 /**
  * txMozillaXSLTProcessor is a front-end to the XSLT Processor.
  */
 class txMozillaXSLTProcessor MOZ_FINAL : public nsIXSLTProcessor,
                                          public nsIXSLTProcessorPrivate,
                                          public nsIDocumentTransformer,
-                                         public nsStubMutationObserver,
-                                         public nsWrapperCache
+                                         public nsStubMutationObserver
 {
 public:
     /**
      * Creates a new txMozillaXSLTProcessor
      */
     txMozillaXSLTProcessor();
 
     // nsISupports interface
     NS_DECL_CYCLE_COLLECTING_ISUPPORTS
-    NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_AMBIGUOUS(txMozillaXSLTProcessor,
-                                                           nsIXSLTProcessor)
+    NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(txMozillaXSLTProcessor,
+                                             nsIXSLTProcessor)
 
     // nsIXSLTProcessor interface
     NS_DECL_NSIXSLTPROCESSOR
 
     // nsIXSLTProcessorPrivate interface
     NS_DECL_NSIXSLTPROCESSORPRIVATE
 
     // nsIDocumentTransformer interface
@@ -87,59 +73,16 @@ public:
     // nsIMutationObserver interface
     NS_DECL_NSIMUTATIONOBSERVER_CHARACTERDATACHANGED
     NS_DECL_NSIMUTATIONOBSERVER_ATTRIBUTECHANGED
     NS_DECL_NSIMUTATIONOBSERVER_CONTENTAPPENDED
     NS_DECL_NSIMUTATIONOBSERVER_CONTENTINSERTED
     NS_DECL_NSIMUTATIONOBSERVER_CONTENTREMOVED
     NS_DECL_NSIMUTATIONOBSERVER_NODEWILLBEDESTROYED
 
-    // nsWrapperCache
-    virtual JSObject* WrapObject(JSContext* aCx) MOZ_OVERRIDE;
-
-    // WebIDL
-    nsISupports*
-    GetParentObject() const
-    {
-        return mOwner;
-    }
-
-    static already_AddRefed<txMozillaXSLTProcessor>
-    Constructor(const mozilla::dom::GlobalObject& aGlobal,
-                mozilla::ErrorResult& aRv);
-
-    void ImportStylesheet(nsINode& stylesheet,
-                          mozilla::ErrorResult& aRv);
-    already_AddRefed<mozilla::dom::DocumentFragment>
-    TransformToFragment(nsINode& source, nsIDocument& docVal, mozilla::ErrorResult& aRv);
-    already_AddRefed<nsIDocument>
-    TransformToDocument(nsINode& source, mozilla::ErrorResult& aRv);
-
-    void SetParameter(JSContext* aCx,
-                      const nsAString& aNamespaceURI,
-                      const nsAString& aLocalName,
-                      JS::Handle<JS::Value> aValue,
-                      mozilla::ErrorResult& aRv);
-    nsIVariant* GetParameter(const nsAString& aNamespaceURI,
-                             const nsAString& aLocalName,
-                             mozilla::ErrorResult& aRv);
-    void RemoveParameter(const nsAString& aNamespaceURI,
-                         const nsAString& aLocalName,
-                         mozilla::ErrorResult& aRv)
-    {
-        aRv = RemoveParameter(aNamespaceURI, aLocalName);
-    }
-
-    uint32_t Flags()
-    {
-        uint32_t flags;
-        GetFlags(&flags);
-        return flags;
-    }
-
     nsresult setStylesheet(txStylesheet* aStylesheet);
     void reportError(nsresult aResult, const char16_t *aErrorText,
                      const char16_t *aSourceText);
 
     nsIDOMNode *GetSourceContentModel()
     {
         return mSource;
     }
@@ -151,28 +94,25 @@ public:
     {
         return (mFlags & DISABLE_ALL_LOADS) != 0;
     }
 
     static nsresult Startup();
     static void Shutdown();
 
 private:
-    txMozillaXSLTProcessor(nsISupports* aOwner);
     /**
      * Default destructor for txMozillaXSLTProcessor
      */
     ~txMozillaXSLTProcessor();
 
     nsresult DoTransform();
     void notifyError();
     nsresult ensureStylesheet();
 
-    nsCOMPtr<nsISupports> mOwner;
-
     nsRefPtr<txStylesheet> mStylesheet;
     nsIDocument* mStylesheetDocument; // weak
     nsCOMPtr<nsIContent> mEmbeddedStylesheetRoot;
 
     nsCOMPtr<nsIDOMNode> mSource;
     nsresult mTransformResult;
     nsresult mCompileResult;
     nsString mErrorText, mSourceText;
--- a/dom/xslt/xslt/txOutputFormat.cpp
+++ b/dom/xslt/xslt/txOutputFormat.cpp
@@ -1,16 +1,15 @@
 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "txOutputFormat.h"
 #include "txXMLUtils.h"
-#include "txExpandedName.h"
 
 txOutputFormat::txOutputFormat() : mMethod(eMethodNotSet),
                                    mOmitXMLDeclaration(eNotSet),
                                    mStandalone(eNotSet),
                                    mIndent(eNotSet)
 {
 }
 
--- a/dom/xslt/xslt/txXSLTEnvironmentFunctionCall.cpp
+++ b/dom/xslt/xslt/txXSLTEnvironmentFunctionCall.cpp
@@ -3,17 +3,16 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "txIXPathContext.h"
 #include "nsGkAtoms.h"
 #include "nsError.h"
 #include "txXMLUtils.h"
 #include "txXSLTFunctions.h"
-#include "txExpandedName.h"
 #include "txNamespaceMap.h"
 
 nsresult
 txXSLTEnvironmentFunctionCall::evaluate(txIEvalContext* aContext,
                                         txAExprResult** aResult)
 {
     *aResult = nullptr;
 
--- a/dom/xslt/xslt/txXSLTPatterns.h
+++ b/dom/xslt/xslt/txXSLTPatterns.h
@@ -2,17 +2,16 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef TX_XSLT_PATTERNS_H
 #define TX_XSLT_PATTERNS_H
 
 #include "mozilla/Attributes.h"
-#include "txExpandedName.h"
 #include "txExpr.h"
 #include "txXMLUtils.h"
 
 class ProcessorState;
 
 class txPattern
 {
 public: