Backed out changeset e0cce6a738c9 (Bug 466224 - Make quickstubs call nsINode/nsINodeList methods) for failing mochitest
authorPhil Ringnalda <philringnalda@gmail.com>
Wed, 31 Dec 2008 18:21:52 -0800
changeset 23210 de8572d5add0ea788427cc233df093a3e893d76d
parent 23208 e0cce6a738c9e2e69f5e4fc8a0bff2f0d71f2e91
child 23211 159587872b029931e2d3cdb349438b91d412d2ec
push id1
push userroot
push dateTue, 26 Apr 2011 22:38:44 +0000
treeherdermozilla-beta@bfdb6e623a36 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs466224
milestone1.9.2a1pre
backs oute0cce6a738c9e2e69f5e4fc8a0bff2f0d71f2e91
Backed out changeset e0cce6a738c9 (Bug 466224 - Make quickstubs call nsINode/nsINodeList methods) for failing mochitest
content/base/public/nsIDocument.h
content/base/public/nsINode.h
content/base/public/nsINodeList.h
content/base/src/nsDOMAttribute.cpp
content/base/src/nsDocument.cpp
content/base/src/nsGenericDOMDataNode.cpp
content/base/src/nsGenericDOMDataNode.h
content/base/src/nsGenericElement.cpp
content/base/src/nsGenericElement.h
js/src/xpconnect/src/Makefile.in
js/src/xpconnect/src/dom_quickstubs.qsconf
js/src/xpconnect/src/nsXPConnect.cpp
js/src/xpconnect/src/qsgen.py
js/src/xpconnect/src/xpcconvert.cpp
js/src/xpconnect/src/xpcprivate.h
js/src/xpconnect/src/xpcquickstubs.cpp
js/src/xpconnect/src/xpcquickstubs.h
js/src/xpconnect/src/xpcwrappedjsclass.cpp
--- a/content/base/public/nsIDocument.h
+++ b/content/base/public/nsIDocument.h
@@ -1294,17 +1294,9 @@ NS_NewDOMDocument(nsIDOMDocument** aInst
                   nsIDOMDocumentType* aDoctype,
                   nsIURI* aDocumentURI,
                   nsIURI* aBaseURI,
                   nsIPrincipal* aPrincipal,
                   PRBool aLoadedAsData);
 nsresult
 NS_NewPluginDocument(nsIDocument** aInstancePtrResult);
 
-inline nsIDocument*
-nsINode::GetOwnerDocument() const
-{
-  nsIDocument* ownerDoc = GetOwnerDoc();
-
-  return ownerDoc != this ? ownerDoc : nsnull;
-}
-
 #endif /* nsIDocument_h___ */
--- a/content/base/public/nsINode.h
+++ b/content/base/public/nsINode.h
@@ -44,18 +44,16 @@
 #include "nsTObserverArray.h"
 #include "nsINodeInfo.h"
 #include "nsCOMPtr.h"
 #include "nsWrapperCache.h"
 
 class nsIContent;
 class nsIDocument;
 class nsIDOMEvent;
-class nsIDOMNode;
-class nsIDOMNodeList;
 class nsIPresShell;
 class nsPresContext;
 class nsEventChainVisitor;
 class nsEventChainPreVisitor;
 class nsEventChainPostVisitor;
 class nsIEventListenerManager;
 class nsIPrincipal;
 class nsVoidArray;
@@ -148,19 +146,19 @@ inline nsINode* NODE_FROM(C& aContent, D
   if (aContent)
     return static_cast<nsINode*>(aContent);
   return static_cast<nsINode*>(aDocument);
 }
 
 
 // IID for the nsINode interface
 #define NS_INODE_IID \
