diff --git a/htmlparser/tests/logparse/43678.html b/htmlparser/tests/logparse/43678.html new file mode 100644 index 000000000000..5ebed96c3be8 --- /dev/null +++ b/htmlparser/tests/logparse/43678.html @@ -0,0 +1,18 @@ + + + + + + +

+ Inside P but before TABLE + + + + +
cell
+ After TABLE but inside P + + + + diff --git a/htmlparser/tests/logparse/53112.html b/htmlparser/tests/logparse/53112.html new file mode 100644 index 000000000000..a5a77e6bab1b --- /dev/null +++ b/htmlparser/tests/logparse/53112.html @@ -0,0 +1,13 @@ + + + + Mozilla: Stylesheet linking without "type" attribute + + + + +

I should be green.

+ + diff --git a/htmlparser/tests/logparse/58809.html b/htmlparser/tests/logparse/58809.html new file mode 100644 index 000000000000..1ee5225a409e --- /dev/null +++ b/htmlparser/tests/logparse/58809.html @@ -0,0 +1,12 @@ + + + 'A'
+ 'A'
+ 'b'
+ 'c'
+ 'd'
+ 'e'
+ 'f'
+ + + diff --git a/htmlparser/tests/logparse/65467.html b/htmlparser/tests/logparse/65467.html new file mode 100644 index 000000000000..04ea13953610 --- /dev/null +++ b/htmlparser/tests/logparse/65467.html @@ -0,0 +1,18 @@ + + + +Bug: 65467 + + + + +
+
The center tag's border "should" go around this text.
+ + + + + + diff --git a/htmlparser/tests/logparse/67569.html b/htmlparser/tests/logparse/67569.html new file mode 100644 index 000000000000..fab5bc74b053 --- /dev/null +++ b/htmlparser/tests/logparse/67569.html @@ -0,0 +1,14 @@ + + +

+ + + + +
+ First line +

+ Second line +
+ + diff --git a/htmlparser/tests/logparse/67874.html b/htmlparser/tests/logparse/67874.html new file mode 100644 index 000000000000..83348defdc4d --- /dev/null +++ b/htmlparser/tests/logparse/67874.html @@ -0,0 +1,4 @@ + + Did you know that your Browser is buggy: it can't parse +comments correctly. --> + diff --git a/htmlparser/tests/logparse/69576.html b/htmlparser/tests/logparse/69576.html new file mode 100644 index 000000000000..8108370fc7be --- /dev/null +++ b/htmlparser/tests/logparse/69576.html @@ -0,0 +1,33 @@ + + + +Row,Col + + + + + +
+ 1,1 + + 1,2 + + + + + + + + + + +
+ 1,1,1 + + 1,1,2 +
+ 1,2,2 +
+
+ + diff --git a/htmlparser/tests/logparse/70148.html b/htmlparser/tests/logparse/70148.html new file mode 100644 index 000000000000..f76390c0a8c0 --- /dev/null +++ b/htmlparser/tests/logparse/70148.html @@ -0,0 +1,10 @@ + + + + testcase + + + All the stuff after + &lang got munched. + + diff --git a/htmlparser/tests/logparse/77352.html b/htmlparser/tests/logparse/77352.html new file mode 100644 index 000000000000..8816a629f734 --- /dev/null +++ b/htmlparser/tests/logparse/77352.html @@ -0,0 +1,12 @@ + + + + size +2 +

+ PPPP +

+ H6blah +
+ size +2 + + diff --git a/htmlparser/tests/logparse/78444.html b/htmlparser/tests/logparse/78444.html new file mode 100644 index 000000000000..9c1388243940 --- /dev/null +++ b/htmlparser/tests/logparse/78444.html @@ -0,0 +1,15 @@ + + + +coldplay + + + + + + + +<body bgcolor="#FFFFFF"> + +</body> + diff --git a/htmlparser/tests/logparse/78848.html b/htmlparser/tests/logparse/78848.html new file mode 100644 index 000000000000..efcb487946de --- /dev/null +++ b/htmlparser/tests/logparse/78848.html @@ -0,0 +1,117 @@ + + +Testcase that cause hangup + + + + + + + + +
+ + + + + + +
+ + + + + +
+ + + + + + +
+ + + + +
    + +
