fix for <rdar://problem/
4061979> crash in DOM::ElementImpl::setAttribute at www.nitto-kohki.co.jp
* khtml/html/html_imageimpl.cpp: (HTMLImageLoader::updateFromElement): added a nil check for the document
* khtml/xml/dom_nodeimpl.h: (DOM::NodeImpl::inDocument): added check for document in case the document has been destroyed before the node has been removed. A lot of code already assumes that if inDocument returns true, a document exists.
* layout-tests/fast/events/onload-re-entry.html: removed alert.
* layout-tests/fast/events/onload-re-entry-expected.txt: updated.
* layout-tests/fast/dom/attr_dead_doc-expected.txt: Added.
* layout-tests/fast/dom/attr_dead_doc.html: Added.
* layout-tests/fast/dom/resources/apple.gif: Added.
* layout-tests/fast/dom/resources/mozilla.gif: Added.
* layout-tests/fast/dom/resources/top.html: Added.
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@9162
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
--- /dev/null
+layer at (0,0) size 800x600
+ RenderCanvas at (0,0) size 800x600
+layer at (0,0) size 800x600
+ RenderBlock {HTML} at (0,0) size 800x600
+ RenderBody {BODY} at (8,8) size 784x584
+ RenderPartObject {IFRAME} at (0,0) size 300x150
+ layer at (0,0) size 285x150
+ RenderCanvas at (0,0) size 285x150
+ layer at (0,0) size 285x8
+ RenderBlock {HTML} at (0,0) size 285x8
+ RenderBody {BODY} at (8,8) size 269x0
+ RenderText {TEXT} at (0,0) size 0x0
+ RenderText {TEXT} at (0,0) size 0x0
+ RenderText {TEXT} at (0,0) size 0x0
document.write("<p>" + x + "</p>");
}
</script>
-<body onload="alert('child'); write_stuff()">
+<body onload="write_stuff()">
</body>
+2005-05-11 Adele Peterson <adele@apple.com>
+
+ Reviewed by Darin.
+
+ fix for <rdar://problem/4061979> crash in DOM::ElementImpl::setAttribute at www.nitto-kohki.co.jp
+
+ * khtml/html/html_imageimpl.cpp: (HTMLImageLoader::updateFromElement): added a nil check for the document
+ * khtml/xml/dom_nodeimpl.h: (DOM::NodeImpl::inDocument): added check for document in case the document has been destroyed before the node has been removed. A lot of code already assumes that if inDocument returns true, a document exists.
+
+ * layout-tests/fast/events/onload-re-entry.html: removed alert.
+ * layout-tests/fast/events/onload-re-entry-expected.txt: updated.
+ * layout-tests/fast/dom/attr_dead_doc-expected.txt: Added.
+ * layout-tests/fast/dom/attr_dead_doc.html: Added.
+ * layout-tests/fast/dom/resources/apple.gif: Added.
+ * layout-tests/fast/dom/resources/mozilla.gif: Added.
+ * layout-tests/fast/dom/resources/top.html: Added.
+
2005-05-10 Maciej Stachowiak <mjs@apple.com>
Reviewed by Kevin.
{
// If we're not making renderers for the page, then don't load images. We don't want to slow
// down the raw HTML parsing case by loading images we don't intend to display.
- if (!element()->getDocument()->renderer())
+ DocumentImpl* document = element()->getDocument();
+ if (!document || !document->renderer())
return;
AtomicString attr;
bool changed() const { return m_changed; }
bool hasChangedChild() const { return m_hasChangedChild; }
bool isLink() const { return m_isLink; }
- bool inDocument() const { return m_inDocument; }
+ // inDocument should also make sure a document exists in case the document has been destroyed before the node is removed from the document.
+ bool inDocument() const { return document->document() && m_inDocument; }
bool styleElement() const { return m_styleElement; }
bool implicitNode() const { return m_implicit; }
void setHasID(bool b=true) { m_hasId = b; }