diff --git a/content/base/src/nsDocument.cpp b/content/base/src/nsDocument.cpp index acd8f89d66d..d9babf897b7 100644 --- a/content/base/src/nsDocument.cpp +++ b/content/base/src/nsDocument.cpp @@ -73,6 +73,7 @@ #include "nsGUIEvent.h" #include "nsAsyncDOMEvent.h" +#include "nsIDOMNodeFilter.h" #include "nsIDOMStyleSheet.h" #include "nsDOMAttribute.h" @@ -5024,11 +5025,15 @@ NS_IMETHODIMP nsDocument::CreateNodeIterator(nsIDOMNode *aRoot, PRUint32 aWhatToShow, nsIDOMNodeFilter *aFilter, - bool aEntityReferenceExpansion, + PRUint8 aOptionalArgc, nsIDOMNodeIterator **_retval) { *_retval = nsnull; + if (!aOptionalArgc) { + aWhatToShow = nsIDOMNodeFilter::SHOW_ALL; + } + if (!aRoot) return NS_ERROR_DOM_NOT_SUPPORTED_ERR; @@ -5042,24 +5047,27 @@ nsDocument::CreateNodeIterator(nsIDOMNode *aRoot, nsNodeIterator *iterator = new nsNodeIterator(root, aWhatToShow, - aFilter, - aEntityReferenceExpansion); + aFilter); NS_ENSURE_TRUE(iterator, NS_ERROR_OUT_OF_MEMORY); NS_ADDREF(*_retval = iterator); - return NS_OK; + return NS_OK; } NS_IMETHODIMP nsDocument::CreateTreeWalker(nsIDOMNode *aRoot, PRUint32 aWhatToShow, nsIDOMNodeFilter *aFilter, - bool aEntityReferenceExpansion, + PRUint8 aOptionalArgc, nsIDOMTreeWalker **_retval) { *_retval = nsnull; + if (!aOptionalArgc) { + aWhatToShow = nsIDOMNodeFilter::SHOW_ALL; + } + if (!aRoot) return NS_ERROR_DOM_NOT_SUPPORTED_ERR; @@ -5073,8 +5081,7 @@ nsDocument::CreateTreeWalker(nsIDOMNode *aRoot, nsTreeWalker* walker = new nsTreeWalker(root, aWhatToShow, - aFilter, - aEntityReferenceExpansion); + aFilter); NS_ENSURE_TRUE(walker, NS_ERROR_OUT_OF_MEMORY); NS_ADDREF(*_retval = walker); diff --git a/content/base/src/nsNodeIterator.cpp b/content/base/src/nsNodeIterator.cpp index 68ed0384dba..40191cf530d 100644 --- a/content/base/src/nsNodeIterator.cpp +++ b/content/base/src/nsNodeIterator.cpp @@ -170,9 +170,8 @@ void nsNodeIterator::NodePointer::MoveBackward(nsINode *aParent, nsINode *aNode) nsNodeIterator::nsNodeIterator(nsINode *aRoot, PRUint32 aWhatToShow, - nsIDOMNodeFilter *aFilter, - bool aExpandEntityReferences) : - nsTraversal(aRoot, aWhatToShow, aFilter, aExpandEntityReferences), + nsIDOMNodeFilter *aFilter) : + nsTraversal(aRoot, aWhatToShow, aFilter), mDetached(false), mPointer(mRoot, true) { @@ -247,7 +246,7 @@ NS_IMETHODIMP nsNodeIterator::GetFilter(nsIDOMNodeFilter **aFilter) /* readonly attribute boolean expandEntityReferences; */ NS_IMETHODIMP nsNodeIterator::GetExpandEntityReferences(bool *aExpandEntityReferences) { - *aExpandEntityReferences = mExpandEntityReferences; + *aExpandEntityReferences = false; return NS_OK; } diff --git a/content/base/src/nsNodeIterator.h b/content/base/src/nsNodeIterator.h index 9447f0ce9b0..0aeda841df8 100644 --- a/content/base/src/nsNodeIterator.h +++ b/content/base/src/nsNodeIterator.h @@ -63,8 +63,7 @@ public: nsNodeIterator(nsINode *aRoot, PRUint32 aWhatToShow, - nsIDOMNodeFilter *aFilter, - bool aExpandEntityReferences); + nsIDOMNodeFilter *aFilter); virtual ~nsNodeIterator(); NS_DECL_NSIMUTATIONOBSERVER_CONTENTREMOVED diff --git a/content/base/src/nsTraversal.cpp b/content/base/src/nsTraversal.cpp index df9f2ce6128..83f0905fcc6 100644 --- a/content/base/src/nsTraversal.cpp +++ b/content/base/src/nsTraversal.cpp @@ -49,12 +49,10 @@ nsTraversal::nsTraversal(nsINode *aRoot, PRUint32 aWhatToShow, - nsIDOMNodeFilter *aFilter, - bool aExpandEntityReferences) : + nsIDOMNodeFilter *aFilter) : mRoot(aRoot), mWhatToShow(aWhatToShow), mFilter(aFilter), - mExpandEntityReferences(aExpandEntityReferences), mInAcceptNode(false) { NS_ASSERTION(aRoot, "invalid root in call to nsTraversal constructor"); diff --git a/content/base/src/nsTraversal.h b/content/base/src/nsTraversal.h index 9368941e499..77968bffa7b 100644 --- a/content/base/src/nsTraversal.h +++ b/content/base/src/nsTraversal.h @@ -54,15 +54,13 @@ class nsTraversal public: nsTraversal(nsINode *aRoot, PRUint32 aWhatToShow, - nsIDOMNodeFilter *aFilter, - bool aExpandEntityReferences); + nsIDOMNodeFilter *aFilter); virtual ~nsTraversal(); protected: nsCOMPtr mRoot; PRUint32 mWhatToShow; nsCOMPtr mFilter; - bool mExpandEntityReferences; bool mInAcceptNode; /* diff --git a/content/base/src/nsTreeWalker.cpp b/content/base/src/nsTreeWalker.cpp index d7c4527c1f3..9abd2189455 100644 --- a/content/base/src/nsTreeWalker.cpp +++ b/content/base/src/nsTreeWalker.cpp @@ -58,9 +58,8 @@ nsTreeWalker::nsTreeWalker(nsINode *aRoot, PRUint32 aWhatToShow, - nsIDOMNodeFilter *aFilter, - bool aExpandEntityReferences) : - nsTraversal(aRoot, aWhatToShow, aFilter, aExpandEntityReferences), + nsIDOMNodeFilter *aFilter) : + nsTraversal(aRoot, aWhatToShow, aFilter), mCurrentNode(aRoot) { } @@ -127,7 +126,7 @@ NS_IMETHODIMP nsTreeWalker::GetFilter(nsIDOMNodeFilter * *aFilter) NS_IMETHODIMP nsTreeWalker::GetExpandEntityReferences(bool *aExpandEntityReferences) { - *aExpandEntityReferences = mExpandEntityReferences; + *aExpandEntityReferences = false; return NS_OK; } diff --git a/content/base/src/nsTreeWalker.h b/content/base/src/nsTreeWalker.h index bafd07028cb..c9ceec5f011 100644 --- a/content/base/src/nsTreeWalker.h +++ b/content/base/src/nsTreeWalker.h @@ -63,8 +63,7 @@ public: nsTreeWalker(nsINode *aRoot, PRUint32 aWhatToShow, - nsIDOMNodeFilter *aFilter, - bool aExpandEntityReferences); + nsIDOMNodeFilter *aFilter); virtual ~nsTreeWalker(); NS_DECL_CYCLE_COLLECTION_CLASS(nsTreeWalker) diff --git a/content/base/test/Makefile.in b/content/base/test/Makefile.in index afd5c806f78..919256a3a79 100644 --- a/content/base/test/Makefile.in +++ b/content/base/test/Makefile.in @@ -542,6 +542,7 @@ _TEST_FILES2 = \ test_bug708620.html \ file_bug708620.html \ file_bug708620-2.html \ + test_bug698384.html \ $(NULL) _CHROME_FILES = \ diff --git a/content/base/test/test_bug698384.html b/content/base/test/test_bug698384.html new file mode 100644 index 00000000000..f55a5f7f988 --- /dev/null +++ b/content/base/test/test_bug698384.html @@ -0,0 +1,62 @@ + + + + + Test for Bug 698384 + + + + + + + Mozilla Bug 698384 +