+ + + + +
    + +
+ + + + + +
    + +
+ + + + +
    + +
+ + + + + + + +On this site : + +
    + +
+
+ + +
+ +
+ +
+ +
+ + + \ No newline at end of file diff --git a/htmlparser/tests/logparse/82971.cgi b/htmlparser/tests/logparse/82971.cgi new file mode 100644 index 000000000000..06822474179d --- /dev/null +++ b/htmlparser/tests/logparse/82971.cgi @@ -0,0 +1,287 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * 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 Jonas Sicking are Copyright (C) 2001 + * Jonas Sicking. All Rights Reserved. + * + * Contributor(s): + * Jonas Sicking (Original Author) + * + * Alternatively, the contents of this file may be used under the + * terms of the GNU General Public License Version 2 or later (the + * "GPL"), in which case the provisions of the GPL are applicable + * instead of those above. If you wish to allow use of your + * version of this file only under the terms of the GPL and not to + * allow others to use your version of this file under the MPL, + * indicate your decision by deleting the provisions above and + * replace them with the notice and other provisions required by + * the GPL. If you do not delete the provisions above, a recipient + * may use your version of this file under either the MPL or the + * GPL. + * + */ + +/* + * nsTreeWalker.cpp: Implementation of the nsIDOMTreeWalker object. + */ + +#include "nsTreeWalker.h" + +#include "nsIDOMNode.h" +#include "nsIDOMNodeList.h" +#include "nsDOMError.h" + +#include "nsContentUtils.h" +#include "nsMemory.h" + +/* + * Factories, constructors and destructors + */ + +nsresult +NS_NewTreeWalker(nsIDOMNode *root, + PRUint32 whatToShow, + nsIDOMNodeFilter *filter, + PRBool expandEntityReferences, + nsIDOMTreeWalker **aInstancePtrResult) { + NS_ENSURE_ARG_POINTER(aInstancePtrResult); + + NS_ENSURE_TRUE(root, NS_ERROR_DOM_NOT_SUPPORTED_ERR); + + nsTreeWalker* walker = new nsTreeWalker(root, + whatToShow, + filter, + expandEntityReferences); + NS_ENSURE_TRUE(walker, NS_ERROR_OUT_OF_MEMORY); + + return walker->QueryInterface(NS_GET_IID(nsIDOMTreeWalker), + (void**) aInstancePtrResult); +} + +nsTreeWalker::nsTreeWalker(nsIDOMNode *root, + PRUint32 whatToShow, + nsIDOMNodeFilter *filter, + PRBool expandEntityReferences) : + mRoot(root), + mWhatToShow(whatToShow), + mFilter(filter), + mExpandEntityReferences(expandEntityReferences), + mCurrentNode(root) +{ + NS_INIT_ISUPPORTS(); + /* member initializers and constructor code */ + + NS_ASSERTION(root, "invalid root in call to treeWalker constructor"); +} + +nsTreeWalker::~nsTreeWalker() +{ + /* destructor code */ +} + +/* + * nsISupports stuff + */ + +// XPConnect interface list for nsDOMDocumentType +NS_CLASSINFO_MAP_BEGIN(TreeWalker) + NS_CLASSINFO_MAP_ENTRY(nsIDOMTreeWalker) +NS_CLASSINFO_MAP_END + +// QueryInterface implementation for nsDOMDocumentType +NS_INTERFACE_MAP_BEGIN(nsTreeWalker) + NS_INTERFACE_MAP_ENTRY(nsIDOMTreeWalker) + NS_INTERFACE_MAP_ENTRY(nsISupports) + NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(TreeWalker) +NS_INTERFACE_MAP_END + +NS_IMPL_ADDREF(nsTreeWalker) +NS_IMPL_RELEASE(nsTreeWalker) + +/* + * nsIDOMTreeWalker Getters/Setters + */ + +/* readonly attribute nsIDOMNode root; */ +NS_IMETHODIMP nsTreeWalker::GetRoot(nsIDOMNode * *aRoot) +{ + NS_ENSURE_ARG_POINTER(aRoot); + *aRoot = mRoot; + NS_IF_ADDREF(*aRoot); + return NS_OK; +} + +/* readonly attribute unsigned long whatToShow; */ +NS_IMETHODIMP nsTreeWalker::GetWhatToShow(PRUint32 *aWhatToShow) +{ + *aWhatToShow = mWhatToShow; + return NS_OK; +} + +/* readonly attribute nsIDOMNodeFilter filter; */ +NS_IMETHODIMP nsTreeWalker::GetFilter(nsIDOMNodeFilter * *aFilter) +{ + NS_ENSURE_ARG_POINTER(aFilter); + *aFilter = mFilter; + NS_IF_ADDREF(*aFilter); + return NS_OK; +} + +/* readonly attribute boolean expandEntityReferences; */ +NS_IMETHODIMP nsTreeWalker::GetExpandEntityReferences(PRBool *aExpandEntityReferences) +{ + *aExpandEntityReferences = mExpandEntityReferences; + return NS_OK; +} + +/* attribute nsIDOMNode currentNode; */ +NS_IMETHODIMP nsTreeWalker::GetCurrentNode(nsIDOMNode * *aCurrentNode) +{ + NS_ENSURE_ARG_POINTER(aCurrentNode); + *aCurrentNode = mCurrentNode; + NS_IF_ADDREF(*aCurrentNode); + return NS_OK; +} +NS_IMETHODIMP nsTreeWalker::SetCurrentNode(nsIDOMNode * aCurrentNode) +{ + if (!aCurrentNode) + return NS_ERROR_DOM_NOT_SUPPORTED_ERR; + mCurrentNode = aCurrentNode; + return NS_OK; +} + +/* + * nsIDOMTreeWalker functions + */ + +/* nsIDOMNode parentNode (); */ +NS_IMETHODIMP nsTreeWalker::ParentNode(nsIDOMNode **_retval) +{ + NS_ENSURE_ARG_POINTER(_retval); + + nsCOMPtr node(mCurrentNode); + nsresult rv; + + while (node && node != mRoot) { + nsCOMPtr tmp(node); + rv = tmp->GetParentNode(getter_AddRefs(node)); + NS_ENSURE_SUCCESS(rv, rv); + + if (node) { + PRInt16 filtered; + rv = TestNode(node, &filtered); + NS_ENSURE_SUCCESS(rv, rv); + if (filtered == nsIDOMNodeFilter::FILTER_ACCEPT) { + mCurrentNode = node; + *_retval = node; + NS_ADDREF(*_retval); + + return NS_OK; + } + } + } + + *_retval = nsnull; + return NS_OK; +} + +/* nsIDOMNode firstChild (); */ +NS_IMETHODIMP nsTreeWalker::FirstChild(nsIDOMNode **_retval) +{ + NS_ENSURE_ARG_POINTER(_retval); + return FirstChildOf(mCurrentNode, PR_FALSE, _retval); +} + +/* nsIDOMNode lastChild (); */ +NS_IMETHODIMP nsTreeWalker::LastChild(nsIDOMNode **_retval) +{ + NS_ENSURE_ARG_POINTER(_retval); + return FirstChildOf(mCurrentNode, PR_TRUE, _retval); +} + +/* nsIDOMNode previousSibling (); */ +NS_IMETHODIMP nsTreeWalker::PreviousSibling(nsIDOMNode **_retval) +{ + NS_ENSURE_ARG_POINTER(_retval); + return NextSiblingOf(mCurrentNode, PR_TRUE, _retval); +} + +/* nsIDOMNode nextSibling (); */ +NS_IMETHODIMP nsTreeWalker::NextSibling(nsIDOMNode **_retval) +{ + NS_ENSURE_ARG_POINTER(_retval); + return NextSiblingOf(mCurrentNode, PR_FALSE, _retval); +} + +/* nsIDOMNode previousNode (); */ +NS_IMETHODIMP nsTreeWalker::PreviousNode(nsIDOMNode **_retval) +{ + NS_ENSURE_ARG_POINTER(_retval); + return NextInDocumentOrderOf(mCurrentNode, PR_TRUE, _retval); +} + +/* nsIDOMNode nextNode (); */ +NS_IMETHODIMP nsTreeWalker::NextNode(nsIDOMNode **_retval) +{ + NS_ENSURE_ARG_POINTER(_retval); + return NextInDocumentOrderOf(mCurrentNode, PR_FALSE, _retval); +} + +/* + * nsTreeWalker helper functions + */ + +/* + * Tests if and how a node should be filtered. Uses mWhatToShow and + * mFilter to test the node. + * @param aNode Node to test + * @param _filtered Returned filtervalue. See nsIDOMNodeFilter.idl + */ +nsresult nsTreeWalker::TestNode(nsIDOMNode* aNode, PRInt16* _filtered) +{ + nsresult rv; + PRUint16 nodeType; + PRUint32 mask = 1; + + rv = aNode->GetNodeType(&nodeType); + NS_ENSURE_SUCCESS(rv, rv); + + if (nodeType <= 12 && !((mask << (nodeType-1)) & mWhatToShow)) { + *_filtered = nsIDOMNodeFilter::FILTER_SKIP; + + return NS_OK; + } + + if (mFilter) + return mFilter->AcceptNode(aNode, _filtered); + + *_filtered = nsIDOMNodeFilter::FILTER_ACCEPT; + return NS_OK; +} + +/* + * Finds the first child of aNode and returns it. If a child is + * found, mCurrentNode is set to that child. + * @param aNode Node to search for children. + * @param aReversed Reverses search to find the last child instead + * of first. + * @param _retval Returned node. Null if no child is found + * @returns Errorcode + */ +nsresult +nsTreeWalker::FirstChildOf(nsIDOMNode* aNode, + PRBool aReversed, +n diff --git a/htmlparser/tests/logparse/84000.html b/htmlparser/tests/logparse/84000.html new file mode 100644 index 000000000000..f2aa72515b93 --- /dev/null +++ b/htmlparser/tests/logparse/84000.html @@ -0,0 +1,12 @@ + + +IMG without attribute + + + + + +<img src="mozila.gif"> + + + diff --git a/htmlparser/tests/logparse/88746.html b/htmlparser/tests/logparse/88746.html new file mode 100644 index 000000000000..f66e99721075 --- /dev/null +++ b/htmlparser/tests/logparse/88746.html @@ -0,0 +1,16 @@ + + +Debian Planet + + + + + + + + + + + + diff --git a/htmlparser/tests/logparse/badscript.html b/htmlparser/tests/logparse/badscript.html index 709b45f77c9c..9e28da228e1d 100644 --- a/htmlparser/tests/logparse/badscript.html +++ b/htmlparser/tests/logparse/badscript.html @@ -7,6 +7,10 @@ document.write("hello there"); //--> + + + + + + diff --git a/parser/htmlparser/tests/logparse/badscript.html b/parser/htmlparser/tests/logparse/badscript.html index 709b45f77c9c..9e28da228e1d 100644 --- a/parser/htmlparser/tests/logparse/badscript.html +++ b/parser/htmlparser/tests/logparse/badscript.html @@ -7,6 +7,10 @@ document.write("hello there"); //--> +