Fix for crash when assigning document.body

David Faure dfaure at klaralvdalens-datakonsult.se
Sat Oct 4 00:05:03 CEST 2003


On Friday 03 October 2003 22:37, Maciej Stachowiak wrote:
> 
> This patch fixes two problems that led to a crash on this HTML:
> 
> <html>
> <body>
> <script>document.body = new Object</script>
> </body>
> </html>
> 
> First of all, setting a document body to null at the C++ level should 
> be ignored, instead of removing the body, because that's what happens 
> when the JavaScript bindings can't convert the argument to a node. 

Mozilla handles this a little bit better though, it throws out an exception
(HIERARCHY_REQUEST_ERR).

> Second, the HTML parser needs to keep the "current" node ref'd, since 
> script execution can remove arbitrary nodes from the document while 
> parsing.

This looks good.

-- 
David Faure -- faure at kde.org, dfaure at klaralvdalens-datakonsult.se
Qt/KDE/KOffice developer
Klarälvdalens Datakonsult AB, Platform-independent software solutions


More information about the Khtml-devel mailing list