+ +
+      
+    
+ + diff --git a/dom/interfaces/core/nsIDOMDocument.idl b/dom/interfaces/core/nsIDOMDocument.idl index 947655c1233..6206158fdfd 100644 --- a/dom/interfaces/core/nsIDOMDocument.idl +++ b/dom/interfaces/core/nsIDOMDocument.idl @@ -66,7 +66,7 @@ interface nsIDOMLocation; * http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html */ -[scriptable, uuid(5c3bff4d-ae7f-4c93-948c-519589672c30)] +[scriptable, uuid(d7cdd08e-1bfd-4bc3-9742-d66586781ee2)] interface nsIDOMDocument : nsIDOMNode { readonly attribute nsIDOMDocumentType doctype; @@ -118,16 +118,14 @@ interface nsIDOMDocument : nsIDOMNode */ nsIDOMRange createRange(); - nsIDOMNodeIterator createNodeIterator(in nsIDOMNode root, - in unsigned long whatToShow, - in nsIDOMNodeFilter filter, - in boolean entityReferenceExpansion) - raises(DOMException); - nsIDOMTreeWalker createTreeWalker(in nsIDOMNode root, - in unsigned long whatToShow, - in nsIDOMNodeFilter filter, - in boolean entityReferenceExpansion) - raises(DOMException); + [optional_argc] nsIDOMNodeIterator createNodeIterator(in nsIDOMNode root, + [optional] in unsigned long whatToShow, + [optional] in nsIDOMNodeFilter filter) + raises(DOMException); + [optional_argc] nsIDOMTreeWalker createTreeWalker(in nsIDOMNode root, + [optional] in unsigned long whatToShow, + [optional] in nsIDOMNodeFilter filter) + raises(DOMException); nsIDOMEvent createEvent(in DOMString eventType) raises(DOMException); diff --git a/dom/interfaces/traversal/nsIDOMDocumentTraversal.idl b/dom/interfaces/traversal/nsIDOMDocumentTraversal.idl deleted file mode 100644 index ddb7ce3af2c..00000000000 --- a/dom/interfaces/traversal/nsIDOMDocumentTraversal.idl +++ /dev/null @@ -1,61 +0,0 @@ -/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- - * - * ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is this file as it was released on May 1 2001. - * - * The Initial Developer of the Original Code is - * Jonas Sicking. - * Portions created by the Initial Developer are Copyright (C) 2001 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * Jonas Sicking (Original Author) - * - * Alternatively, the contents of this file may be used under the terms of - * either of the GNU General Public License Version 2 or later (the "GPL"), - * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - * in which case the provisions of the GPL or the LGPL are applicable instead - * of those above. If you wish to allow use of your version of this file only - * under the terms of either the GPL or the LGPL, and not to allow others to - * use your version of this file under the terms of the MPL, indicate your - * decision by deleting the provisions above and replace them with the notice - * and other provisions required by the GPL or the LGPL. If you do not delete - * 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 ***** */ - -#include "domstubs.idl" - -interface nsIDOMNodeIterator; -interface nsIDOMNodeFilter; -interface nsIDOMTreeWalker; - - -[scriptable, uuid(13f236c0-47f8-11d5-b6a3-009027446e84)] -// Introduced in DOM Level 2: -interface nsIDOMDocumentTraversal : nsISupports -{ - nsIDOMNodeIterator createNodeIterator(in nsIDOMNode root, - in unsigned long whatToShow, - in nsIDOMNodeFilter filter, - in boolean entityReferenceExpansion) - raises(DOMException); - nsIDOMTreeWalker createTreeWalker(in nsIDOMNode root, - in unsigned long whatToShow, - in nsIDOMNodeFilter filter, - in boolean entityReferenceExpansion) - raises(DOMException); -}; diff --git a/dom/interfaces/traversal/nsIDOMNodeIterator.idl b/dom/interfaces/traversal/nsIDOMNodeIterator.idl index 3cf09366038..12aa9e4c6dc 100644 --- a/dom/interfaces/traversal/nsIDOMNodeIterator.idl +++ b/dom/interfaces/traversal/nsIDOMNodeIterator.idl @@ -44,7 +44,7 @@ interface nsIDOMNodeFilter; [scriptable, uuid(5af83f50-c8d5-4824-be29-1aa9d640bacb)] -// Introduced in DOM Level 2: +// Introduced in DOM Level 2, updated to DOM Level 4: interface nsIDOMNodeIterator : nsISupports { readonly attribute nsIDOMNode root; diff --git a/editor/libeditor/text/nsTextEditRules.cpp b/editor/libeditor/text/nsTextEditRules.cpp index 9180ad2a60a..bce62281e84 100644 --- a/editor/libeditor/text/nsTextEditRules.cpp +++ b/editor/libeditor/text/nsTextEditRules.cpp @@ -486,7 +486,7 @@ GetTextNode(nsISelection *selection, nsEditor *editor) { // if node is null, return it to indicate there's no text NS_ENSURE_TRUE(node, nsnull); // This should be the root node, walk the tree looking for text nodes - nsNodeIterator iter(node, nsIDOMNodeFilter::SHOW_TEXT, nsnull, true); + nsNodeIterator iter(node, nsIDOMNodeFilter::SHOW_TEXT, nsnull); while (!editor->IsTextNode(selNode)) { if (NS_FAILED(res = iter.NextNode(getter_AddRefs(selNode))) || !selNode) { return nsnull;