[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677
mjs
mjs at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 07:59:35 UTC 2009
The following commit has been merged in the debian/unstable branch:
commit fd2f73b169af804def3b8705e7e4a3a2e5e5b848
Author: mjs <mjs at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Fri Oct 3 21:49:11 2003 +0000
Reviewed by Richard.
- fixed 3398420 - crash when creating a new document.body object in <body>
Also included David Faure's improvement to throw an exception.
* khtml/html/html_documentimpl.cpp:
(HTMLDocumentImpl::setBody): Don't remove the body when null is passed in,
as this means type error at the higher level, so throw an exception.
* khtml/html/htmlparser.cpp:
(KHTMLParser::KHTMLParser): Initialize current to 0.
(KHTMLParser::setCurrent): Ref new current and deref old; we need to
keep it ref'd because script execution could drop the current node on the
floor.
(KHTMLParser::reset): Use setCurrent.
(KHTMLParser::insertNode): Likewise.
(KHTMLParser::reopenResidualStyleTags): Likewise.
(KHTMLParser::popOneBlock): Likewise.
(KHTMLParser::finished): Likewise.
* khtml/html/htmlparser.h: Prototype setCurrent.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@5131 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog-2003-10-25 b/WebCore/ChangeLog-2003-10-25
index 29caf40..c04f80e 100644
--- a/WebCore/ChangeLog-2003-10-25
+++ b/WebCore/ChangeLog-2003-10-25
@@ -1,3 +1,26 @@
+2003-10-03 Maciej Stachowiak <mjs at apple.com>
+
+ Reviewed by Richard.
+
+ - fixed 3398420 - crash when creating a new document.body object in <body>
+
+ Also included David Faure's improvement to throw an exception.
+
+ * khtml/html/html_documentimpl.cpp:
+ (HTMLDocumentImpl::setBody): Don't remove the body when null is passed in,
+ as this means type error at the higher level, so throw an exception.
+ * khtml/html/htmlparser.cpp:
+ (KHTMLParser::KHTMLParser): Initialize current to 0.
+ (KHTMLParser::setCurrent): Ref new current and deref old; we need to
+ keep it ref'd because script execution could drop the current node on the
+ floor.
+ (KHTMLParser::reset): Use setCurrent.
+ (KHTMLParser::insertNode): Likewise.
+ (KHTMLParser::reopenResidualStyleTags): Likewise.
+ (KHTMLParser::popOneBlock): Likewise.
+ (KHTMLParser::finished): Likewise.
+ * khtml/html/htmlparser.h: Prototype setCurrent.
+
2003-10-03 Chris Blumenberg <cblu at apple.com>
Ran compress-tiffs on new cursor images.
diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index 29caf40..c04f80e 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,3 +1,26 @@
+2003-10-03 Maciej Stachowiak <mjs at apple.com>
+
+ Reviewed by Richard.
+
+ - fixed 3398420 - crash when creating a new document.body object in <body>
+
+ Also included David Faure's improvement to throw an exception.
+
+ * khtml/html/html_documentimpl.cpp:
+ (HTMLDocumentImpl::setBody): Don't remove the body when null is passed in,
+ as this means type error at the higher level, so throw an exception.
+ * khtml/html/htmlparser.cpp:
+ (KHTMLParser::KHTMLParser): Initialize current to 0.
+ (KHTMLParser::setCurrent): Ref new current and deref old; we need to
+ keep it ref'd because script execution could drop the current node on the
+ floor.
+ (KHTMLParser::reset): Use setCurrent.
+ (KHTMLParser::insertNode): Likewise.
+ (KHTMLParser::reopenResidualStyleTags): Likewise.
+ (KHTMLParser::popOneBlock): Likewise.
+ (KHTMLParser::finished): Likewise.
+ * khtml/html/htmlparser.h: Prototype setCurrent.
+
2003-10-03 Chris Blumenberg <cblu at apple.com>
Ran compress-tiffs on new cursor images.
diff --git a/WebCore/khtml/dom/html_document.cpp b/WebCore/khtml/dom/html_document.cpp
index 84dad15..c79eadb 100644
--- a/WebCore/khtml/dom/html_document.cpp
+++ b/WebCore/khtml/dom/html_document.cpp
@@ -33,6 +33,7 @@
#include "dom/html_form.h"
#include "html/html_imageimpl.h"
#include "html/html_formimpl.h"
+#include "dom/dom_exception.h"
using namespace DOM;
@@ -140,7 +141,10 @@ HTMLElement HTMLDocument::body() const
void HTMLDocument::setBody(const HTMLElement &_body)
{
if (!impl) return;
- ((HTMLDocumentImpl *)impl)->setBody(static_cast<HTMLElementImpl *>(_body.handle()));
+ int exceptioncode = 0;
+ ((HTMLDocumentImpl *)impl)->setBody(static_cast<HTMLElementImpl *>(_body.handle()), exceptioncode);
+ if ( exceptioncode )
+ throw DOMException( exceptioncode );
return;
}
diff --git a/WebCore/khtml/html/html_documentimpl.cpp b/WebCore/khtml/html/html_documentimpl.cpp
index 4fc7ea9..89b7860 100644
--- a/WebCore/khtml/html/html_documentimpl.cpp
+++ b/WebCore/khtml/html/html_documentimpl.cpp
@@ -73,6 +73,7 @@
#include "khtml_factory.h"
#include "rendering/render_object.h"
+#include "dom/dom_exception.h"
#include <dcopclient.h>
#include <kapplication.h>
@@ -239,14 +240,14 @@ HTMLElementImpl *HTMLDocumentImpl::body()
return static_cast<HTMLElementImpl *>(body);
}
-void HTMLDocumentImpl::setBody(HTMLElementImpl *_body)
+void HTMLDocumentImpl::setBody(HTMLElementImpl *_body, int &exceptioncode)
{
- int exceptioncode = 0;
HTMLElementImpl *b = body();
- if ( !_body && !b ) return;
- if ( !_body )
- documentElement()->removeChild( b, exceptioncode );
- else if ( !b )
+ if ( !_body ) {
+ exceptioncode = DOMException::HIERARCHY_REQUEST_ERR;
+ return;
+ }
+ if ( !b )
documentElement()->appendChild( _body, exceptioncode );
else
documentElement()->replaceChild( _body, b, exceptioncode );
diff --git a/WebCore/khtml/html/html_documentimpl.h b/WebCore/khtml/html/html_documentimpl.h
index 46f000a..74aa59b 100644
--- a/WebCore/khtml/html/html_documentimpl.h
+++ b/WebCore/khtml/html/html_documentimpl.h
@@ -66,7 +66,7 @@ public:
#endif
HTMLElementImpl *body();
- void setBody(HTMLElementImpl *_body);
+ void setBody(HTMLElementImpl *_body, int& exceptioncode);
virtual Tokenizer *createTokenizer();
diff --git a/WebCore/khtml/html/htmlparser.cpp b/WebCore/khtml/html/htmlparser.cpp
index 1d56eff..63927bd 100644
--- a/WebCore/khtml/html/htmlparser.cpp
+++ b/WebCore/khtml/html/htmlparser.cpp
@@ -111,7 +111,8 @@ public:
* element or ignore the tag.
*
*/
-KHTMLParser::KHTMLParser( KHTMLView *_parent, DocumentPtr *doc)
+KHTMLParser::KHTMLParser( KHTMLView *_parent, DocumentPtr *doc)
+ : current(0)
{
//kdDebug( 6035 ) << "parser constructor" << endl;
#if SPEED_DEBUG > 0
@@ -141,7 +142,7 @@ KHTMLParser::KHTMLParser( DOM::DocumentFragmentImpl *i, DocumentPtr *doc )
blockStack = 0;
reset();
- current = i;
+ setCurrent(i);
inBody = true;
}
@@ -161,7 +162,7 @@ KHTMLParser::~KHTMLParser()
void KHTMLParser::reset()
{
- current = document->document();
+ setCurrent(document->document());
freeBlock();
@@ -183,6 +184,15 @@ void KHTMLParser::reset()
discard_until = 0;
}
+void KHTMLParser::setCurrent(DOM::NodeImpl *newCurrent)
+{
+ if (newCurrent)
+ newCurrent->ref();
+ if (current)
+ current->deref();
+ current = newCurrent;
+}
+
void KHTMLParser::parseToken(Token *t)
{
if (t->id > 2*ID_CLOSE_TAG)
@@ -310,7 +320,7 @@ bool KHTMLParser::insertNode(NodeImpl *n, bool flat)
if (newNode == current)
popBlock(id);
else
- current = newNode;
+ setCurrent(newNode);
#if SPEED_DEBUG < 2
if(!n->attached() && HTMLWidget)
n->attach();
@@ -405,7 +415,7 @@ bool KHTMLParser::insertNode(NodeImpl *n, bool flat)
DOM::NodeImpl *newNode = head->addChild(n);
if ( newNode ) {
pushBlock(id, tagPriority[id]);
- current = newNode;
+ setCurrent(newNode);
#if SPEED_DEBUG < 2
if(!n->attached() && HTMLWidget)
n->attach();
@@ -619,7 +629,7 @@ bool KHTMLParser::insertNode(NodeImpl *n, bool flat)
!flat && endTag[id] != DOM::FORBIDDEN)
{
pushBlock(id, tagPriority[id]);
- current = n;
+ setCurrent(n);
inStrayTableContent = true;
blockStack->strayTableContent = true;
}
@@ -1396,7 +1406,7 @@ void KHTMLParser::reopenResidualStyleTags(HTMLStackElem* elem, DOM::NodeImpl* ma
malformedTableParent = 0;
// Update |current| manually to point to the new node.
- current = newNode;
+ setCurrent(newNode);
// Advance to the next tag that needs to be reopened.
HTMLStackElem* next = elem->next;
@@ -1529,7 +1539,7 @@ void KHTMLParser::popOneBlock(bool delBlock)
removeForbidden(Elem->id, forbiddenTag);
blockStack = Elem->next;
- current = Elem->node;
+ setCurrent(Elem->node);
if (Elem->strayTableContent)
inStrayTableContent = false;
@@ -1614,5 +1624,5 @@ void KHTMLParser::finished()
{
// This ensures that "current" is not left pointing to a node when the document is destroyed.
freeBlock();
- current = 0;
+ setCurrent(0);
}
diff --git a/WebCore/khtml/html/htmlparser.h b/WebCore/khtml/html/htmlparser.h
index 76dec7a..0efc703 100644
--- a/WebCore/khtml/html/htmlparser.h
+++ b/WebCore/khtml/html/htmlparser.h
@@ -97,6 +97,7 @@ public:
DOM::DocumentPtr *docPtr() const { return document; }
protected:
+ void setCurrent(DOM::NodeImpl *newCurrent);
KHTMLView *HTMLWidget;
DOM::DocumentPtr *document;
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list