-{ 0x0dc8fad3, 0xcb3f, 0x4f14, \
- { 0x8e, 0x7e, 0x4f, 0x62, 0xab, 0x74, 0xb8, 0x1e } }
- 
+{ 0xb4125da4, 0x6f86, 0x45aa, \
+ { 0xbb, 0x55, 0x80, 0x70, 0x44, 0x24, 0xe2, 0x47 } }
+
 /**
  * An internal interface that abstracts some DOMNode-related parts that both
  * nsIContent and nsIDocument share.  An instance of this interface has a list
  * of nsIContent children and provides access to them.
  */
 class nsINode : public nsPIDOMEventTarget,
                 public nsWrapperCache
 {
@@ -685,40 +683,16 @@ public:
    * Get the nearest selection root, ie. the node that will be selected if the
    * user does "Select All" while the focus is in this node. Note that if this
    * node is not in an editor, the result comes from the nsFrameSelection that
    * is related to aPresShell, so the result might not be the ancestor of this
    * node.
    */
   nsIContent* GetSelectionRootContent(nsIPresShell* aPresShell);
 
-  virtual nsIDOMNodeList* GetChildNodesList();
-  nsIContent* GetSibling(PRInt32 aOffset)
-  {
-    nsINode *parent = GetNodeParent();
-    if (!parent) {
-      return nsnull;
-    }
-
-    return parent->GetChildAt(parent->IndexOf(this) + aOffset);
-  }
-  nsIContent* GetLastChild() const
-  {
-    PRUint32 count;
-    nsIContent* const* children = GetChildArray(&count);
-
-    return count > 0 ? children[count - 1] : nsnull;
-  }
-
-  /**
-   * Implementation is in nsIDocument.h, because it needs to cast from
-   * nsIDocument* to nsINode*.
-   */
-  nsIDocument* GetOwnerDocument() const;
-
 protected:
 
   // Override this function to create a custom slots class.
   virtual nsINode::nsSlots* CreateSlots();
 
   PRBool HasSlots() const
   {
     return !(mFlagsOrSlots & NODE_DOESNT_HAVE_SLOTS);
@@ -755,24 +729,16 @@ protected:
   }
 
   PRBool IsEditableInternal() const;
   virtual PRBool IsEditableExternal() const
   {
     return IsEditableInternal();
   }
 
-  nsresult GetParentNode(nsIDOMNode** aParentNode);
-  nsresult GetChildNodes(nsIDOMNodeList** aChildNodes);
-  nsresult GetFirstChild(nsIDOMNode** aFirstChild);
-  nsresult GetLastChild(nsIDOMNode** aLastChild);
-  nsresult GetPreviousSibling(nsIDOMNode** aPrevSibling);
-  nsresult GetNextSibling(nsIDOMNode** aNextSibling);
-  nsresult GetOwnerDocument(nsIDOMDocument** aOwnerDocument);
-
   nsCOMPtr<nsINodeInfo> mNodeInfo;
 
   enum { PARENT_BIT_INDOCUMENT = 1 << 0, PARENT_BIT_PARENT_IS_CONTENT = 1 << 1 };
   enum { kParentBitMask = 0x3 };
 
   PtrBits mParentPtrBits;
 
   /**
@@ -806,18 +772,17 @@ extern const nsIID kThisPtrOffsetsSID;
 #define NS_OFFSET_AND_INTERFACE_TABLE_TO_MAP_SEGUE                            \
   rv = NS_TableDrivenQI(this, offsetAndQITable, aIID, aInstancePtr);          \
   NS_INTERFACE_TABLE_TO_MAP_SEGUE
 
 // nsNodeSH::PreCreate() depends on the identity pointer being the same as
 // nsINode, so if you change the nsISupports line  below, make sure
 // nsNodeSH::PreCreate() still does the right thing!
 #define NS_NODE_OFFSET_AND_INTERFACE_TABLE_BEGIN(_class)                      \
-  NS_OFFSET_AND_INTERFACE_TABLE_BEGIN_AMBIGUOUS(_class, nsINode)              \
-    NS_INTERFACE_TABLE_ENTRY(_class, nsINode)                       
+  NS_OFFSET_AND_INTERFACE_TABLE_BEGIN_AMBIGUOUS(_class, nsINode)
 
 #define NS_NODE_INTERFACE_TABLE2(_class, _i1, _i2)                            \
   NS_NODE_OFFSET_AND_INTERFACE_TABLE_BEGIN(_class)                            \
     NS_INTERFACE_TABLE_ENTRY(_class, _i1)                                     \
     NS_INTERFACE_TABLE_ENTRY(_class, _i2)                                     \
   NS_OFFSET_AND_INTERFACE_TABLE_END                                           \
   NS_OFFSET_AND_INTERFACE_TABLE_TO_MAP_SEGUE
 
--- a/content/base/public/nsINodeList.h
+++ b/content/base/public/nsINodeList.h
@@ -33,19 +33,18 @@
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 #ifndef nsINodeList_h___
 #define nsINodeList_h___
 
-#include "nsIDOMNodeList.h"
-
 class nsINode;
+class nsIDOMNodeList;
 
 // IID for the nsINodeList interface
 #define NS_INODELIST_IID \
 { 0x943420c4, 0x8774, 0x43ea, \
  { 0xb3, 0x53, 0x62, 0xa1, 0x26, 0x1c, 0x9b, 0x55 } }
 
 /**
  * An internal interface that allows QI-less getting of nodes from node lists
--- a/content/base/src/nsDOMAttribute.cpp
+++ b/content/base/src/nsDOMAttribute.cpp
@@ -255,17 +255,28 @@ nsDOMAttribute::GetParentNode(nsIDOMNode
 
   *aParentNode = nsnull;
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsDOMAttribute::GetChildNodes(nsIDOMNodeList** aChildNodes)
 {
-  return nsINode::GetChildNodes(aChildNodes);
+  nsSlots *slots = GetSlots();
+  NS_ENSURE_TRUE(slots, NS_ERROR_OUT_OF_MEMORY);
+
+  if (!slots->mChildNodes) {
+    slots->mChildNodes = new nsChildContentList(this);
+    NS_ENSURE_TRUE(slots->mChildNodes, NS_ERROR_OUT_OF_MEMORY);
+    NS_ADDREF(slots->mChildNodes);
+  }
+
+  NS_ADDREF(*aChildNodes = slots->mChildNodes);
+
+  return NS_OK;
 }
 
 NS_IMETHODIMP
 nsDOMAttribute::HasChildNodes(PRBool* aHasChildNodes)
 {
   PRBool hasChild;
   nsresult rv = EnsureChildState(PR_FALSE, hasChild);
   NS_ENSURE_SUCCESS(rv, rv);
@@ -381,17 +392,21 @@ NS_IMETHODIMP
 nsDOMAttribute::CloneNode(PRBool aDeep, nsIDOMNode** aResult)
 {
   return nsNodeUtils::CloneNodeImpl(this, aDeep, aResult);
 }
 
 NS_IMETHODIMP
 nsDOMAttribute::GetOwnerDocument(nsIDOMDocument** aOwnerDocument)
 {
-  return nsINode::GetOwnerDocument(aOwnerDocument);
+  *aOwnerDocument = nsnull;
+
+  nsIDocument *document = GetOwnerDoc();
+
+  return document ? CallQueryInterface(document, aOwnerDocument) : NS_OK;
 }
 
 NS_IMETHODIMP
 nsDOMAttribute::GetNamespaceURI(nsAString& aNamespaceURI)
 {
   return mNodeInfo->GetNamespaceURI(aNamespaceURI);
 }
 
--- a/content/base/src/nsDocument.cpp
+++ b/content/base/src/nsDocument.cpp
@@ -5328,17 +5328,28 @@ nsDocument::GetParentNode(nsIDOMNode** a
   *aParentNode = nsnull;
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsDocument::GetChildNodes(nsIDOMNodeList** aChildNodes)
 {
-  return nsINode::GetChildNodes(aChildNodes);
+  nsSlots *slots = GetSlots();
+  NS_ENSURE_TRUE(slots, NS_ERROR_OUT_OF_MEMORY);
+
+  if (!slots->mChildNodes) {
+    slots->mChildNodes = new nsChildContentList(this);
+    NS_ENSURE_TRUE(slots->mChildNodes, NS_ERROR_OUT_OF_MEMORY);
+    NS_ADDREF(slots->mChildNodes);
+  }
+
+  NS_ADDREF(*aChildNodes = slots->mChildNodes);
+
+  return NS_OK;
 }
 
 NS_IMETHODIMP
 nsDocument::HasChildNodes(PRBool* aHasChildNodes)
 {
   NS_ENSURE_ARG(aHasChildNodes);
 
   *aHasChildNodes = (mChildren.ChildCount() != 0);
@@ -5354,23 +5365,36 @@ nsDocument::HasAttributes(PRBool* aHasAt
   *aHasAttributes = PR_FALSE;
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsDocument::GetFirstChild(nsIDOMNode** aFirstChild)
 {
-  return nsINode::GetFirstChild(aFirstChild);
+  if (mChildren.ChildCount()) {
+    return CallQueryInterface(mChildren.ChildAt(0), aFirstChild);
+  }
+
+  *aFirstChild = nsnull;
+
+  return NS_OK;
 }
 
 NS_IMETHODIMP
 nsDocument::GetLastChild(nsIDOMNode** aLastChild)
 {
-  return nsINode::GetLastChild(aLastChild);
+  PRInt32 count = mChildren.ChildCount();
+  if (count) {
+    return CallQueryInterface(mChildren.ChildAt(count-1), aLastChild);
+  }
+
+  *aLastChild = nsnull;
+
+  return NS_OK;
 }
 
 NS_IMETHODIMP
 nsDocument::GetPreviousSibling(nsIDOMNode** aPreviousSibling)
 {
   *aPreviousSibling = nsnull;
 
   return NS_OK;
@@ -5962,17 +5986,19 @@ nsDocument::RenameNode(nsIDOMNode *aNode
 {
   return NS_ERROR_NOT_IMPLEMENTED;
 }
 
 
 NS_IMETHODIMP
 nsDocument::GetOwnerDocument(nsIDOMDocument** aOwnerDocument)
 {
-  return nsINode::GetOwnerDocument(aOwnerDocument);
+  *aOwnerDocument = nsnull;
+
+  return NS_OK;
 }
 
 nsresult
 nsDocument::GetListenerManager(PRBool aCreateIfNotFound,
                                nsIEventListenerManager** aInstancePtrResult)
 {
   if (mListenerManager) {
     *aInstancePtrResult = mListenerManager;
--- a/content/base/src/nsGenericDOMDataNode.cpp
+++ b/content/base/src/nsGenericDOMDataNode.cpp
@@ -141,16 +141,87 @@ nsGenericDOMDataNode::GetNodeValue(nsASt
 nsresult
 nsGenericDOMDataNode::SetNodeValue(const nsAString& aNodeValue)
 {
   return SetTextInternal(0, mText.GetLength(), aNodeValue.BeginReading(),
                          aNodeValue.Length(), PR_TRUE);
 }
 
 nsresult
+nsGenericDOMDataNode::GetParentNode(nsIDOMNode** aParentNode)
+{
+  *aParentNode = nsnull;
+  nsINode *parent = GetNodeParent();
+
+  return parent ? CallQueryInterface(parent, aParentNode) : NS_OK;
+}
+
+nsresult
+nsGenericDOMDataNode::GetPreviousSibling(nsIDOMNode** aPrevSibling)
+{
+  *aPrevSibling = nsnull;
+
+  nsINode *parent = GetNodeParent();
+  if (!parent) {
+    return NS_OK;
+  }
+
+  PRInt32 pos = parent->IndexOf(this);
+  nsIContent *sibling = parent->GetChildAt(pos - 1);
+
+  return sibling ? CallQueryInterface(sibling, aPrevSibling) : NS_OK;
+}
+
+nsresult
+nsGenericDOMDataNode::GetNextSibling(nsIDOMNode** aNextSibling)
+{
+  *aNextSibling = nsnull;
+
+  nsINode *parent = GetNodeParent();
+  if (!parent) {
+    return NS_OK;
+  }
+
+  PRInt32 pos = parent->IndexOf(this);
+  nsIContent *sibling = parent->GetChildAt(pos + 1);
+
+  return sibling ? CallQueryInterface(sibling, aNextSibling) : NS_OK;
+}
+
+nsresult
+nsGenericDOMDataNode::GetChildNodes(nsIDOMNodeList** aChildNodes)
+{
+  *aChildNodes = nsnull;
+  nsDataSlots *slots = GetDataSlots();
+  NS_ENSURE_TRUE(slots, NS_ERROR_OUT_OF_MEMORY);
+
+  if (!slots->mChildNodes) {
+    slots->mChildNodes = new nsChildContentList(this);
+    NS_ENSURE_TRUE(slots->mChildNodes, NS_ERROR_OUT_OF_MEMORY);
+    NS_ADDREF(slots->mChildNodes);
+  }
+
+  NS_ADDREF(*aChildNodes = slots->mChildNodes);
+  return NS_OK;
+}
+
+nsresult
+nsGenericDOMDataNode::GetOwnerDocument(nsIDOMDocument** aOwnerDocument)
+{
+  nsIDocument *document = GetOwnerDoc();
+  if (document) {
+    return CallQueryInterface(document, aOwnerDocument);
+  }
+
+  *aOwnerDocument = nsnull;
+
+  return NS_OK;
+}
+
+nsresult
 nsGenericDOMDataNode::GetNamespaceURI(nsAString& aNamespaceURI)
 {
   SetDOMStringToNull(aNamespaceURI);
 
   return NS_OK;
 }
 
 nsresult
--- a/content/base/src/nsGenericDOMDataNode.h
+++ b/content/base/src/nsGenericDOMDataNode.h
@@ -68,34 +68,50 @@ public:
   NS_DECL_CYCLE_COLLECTING_ISUPPORTS
 
   nsGenericDOMDataNode(nsINodeInfo *aNodeInfo);
   virtual ~nsGenericDOMDataNode();
 
   // Implementation for nsIDOMNode
   nsresult GetNodeValue(nsAString& aNodeValue);
   nsresult SetNodeValue(const nsAString& aNodeValue);
+  nsresult GetParentNode(nsIDOMNode** aParentNode);
   nsresult GetAttributes(nsIDOMNamedNodeMap** aAttributes)
   {
     NS_ENSURE_ARG_POINTER(aAttributes);
     *aAttributes = nsnull;
     return NS_OK;
   }
+  nsresult GetPreviousSibling(nsIDOMNode** aPreviousSibling);
+  nsresult GetNextSibling(nsIDOMNode** aNextSibling);
+  nsresult GetChildNodes(nsIDOMNodeList** aChildNodes);
   nsresult HasChildNodes(PRBool* aHasChildNodes)
   {
     NS_ENSURE_ARG_POINTER(aHasChildNodes);
     *aHasChildNodes = PR_FALSE;
     return NS_OK;
   }
   nsresult HasAttributes(PRBool* aHasAttributes)
   {
     NS_ENSURE_ARG_POINTER(aHasAttributes);
     *aHasAttributes = PR_FALSE;
     return NS_OK;
   }
+  nsresult GetFirstChild(nsIDOMNode** aFirstChild)
+  {
+    NS_ENSURE_ARG_POINTER(aFirstChild);
+    *aFirstChild = nsnull;
+    return NS_OK;
+  }
+  nsresult GetLastChild(nsIDOMNode** aLastChild)
+  {
+    NS_ENSURE_ARG_POINTER(aLastChild);
+    *aLastChild = nsnull;
+    return NS_OK;
+  }
   nsresult InsertBefore(nsIDOMNode* aNewChild, nsIDOMNode* aRefChild,
                         nsIDOMNode** aReturn)
   {
     NS_ENSURE_ARG_POINTER(aReturn);
     *aReturn = nsnull;
     return NS_ERROR_DOM_HIERARCHY_REQUEST_ERR;
   }
   nsresult ReplaceChild(nsIDOMNode* aNewChild, nsIDOMNode* aOldChild,
@@ -121,16 +137,17 @@ public:
     return NS_ERROR_DOM_NOT_FOUND_ERR;
   }
   nsresult AppendChild(nsIDOMNode* aNewChild, nsIDOMNode** aReturn)
   {
     NS_ENSURE_ARG_POINTER(aReturn);
     *aReturn = nsnull;
     return NS_ERROR_DOM_HIERARCHY_REQUEST_ERR;
   }
+  nsresult GetOwnerDocument(nsIDOMDocument** aOwnerDocument);
   nsresult GetNamespaceURI(nsAString& aNamespaceURI);
   nsresult GetLocalName(nsAString& aLocalName);
   nsresult GetPrefix(nsAString& aPrefix);
   nsresult SetPrefix(const nsAString& aPrefix);
   nsresult Normalize();
   nsresult IsSupported(const nsAString& aFeature,
                        const nsAString& aVersion,
                        PRBool* aReturn);
--- a/content/base/src/nsGenericElement.cpp
+++ b/content/base/src/nsGenericElement.cpp
@@ -419,113 +419,16 @@ nsINode::GetSelectionRootContent(nsIPres
   content = fs->GetAncestorLimiter();
   if (content)
     return content;
   nsIDocument* doc = aPresShell->GetDocument();
   NS_ENSURE_TRUE(doc, nsnull);
   return doc->GetRootContent();
 }
 
-nsIDOMNodeList*
-nsINode::GetChildNodesList()
-{
-  nsSlots *slots = GetSlots();
-  if (!slots) {
-    return nsnull;
-  }
-
-  if (!slots->mChildNodes) {
-    slots->mChildNodes = new nsChildContentList(this);
-    if (slots->mChildNodes) {
-      NS_ADDREF(slots->mChildNodes);
-    }
-  }
-
-  return slots->mChildNodes;
-}
-
-nsresult
-nsINode::GetParentNode(nsIDOMNode** aParentNode)
-{
-  *aParentNode = nsnull;
-
-  nsINode *parent = GetNodeParent();
-
-  return parent ? CallQueryInterface(parent, aParentNode) : NS_OK;
-}
-
-nsresult
-nsINode::GetChildNodes(nsIDOMNodeList** aChildNodes)
-{
-  *aChildNodes = GetChildNodesList();
-  if (!*aChildNodes) {
-    return NS_ERROR_OUT_OF_MEMORY;
-  }
-
-  NS_ADDREF(*aChildNodes);
-
-  return NS_OK;
-}
-
-nsresult
-nsINode::GetFirstChild(nsIDOMNode** aNode)
-{
-  nsIContent* child = GetChildAt(0);
-  if (child) {
-    return CallQueryInterface(child, aNode);
-  }
-
-  *aNode = nsnull;
-
-  return NS_OK;
-}
-
-nsresult
-nsINode::GetLastChild(nsIDOMNode** aNode)
-{
-  nsIContent* child = GetLastChild();
-  if (child) {
-    return CallQueryInterface(child, aNode);
-  }
-
-  *aNode = nsnull;
-
-  return NS_OK;
-}
-
-nsresult
-nsINode::GetPreviousSibling(nsIDOMNode** aPrevSibling)
-{
-  *aPrevSibling = nsnull;
-
-  nsIContent *sibling = GetSibling(-1);
-
-  return sibling ? CallQueryInterface(sibling, aPrevSibling) : NS_OK;
-}
-
-nsresult
-nsINode::GetNextSibling(nsIDOMNode** aNextSibling)
-{
-  *aNextSibling = nsnull;
-
-  nsIContent *sibling = GetSibling(1);
-
-  return sibling ? CallQueryInterface(sibling, aNextSibling) : NS_OK;
-}
-
-nsresult
-nsINode::GetOwnerDocument(nsIDOMDocument** aOwnerDocument)
-{
-  *aOwnerDocument = nsnull;
-
-  nsIDocument *ownerDoc = GetOwnerDocument();
-
-  return ownerDoc ? CallQueryInterface(ownerDoc, aOwnerDocument) : NS_OK;
-}
-
 //----------------------------------------------------------------------
 
 PRInt32
 nsIContent::IntrinsicState() const
 {
   return IsEditable() ? NS_EVENT_STATE_MOZ_READWRITE :
                         NS_EVENT_STATE_MOZ_READONLY;
 }
@@ -1794,16 +1697,70 @@ nsGenericElement::SetNodeValue(const nsA
 NS_IMETHODIMP
 nsGenericElement::GetNodeType(PRUint16* aNodeType)
 {
   *aNodeType = (PRUint16)nsIDOMNode::ELEMENT_NODE;
   return NS_OK;
 }
 
 NS_IMETHODIMP
+nsGenericElement::GetParentNode(nsIDOMNode** aParentNode)
+{
+  *aParentNode = nsnull;
+  nsINode *parent = GetNodeParent();
+
+  return parent ? CallQueryInterface(parent, aParentNode) : NS_OK;
+}
+
+NS_IMETHODIMP
+nsGenericElement::GetPreviousSibling(nsIDOMNode** aPrevSibling)
+{
+  *aPrevSibling = nsnull;
+
+  nsINode *parent = GetNodeParent();
+  if (!parent) {
+    return NS_OK;
+  }
+
+  PRInt32 pos = parent->IndexOf(this);
+  nsIContent *sibling = parent->GetChildAt(pos - 1);
+
+  return sibling ? CallQueryInterface(sibling, aPrevSibling) : NS_OK;
+}
+
+NS_IMETHODIMP
+nsGenericElement::GetNextSibling(nsIDOMNode** aNextSibling)
+{
+  *aNextSibling = nsnull;
+
+  nsINode *parent = GetNodeParent();
+  if (!parent) {
+    return NS_OK;
+  }
+
+  PRInt32 pos = parent->IndexOf(this);
+  nsIContent *sibling = parent->GetChildAt(pos + 1);
+
+  return sibling ? CallQueryInterface(sibling, aNextSibling) : NS_OK;
+}
+
+NS_IMETHODIMP
+nsGenericElement::GetOwnerDocument(nsIDOMDocument** aOwnerDocument)
+{
+  nsIDocument *doc = GetOwnerDoc();
+  if (doc) {
+    return CallQueryInterface(doc, aOwnerDocument);
+  }
+
+  *aOwnerDocument = nsnull;
+
+  return NS_OK;
+}
+
+NS_IMETHODIMP
 nsGenericElement::GetNamespaceURI(nsAString& aNamespaceURI)
 {
   return mNodeInfo->GetNamespaceURI(aNamespaceURI);
 }
 
 NS_IMETHODIMP
 nsGenericElement::GetPrefix(nsAString& aPrefix)
 {
@@ -1985,23 +1942,72 @@ nsGenericElement::GetAttributes(nsIDOMNa
   }
 
   NS_ADDREF(*aAttributes = slots->mAttributeMap);
 
   return NS_OK;
 }
 
 nsresult
+nsGenericElement::GetChildNodes(nsIDOMNodeList** aChildNodes)
+{
+  nsSlots *slots = GetSlots();
+
+  if (!slots) {
+    return NS_ERROR_OUT_OF_MEMORY;
+  }
+
+  if (!slots->mChildNodes) {
+    slots->mChildNodes = new nsChildContentList(this);
+    if (!slots->mChildNodes) {
+      return NS_ERROR_OUT_OF_MEMORY;
+    }
+    NS_ADDREF(slots->mChildNodes);
+  }
+
+  NS_ADDREF(*aChildNodes = slots->mChildNodes);
+
+  return NS_OK;
+}
+
+nsresult
 nsGenericElement::HasChildNodes(PRBool* aReturn)
 {
   *aReturn = mAttrsAndChildren.ChildCount() > 0;
 
   return NS_OK;
 }
 
+nsresult
+nsGenericElement::GetFirstChild(nsIDOMNode** aNode)
+{
+  nsIContent* child = GetChildAt(0);
+  if (child) {
+    return CallQueryInterface(child, aNode);
+  }
+
+  *aNode = nsnull;
+
+  return NS_OK;
+}
+
+nsresult
+nsGenericElement::GetLastChild(nsIDOMNode** aNode)
+{
+  PRUint32 count = GetChildCount();
+  
+  if (count > 0) {
+    return CallQueryInterface(GetChildAt(count - 1), aNode);
+  }
+
+  *aNode = nsnull;
+
+  return NS_OK;
+}
+
 NS_IMETHODIMP
 nsGenericElement::GetTagName(nsAString& aTagName)
 {
   mNodeInfo->GetQualifiedName(aTagName);
   return NS_OK;
 }
 
 nsresult
--- a/content/base/src/nsGenericElement.h
+++ b/content/base/src/nsGenericElement.h
@@ -465,25 +465,32 @@ public:
                           PRUint32 aMapCount);
 
   // nsIDOMNode method implementation
   NS_IMETHOD GetNodeName(nsAString& aNodeName);
   NS_IMETHOD GetLocalName(nsAString& aLocalName);
   NS_IMETHOD GetNodeValue(nsAString& aNodeValue);
   NS_IMETHOD SetNodeValue(const nsAString& aNodeValue);
   NS_IMETHOD GetNodeType(PRUint16* aNodeType);
+  NS_IMETHOD GetParentNode(nsIDOMNode** aParentNode);
   NS_IMETHOD GetAttributes(nsIDOMNamedNodeMap** aAttributes);
+  NS_IMETHOD GetPreviousSibling(nsIDOMNode** aPreviousSibling);
+  NS_IMETHOD GetNextSibling(nsIDOMNode** aNextSibling);
+  NS_IMETHOD GetOwnerDocument(nsIDOMDocument** aOwnerDocument);
   NS_IMETHOD GetNamespaceURI(nsAString& aNamespaceURI);
   NS_IMETHOD GetPrefix(nsAString& aPrefix);
   NS_IMETHOD SetPrefix(const nsAString& aPrefix);
   NS_IMETHOD Normalize();
   NS_IMETHOD IsSupported(const nsAString& aFeature,
                          const nsAString& aVersion, PRBool* aReturn);
   NS_IMETHOD HasAttributes(PRBool* aHasAttributes);
+  NS_IMETHOD GetChildNodes(nsIDOMNodeList** aChildNodes);
   NS_IMETHOD HasChildNodes(PRBool* aHasChildNodes);
+  NS_IMETHOD GetFirstChild(nsIDOMNode** aFirstChild);
+  NS_IMETHOD GetLastChild(nsIDOMNode** aLastChild);
   NS_IMETHOD InsertBefore(nsIDOMNode* aNewChild, nsIDOMNode* aRefChild,
                           nsIDOMNode** aReturn);
   NS_IMETHOD ReplaceChild(nsIDOMNode* aNewChild, nsIDOMNode* aOldChild,
                           nsIDOMNode** aReturn);
   NS_IMETHOD RemoveChild(nsIDOMNode* aOldChild, nsIDOMNode** aReturn);
   NS_IMETHOD AppendChild(nsIDOMNode* aNewChild, nsIDOMNode** aReturn)
   {
     return InsertBefore(aNewChild, nsnull, aReturn);
--- a/js/src/xpconnect/src/Makefile.in
+++ b/js/src/xpconnect/src/Makefile.in
@@ -69,17 +69,16 @@ REQUIRES	= xpcom \
 # dom_quickstubs.cpp #includes header files from many places.
 REQUIRES	+= content \
 		   editor \
 		   layout \
 		   rdf \
 		   svg \
 		   xuldoc \
 		   xultmpl \
-		   widget \
 		   $(NULL)
 
 
 CPPSRCS		= \
 		nsScriptError.cpp \
 		nsXPConnect.cpp \
 		xpccallcontext.cpp \
 		xpccomponents.cpp \
--- a/js/src/xpconnect/src/dom_quickstubs.qsconf
+++ b/js/src/xpconnect/src/dom_quickstubs.qsconf
@@ -507,56 +507,8 @@ irregularFilenames = {
     'nsIDOMNSHTMLOptionCollection': 'nsIDOMNSHTMLOptionCollectn',
     'nsIDOMHTMLTableSectionElement': 'nsIDOMHTMLTableSectionElem',
 
     # stowaways
     'nsIDOMTextMetrics': 'nsIDOMCanvasRenderingContext2D',
     'nsIDOMNSCSS2Properties': 'nsIDOMCSS2Properties',
     'nsIXPointerResult': 'nsIXPointer',
     }
-
-customIncludes = [
-    'nsINode.h',
-    'nsIContent.h',
-    'nsIDocument.h',
-    'nsINodeList.h'
-    ]
-
-nsIDOMNode_GetChildNodes_customMethodCallCode = """
-    nsIDOMNodeList* result = self->GetChildNodesList();
-    if (!result)
-        return xpc_qsThrowGetterSetterFailed(cx, NS_ERROR_OUT_OF_MEMORY, JSVAL_TO_OBJECT(*vp), id);
-"""
-
-customMethodCalls = {
-    'nsIDOMNode_GetNextSibling': {
-        'thisType': 'nsINode',
-        'code': '    nsINode* result = self->GetSibling(1);'
-        },
-    'nsIDOMNode_GetFirstChild': {
-        'thisType': 'nsINode',
-        'code': '    nsINode* result = self->GetChildAt(0);'
-        },
-    'nsIDOMNode_GetChildNodes': {
-        'thisType': 'nsINode',
-        'code': nsIDOMNode_GetChildNodes_customMethodCallCode
-        },
-    'nsIDOMNode_GetPreviousSibling': {
-        'thisType': 'nsINode',
-        'code': '    nsINode* result = self->GetSibling(-1);'
-        },
-    'nsIDOMNode_GetLastChild': {
-        'thisType': 'nsINode',
-        'code': '    nsINode* result = self->GetLastChild();'
-        },
-    'nsIDOMNode_GetOwnerDocument': {
-        'thisType': 'nsINode',
-        'code': '    nsIDocument* result = self->GetOwnerDocument();'
-        },
-    'nsIDOMNode_GetParentNode': {
-        'thisType': 'nsINode',
-        'code': '    nsINode* result = self->GetNodeParent();'
-        },
-    'nsIDOMNodeList_Item': {
-        'thisType': 'nsINodeList',
-        'code': '    nsINode* result = self->GetNodeAt(arg0);'
-        }
-    }
--- a/js/src/xpconnect/src/nsXPConnect.cpp
+++ b/js/src/xpconnect/src/nsXPConnect.cpp
@@ -1108,18 +1108,18 @@ nsXPConnect::InitClassesWithNewWrappedGl
 
         if(NS_FAILED(InitClasses(aJSContext, tempGlobal)))
             return UnexpectedFailure(NS_ERROR_FAILURE);
 
         nsresult rv;
         if(!XPCConvert::NativeInterface2JSObject(ccx, &v,
                                                  getter_AddRefs(holder),
                                                  aCOMObj, &aIID, nsnull,
-                                                 nsnull, tempGlobal,
-                                                 PR_FALSE, OBJ_IS_GLOBAL, &rv))
+                                                 tempGlobal, PR_FALSE,
+                                                 OBJ_IS_GLOBAL, &rv))
             return UnexpectedFailure(rv);
 
         NS_ASSERTION(NS_SUCCEEDED(rv) && holder, "Didn't wrap properly");
     }
 
     JSObject* globalJSObj = JSVAL_TO_OBJECT(v);
     if(!globalJSObj)
         return UnexpectedFailure(NS_ERROR_FAILURE);
@@ -1208,17 +1208,17 @@ nsXPConnect::WrapNativeToJSVal(JSContext
         *aHolder = nsnull;
 
     XPCCallContext ccx(NATIVE_CALLER, aJSContext);
     if(!ccx.IsValid())
         return UnexpectedFailure(NS_ERROR_FAILURE);
 
     nsresult rv;
     if(!XPCConvert::NativeInterface2JSObject(ccx, aVal, aHolder, aCOMObj, aIID,
-                                             nsnull, nsnull, aScope, PR_FALSE,
+                                             nsnull, aScope, PR_FALSE,
                                              OBJ_IS_NOT_GLOBAL, &rv))
         return rv;
 
 #ifdef DEBUG
     NS_ASSERTION(!XPCNativeWrapper::IsNativeWrapper(JSVAL_TO_OBJECT(*aVal)),
                  "Shouldn't be returning a native wrapper here");
 #endif
     
--- a/js/src/xpconnect/src/qsgen.py
+++ b/js/src/xpconnect/src/qsgen.py
@@ -258,18 +258,16 @@ class Configuration:
         execfile(filename, config)
         # required settings
         for name in ('name', 'members'):
             if name not in config:
                 raise UserError(filename + ": `%s` was not defined." % name)
             setattr(self, name, config[name])
         # optional settings
         self.irregularFilenames = config.get('irregularFilenames', {})
-        self.customIncludes = config.get('customIncludes', [])
-        self.customMethodCalls = config.get('customMethodCalls', {})
 
 def readConfigFile(filename, includePath, cachedir):
     # Read the config file.
     conf = Configuration(filename, includePath)
 
     # Now read IDL files to connect the information in the config file to
     # actual XPCOM interfaces, methods, and attributes.
     interfaces = []
@@ -420,26 +418,25 @@ argumentUnboxingTemplates = {
         "        return JS_FALSE;\n"
     }
 
 # From JSData2Native.
 #
 # Omitted optional arguments are treated as though the caller had passed JS
 # `null`; this behavior is from XPCWrappedNative::CallMethod.
 #
-def writeArgumentUnboxing(f, i, name, type, haveCcx, optional, rvdeclared):
+def writeArgumentUnboxing(f, i, name, type, haveCcx, optional):
     # f - file to write to
     # i - int or None - Indicates the source jsval.  If i is an int, the source
     #     jsval is argv[i]; otherwise it is *vp.  But if Python i >= C++ argc,
     #     which can only happen if optional is True, the argument is missing;
     #     use JSVAL_NULL as the source jsval instead.
     # name - str - name of the native C++ variable to create.
     # type - xpidl.{Interface,Native,Builtin} - IDL type of argument
     # optional - bool - True if the parameter is optional.
-    # rvdeclared - bool - False if no |nsresult rv| has been declared earlier.
 
     isSetter = (i is None)
 
     if isSetter:
         argPtr = "vp"
         argVal = "*vp"
     elif optional:
         argPtr = '!  /* TODO - optional parameter of this type not supported */'
@@ -457,83 +454,80 @@ def writeArgumentUnboxing(f, i, name, ty
     typeName = getBuiltinOrNativeTypeName(type)
     if typeName is not None:
         template = argumentUnboxingTemplates.get(typeName)
         if template is not None:
             if optional and ("${argPtr}" in template):
                 warn("Optional parameters of type %s are not supported."
                      % type.name)
             f.write(substitute(template, params))
-            return rvdeclared
+            return
         # else fall through; the type isn't supported yet.
     elif isInterfaceType(type):
         if type.name == 'nsIVariant':
             # Totally custom.
             assert haveCcx
             template = (
                 "    nsCOMPtr<nsIVariant> ${name}(already_AddRefed<nsIVariant>("
                 "XPCVariant::newVariant(ccx, ${argVal})));\n"
                 "    if (!${name})\n"
                 "        return JS_FALSE;\n")
             f.write(substitute(template, params))
-            return rvdeclared
+            return
         elif type.name == 'nsIAtom':
             # Should have special atomizing behavior.  Fall through.
             pass
         else:
-            if not rvdeclared:
-                f.write("    nsresult rv;\n");
             f.write("    nsCOMPtr<%s> %s;\n" % (type.name, name))
             f.write("    rv = xpc_qsUnwrapArg<%s>("
                     "cx, %s, getter_AddRefs(%s));\n"
                     % (type.name, argVal, name))
             f.write("    if (NS_FAILED(rv)) {\n")
             if isSetter:
                 f.write("        xpc_qsThrowBadSetterValue("
                         "cx, rv, JSVAL_TO_OBJECT(*tvr.addr()), id);\n")
             elif haveCcx:
                 f.write("        xpc_qsThrowBadArgWithCcx(ccx, rv, %d);\n" % i)
             else:
                 f.write("        xpc_qsThrowBadArg(cx, rv, vp, %d);\n" % i)
             f.write("        return JS_FALSE;\n"
                     "    }\n")
-            return True
+            return
 
     warn("Unable to unbox argument of type %s" % type.name)
     if i is None:
         src = '*vp'
     else:
         src = 'argv[%d]' % i
     f.write("    !; // TODO - Unbox argument %s = %s\n" % (name, src))
-    return rvdeclared
 
-def writeResultDecl(f, type, varname):
+def writeResultDecl(f, type):
     if isVoidType(type):
         return  # nothing to declare
     
     t = unaliasType(type)
     if t.kind == 'builtin':
         if not t.nativename.endswith('*'):
             if type.kind == 'typedef':
                 typeName = type.name  # use it
             else:
                 typeName = t.nativename
-            f.write("    %s %s;\n" % (typeName, varname))
+            f.write("    %s result;\n" % typeName)
             return
     elif t.kind == 'native':
         name = getBuiltinOrNativeTypeName(t)
         if name in ('[domstring]', '[astring]'):
-            f.write("    nsString %s;\n" % varname)
+            f.write("    nsString result;\n")
             return
     elif t.kind in ('interface', 'forward'):
-        f.write("    nsCOMPtr<%s> %s;\n" % (type.name, varname))
+        f.write("    nsCOMPtr<%s> result;\n" % type.name)
         return
 
     warn("Unable to declare result of type %s" % type.name)
-    f.write("    !; // TODO - Declare out parameter `%s`.\n" % varname)
+    f.write("    !; // TODO - Declare out parameter `result`.\n")
 
 def outParamForm(name, type):
     type = unaliasType(type)
     if type.kind == 'builtin':
         return '&' + name
     elif type.kind == 'native':
         if type.modifier == 'ref':
             return name
@@ -608,42 +602,39 @@ def writeResultConv(f, type, paramNum, j
         if isVariantType(type):
             f.write("    return xpc_qsVariantToJsval(ccx, result, %d, %s);\n"
                     % (paramNum, jsvalPtr))
             return
         else:
             f.write("    AutoMarkingNativeInterfacePtr resultiface(ccx, "
                     "%s_Interface(ccx));\n" % type.name)
             f.write("    return xpc_qsXPCOMObjectToJsval(ccx, result, "
-                    "xpc_qsGetWrapperCache(result), resultiface, %s);\n"
-                    % jsvalPtr)
+                    "resultiface, %s);\n" % jsvalPtr)
             return
 
     warn("Unable to convert result of type %s" % type.name)
     f.write("    !; // TODO - Convert `result` to jsval, store in `%s`.\n"
             % jsvalRef)
     f.write("    return xpc_qsThrow(cx, NS_ERROR_UNEXPECTED); // FIXME\n")
 
 def anyParamRequiresCcx(member):
     for p in member.params:
         if isVariantType(p.realtype):
             return True
     return False
 
-def writeQuickStub(f, customMethodCalls, member, stubName, isSetter=False):
+def writeQuickStub(f, member, stubName, isSetter=False):
     """ Write a single quick stub (a custom SpiderMonkey getter/setter/method)
     for the specified XPCOM interface-member. 
     """
     isAttr = (member.kind == 'attribute')
     isMethod = (member.kind == 'method')
     assert isAttr or isMethod
     isGetter = isAttr and not isSetter
 
-    customMethodCall = customMethodCalls.get(stubName, None)
-
     # Function prolog.
     f.write("static JSBool\n")
     if isAttr:
         # JSPropertyOp signature.
         f.write(stubName + "(JSContext *cx, JSObject *obj, jsval id, "
                 "jsval *vp)\n")
     else:
         # JSFastNative.
@@ -665,20 +656,18 @@ def writeQuickStub(f, customMethodCalls,
                     "JSVAL_TO_OBJECT(JS_CALLEE(cx, vp)));\n")
     else:
         # In some cases we emit a ccx, but it does not count as
         # "haveCcx" because it's not complete.
         if isAttr and isInterfaceType(member.realtype):
             f.write("    XPCCallContext ccx(JS_CALLER, cx, obj);\n")
 
     # Get the 'self' pointer.
-    if customMethodCall is None or not 'thisType' in customMethodCall:
-        f.write("    %s *self;\n" % member.iface.name)
-    else:
-        f.write("    %s *self;\n" % customMethodCall['thisType'])
+    thisType = member.iface.name
+    f.write("    %s *self;\n" % thisType)
     f.write("    xpc_qsSelfRef selfref;\n")
     # Don't use FromCcx for getters or setters; the way we construct the ccx in
     # a getter/setter causes it to find the wrong wrapper in some cases.
     if isMethod and haveCcx:
         # Undocumented, but the interpreter puts 'this' at argv[-1],
         # which is vp[1]; and it's ok to overwrite it.
         f.write("    if (!xpc_qsUnwrapThisFromCcx(ccx, &self, &selfref.ptr, "
                 "&vp[1]))\n")
@@ -707,144 +696,118 @@ def writeQuickStub(f, customMethodCalls,
                     "NS_ERROR_XPC_NOT_ENOUGH_ARGS);\n")
 
     def pfail(msg):
         raise UserError(
             member.iface.name + '.' + member.name + ": "
             "parameter " + param.name + ": " + msg)
 
     # Convert in-parameters.
-    rvdeclared = False
+    f.write("    nsresult rv;\n")
     if isMethod:
         if len(member.params) > 0:
             f.write("    jsval *argv = JS_ARGV(cx, vp);\n")
         for i, param in enumerate(member.params):
             if param.iid_is is not None:
                 pfail("iid_is parameters are not supported.")
             if param.size_is is not None:
                 pfail("size_is parameters are not supported.")
             if param.retval:
                 pfail("Unexpected retval parameter!")
             if param.paramtype in ('out', 'inout'):
                 pfail("Out parameters are not supported.")
             if param.const or param.array or param.shared:
                 pfail("I am a simple caveman.")
             # Emit code to convert this argument from jsval.
-            rvdeclared = writeArgumentUnboxing(
+            writeArgumentUnboxing(
                 f, i, 'arg%d' % i, param.realtype,
                 haveCcx=haveCcx,
-                optional=param.optional,
-                rvdeclared=rvdeclared)
+                optional=param.optional)
     elif isSetter:
-        rvdeclared = writeArgumentUnboxing(f, None, 'arg0', member.realtype,
-                                           haveCcx=False, optional=False,
-                                           rvdeclared=rvdeclared)
-
-    if customMethodCall is not None:
-        f.write("%s\n" % customMethodCall['code'])
-        f.write("#ifdef DEBUG\n")
-        f.write("    nsCOMPtr<%s> debug_self = do_QueryInterface(self);\n"
-                % member.iface.name);
-        prefix = 'debug_'
-    else:
-        prefix = ''
-
-    resultname = prefix + 'result'
-    selfname = prefix + 'self'
+        writeArgumentUnboxing(f, None, 'arg0', member.realtype,
+                              haveCcx=False, optional=False)
 
     # Prepare out-parameter.
     if isMethod or isGetter:
-        writeResultDecl(f, member.realtype, resultname)
+        writeResultDecl(f, member.realtype)
 
     # Call the method.
     if isMethod:
         comName = header.methodNativeName(member)
         argv = ['arg' + str(i) for i, p in enumerate(member.params)]
         if not isVoidType(member.realtype):
-            argv.append(outParamForm(resultname, member.realtype))
+            argv.append(outParamForm('result', member.realtype))
         args = ', '.join(argv)
     else:
         comName = header.attributeNativeName(member, isGetter)
         if isGetter:
-            args = outParamForm(resultname, member.realtype)
+            args = outParamForm("result", member.realtype)
         else:
             args = "arg0"
-
-    if not rvdeclared:
-        f.write("    nsresult rv;\n")
-        rvdeclared = True
-    f.write("    rv = %s->%s(%s);\n" % (selfname, comName, args))
+    f.write("    rv = self->%s(%s);\n" % (comName, args))
 
-    if customMethodCall is None:
-        # Check for errors.
-        f.write("    if (NS_FAILED(rv))\n")
-        if isMethod:
-            if haveCcx:
-                f.write("        return xpc_qsThrowMethodFailedWithCcx("
-                        "ccx, rv);\n")
-            else:
-                f.write("        return xpc_qsThrowMethodFailed("
-                        "cx, rv, vp);\n")
+    # Check for errors.
+    f.write("    if (NS_FAILED(rv))\n")
+    if isMethod:
+        if haveCcx:
+            f.write("        return xpc_qsThrowMethodFailedWithCcx(ccx, rv);\n")
         else:
-            if isGetter:
-                thisval = '*vp'
-            else:
-                thisval = '*tvr.addr()'
-            f.write("        return xpc_qsThrowGetterSetterFailed(cx, rv, " +
-                    "JSVAL_TO_OBJECT(%s), id);\n" % thisval)
+            f.write("        return xpc_qsThrowMethodFailed("
+                    "cx, rv, vp);\n")
     else:
-        if isMethod or isGetter:
-            f.write("    NS_ASSERTION(xpc_qsSameResult(debug_result, result),\n"
-                    "                 \"Got the wrong answer from the custom "
-                    "method call!\");\n")
-        f.write("#endif\n")
+        if isGetter:
+            thisval = '*vp'
+        else:
+            thisval = '*tvr.addr()'
+        f.write("        return xpc_qsThrowGetterSetterFailed(cx, rv, " +
+                "JSVAL_TO_OBJECT(%s), id);\n" % thisval)
 
     # Convert the return value.
     if isMethod:
         writeResultConv(f, member.realtype, len(member.params) + 1, 'vp', '*vp')
     elif isGetter:
         writeResultConv(f, member.realtype, None, 'vp', '*vp')
     else:
         f.write("    return JS_TRUE;\n")
 
     # Epilog.
     f.write("}\n\n")
 
-def writeAttrStubs(f, customMethodCalls, attr):
+def writeAttrStubs(f, attr):
     getterName = (attr.iface.name + '_'
                   + header.attributeNativeName(attr, True))
-    writeQuickStub(f, customMethodCalls, attr, getterName)
+    writeQuickStub(f, attr, getterName)
     if attr.readonly:
         setterName = 'xpc_qsReadOnlySetter'
     else:
         setterName = (attr.iface.name + '_'
                       + header.attributeNativeName(attr, False))
-        writeQuickStub(f, customMethodCalls, attr, setterName, isSetter=True)
+        writeQuickStub(f, attr, setterName, isSetter=True)
 
     ps = ('{"%s", %s, %s}'
           % (attr.name, getterName, setterName))
     return ps
 
-def writeMethodStub(f, customMethodCalls, method):
+def writeMethodStub(f, method):
     """ Write a method stub to `f`. Return an xpc_qsFunctionSpec initializer. """
     stubName = method.iface.name + '_' + header.methodNativeName(method)
-    writeQuickStub(f, customMethodCalls, method, stubName)
+    writeQuickStub(f, method, stubName)
     fs = '{"%s", %s, %d}' % (method.name, stubName, len(method.params))
     return fs
 
-def writeStubsForInterface(f, customMethodCalls, iface):
+def writeStubsForInterface(f, iface):
     f.write("// === interface %s\n\n" % iface.name)
     propspecs = []
     funcspecs = []
     for member in iface.stubMembers:
         if member.kind == 'attribute':
-            ps = writeAttrStubs(f, customMethodCalls, member)
+            ps = writeAttrStubs(f, member)
             propspecs.append(ps)
         elif member.kind == 'method':
-            fs = writeMethodStub(f, customMethodCalls, member)
+            fs = writeMethodStub(f, member)
             funcspecs.append(fs)
         else:
             raise TypeError('expected attribute or method, not %r'
                             % member.__class__.__name__)
 
     if propspecs:
         f.write("static const xpc_qsPropertySpec %s_properties[] = {\n"
                 % iface.name)
@@ -1033,25 +996,23 @@ def writeStubFile(filename, headerFilena
                 
         includeType(iface)
 
         return resulttypes
 
     try:
         f.write(stubTopTemplate % os.path.basename(headerFilename))
         N = 256
-        for customInclude in conf.customIncludes:
-            f.write('#include "%s"\n' % customInclude)
         resulttypes = []
         for iface in interfaces:
             resulttypes.extend(writeIncludesForInterface(iface))
         f.write("\n\n")
         writeResultXPCInterfacesArray(f, conf, sets.ImmutableSet(resulttypes))
         for iface in interfaces:
-            writeStubsForInterface(f, conf.customMethodCalls, iface)
+            writeStubsForInterface(f, iface)
         writeDefiner(f, conf, interfaces)
     finally:
         f.close()
 
 def makeQuote(filename):
     return filename.replace(' ', '\\ ')  # enjoy!
 
 def writeMakeDependOutput(filename):
--- a/js/src/xpconnect/src/xpcconvert.cpp
+++ b/js/src/xpconnect/src/xpcconvert.cpp
@@ -463,17 +463,17 @@ XPCConvert::NativeData2JS(XPCCallContext
                     // else...
                     
                     // XXX The OBJ_IS_NOT_GLOBAL here is not really right. In
                     // fact, this code is depending on the fact that the
                     // global object will not have been collected, and
                     // therefore this NativeInterface2JSObject will not end up
                     // creating a new XPCNativeScriptableShared.
                     if(!NativeInterface2JSObject(ccx, d, nsnull, iface, iid,
-                                                 nsnull, nsnull, scope, PR_TRUE,
+                                                 nsnull, scope, PR_TRUE,
                                                  OBJ_IS_NOT_GLOBAL, pErr))
                         return JS_FALSE;
 
 #ifdef DEBUG
                     JSObject* jsobj = JSVAL_TO_OBJECT(*d);
                     if(jsobj && !STOBJ_GET_PARENT(jsobj))
                         NS_ASSERTION(STOBJ_GET_CLASS(jsobj)->flags & JSCLASS_IS_GLOBAL,
                                      "Why did we recreate this wrapper?");
@@ -1048,17 +1048,16 @@ CreateHolderIfNeeded(XPCCallContext& ccx
 // static
 JSBool
 XPCConvert::NativeInterface2JSObject(XPCCallContext& ccx,
                                      jsval* d,
                                      nsIXPConnectJSObjectHolder** dest,
                                      nsISupports* src,
                                      const nsID* iid,
                                      XPCNativeInterface* Interface,
-                                     nsWrapperCache *cache,
                                      JSObject* scope,
                                      PRBool allowNativeWrapper,
                                      PRBool isGlobal,
                                      nsresult* pErr)
 {
     NS_ASSERTION(scope, "bad param");
 
     *d = JSVAL_NULL;
@@ -1119,18 +1118,18 @@ XPCConvert::NativeInterface2JSObject(XPC
             iface = XPCNativeInterface::GetNewOrUsed(ccx, iid);
             if(!iface)
                 return JS_FALSE;
         }
 
         nsresult rv;
         XPCWrappedNative* wrapper;
         nsRefPtr<XPCWrappedNative> strongWrapper;
-        if(!cache)
-            CallQueryInterface(src, &cache);
+        nsWrapperCache* cache = nsnull;
+        CallQueryInterface(src, &cache);
         if(cache &&
            (wrapper = static_cast<XPCWrappedNative*>(cache->GetWrapper())))
         {
             // If asked to return the wrapper we'll return a strong reference,
             // otherwise we'll just return its JSObject in rval (which should be
             // rooted in that case).
             if(dest)
                 strongWrapper = wrapper;
--- a/js/src/xpconnect/src/xpcprivate.h
+++ b/js/src/xpconnect/src/xpcprivate.h
@@ -108,17 +108,16 @@
 
 #include "nsVariant.h"
 #include "nsIPropertyBag.h"
 #include "nsIProperty.h"
 #include "nsSupportsArray.h"
 #include "nsTArray.h"
 #include "nsBaseHashtable.h"
 #include "nsHashKeys.h"
-#include "nsWrapperCache.h"
 
 #include "nsIXPCScriptNotify.h"  // used to notify: ScriptEvaluated
 
 #ifndef XPCONNECT_STANDALONE
 #define XPC_USE_SECURITY_CHECKED_COMPONENT
 #include "nsIScriptObjectPrincipal.h"
 #include "nsIPrincipal.h"
 #endif
@@ -2760,17 +2759,16 @@ public:
      * @param pErr [out] relevant error code, if any.
      */
     static JSBool NativeInterface2JSObject(XPCCallContext& ccx,
                                            jsval* d,
                                            nsIXPConnectJSObjectHolder** dest,
                                            nsISupports* src,
                                            const nsID* iid,
                                            XPCNativeInterface* Interface,
-                                           nsWrapperCache *cache,
                                            JSObject* scope,
                                            PRBool allowNativeWrapper,
                                            PRBool isGlobal,
                                            nsresult* pErr);
 
     static JSBool GetNativeInterfaceFromJSObject(XPCCallContext& ccx,
                                                  void** dest, JSObject* src,
                                                  const nsID* iid, 
--- a/js/src/xpconnect/src/xpcquickstubs.cpp
+++ b/js/src/xpconnect/src/xpcquickstubs.cpp
@@ -738,18 +738,17 @@ xpc_qsStringToJsval(JSContext *cx, const
     if(!jsstr)
         return JS_FALSE;
     *rval = STRING_TO_JSVAL(jsstr);
     return JS_TRUE;
 }
 
 JSBool
 xpc_qsXPCOMObjectToJsval(XPCCallContext &ccx, nsISupports *p,
-                         nsWrapperCache *cache, XPCNativeInterface *iface,
-                         jsval *rval)
+                         XPCNativeInterface *iface, jsval *rval)
 {
     // From the T_INTERFACE case in XPCConvert::NativeData2JS.
     // This is one of the slowest things quick stubs do.
 
     JSObject *scope = ccx.GetCurrentJSObject();
     NS_ASSERTION(scope, "bad ccx");
 
     if(!iface)
@@ -757,17 +756,17 @@ xpc_qsXPCOMObjectToJsval(XPCCallContext 
 
     // XXX The OBJ_IS_NOT_GLOBAL here is not really right. In
     // fact, this code is depending on the fact that the
     // global object will not have been collected, and
     // therefore this NativeInterface2JSObject will not end up
     // creating a new XPCNativeScriptableShared.
     nsresult rv;
     if(!XPCConvert::NativeInterface2JSObject(ccx, rval, nsnull, p, nsnull,
-                                             iface, cache, scope, PR_TRUE,
+                                             iface, scope, PR_TRUE,
                                              OBJ_IS_NOT_GLOBAL, &rv))
     {
         // I can't tell if NativeInterface2JSObject throws JS exceptions
         // or not.  This is a sloppy stab at the right semantics; the
         // method really ought to be fixed to behave consistently.
         if(!JS_IsExceptionPending(ccx))
             xpc_qsThrow(ccx, NS_FAILED(rv) ? rv : NS_ERROR_UNEXPECTED);
         return JS_FALSE;
--- a/js/src/xpconnect/src/xpcquickstubs.h
+++ b/js/src/xpconnect/src/xpcquickstubs.h
@@ -389,33 +389,20 @@ xpc_qsUnwrapArgImpl(JSContext *cx, jsval
 template <class T>
 inline nsresult
 xpc_qsUnwrapArg(JSContext *cx, jsval v, T **ppArg)
 {
     return xpc_qsUnwrapArgImpl(cx, v, NS_GET_TEMPLATE_IID(T),
                                reinterpret_cast<void **>(ppArg));
 }
 
-inline nsWrapperCache*
-xpc_qsGetWrapperCache(nsWrapperCache *cache)
-{
-    return cache;
-}
-
-inline nsWrapperCache*
-xpc_qsGetWrapperCache(void *p)
-{
-    return nsnull;
-}
-
 /** Convert an XPCOM pointer to jsval. Return JS_TRUE on success. */
 JSBool
 xpc_qsXPCOMObjectToJsval(XPCCallContext &ccx,
                          nsISupports *p,
-                         nsWrapperCache *cache,
                          XPCNativeInterface *iface,
                          jsval *rval);
 
 /**
  * Convert a variant to jsval. Return JS_TRUE on success.
  *
  * @a paramNum is used in error messages. XPConnect treats the return
  * value as a parameter in this regard.
@@ -435,22 +422,16 @@ xpc_qsVariantToJsval(XPCCallContext &ccx
  */
 JSBool
 xpc_qsReadOnlySetter(JSContext *cx, JSObject *obj, jsval id, jsval *vp);
 
 #ifdef DEBUG
 void
 xpc_qsAssertContextOK(JSContext *cx);
 
-inline PRBool
-xpc_qsSameResult(nsISupports *result1, nsISupports *result2)
-{
-    return SameCOMIdentity(result1, result2);
-}
-
 #define XPC_QS_ASSERT_CONTEXT_OK(cx) xpc_qsAssertContextOK(cx)
 #else
 #define XPC_QS_ASSERT_CONTEXT_OK(cx) ((void) 0)
 #endif
 
 #define XPC_QS_DEFINE_XPCNATIVEINTERFACE_GETTER(_iface, _iface_cache)         \
 inline XPCNativeInterface*                                                    \
 _iface##_Interface(XPCCallContext& ccx)                                       \
--- a/js/src/xpconnect/src/xpcwrappedjsclass.cpp
+++ b/js/src/xpconnect/src/xpcwrappedjsclass.cpp
@@ -1341,17 +1341,17 @@ nsXPCWrappedJSClass::CallMethod(nsXPCWra
                                 goto pre_call_clean_up;
                             }
                             if(newThis)
                             {
                                 jsval v;
                                 JSBool ok =
                                   XPCConvert::NativeInterface2JSObject(ccx,
                                         &v, nsnull, newThis, newWrapperIID,
-                                        nsnull, nsnull, obj, PR_FALSE, PR_FALSE,
+                                        nsnull, obj, PR_FALSE, PR_FALSE,
                                         nsnull);
                                 if(newWrapperIID)
                                     nsMemory::Free(newWrapperIID);
                                 if(!ok)
                                 {
                                     goto pre_call_clean_up;
                                 }
                                 thisObj = JSVAL_TO_OBJECT(v);