From 950c43bc90689ee414052ec4584d3813a194a01b Mon Sep 17 00:00:00 2001 From: adele Date: Thu, 12 May 2005 01:16:01 +0000 Subject: [PATCH] Reviewed by Darin. fix for 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 --- .../fast/dom/attr_dead_doc-expected.txt | 14 ++++++++++++++ LayoutTests/fast/dom/attr_dead_doc.html | Bin 0 -> 1386 bytes LayoutTests/fast/dom/resources/apple.gif | Bin 0 -> 1476 bytes LayoutTests/fast/dom/resources/mozilla.gif | Bin 0 -> 2593 bytes LayoutTests/fast/dom/resources/top.html | Bin 0 -> 126 bytes LayoutTests/fast/events/onload-re-entry.html | 2 +- WebCore/ChangeLog-2005-08-23 | 17 +++++++++++++++++ WebCore/khtml/html/html_imageimpl.cpp | 3 ++- WebCore/khtml/xml/dom_nodeimpl.h | 3 ++- 9 files changed, 36 insertions(+), 3 deletions(-) create mode 100644 LayoutTests/fast/dom/attr_dead_doc-expected.txt create mode 100644 LayoutTests/fast/dom/attr_dead_doc.html create mode 100644 LayoutTests/fast/dom/resources/apple.gif create mode 100644 LayoutTests/fast/dom/resources/mozilla.gif create mode 100644 LayoutTests/fast/dom/resources/top.html diff --git a/LayoutTests/fast/dom/attr_dead_doc-expected.txt b/LayoutTests/fast/dom/attr_dead_doc-expected.txt new file mode 100644 index 000000000000..962978d0e525 --- /dev/null +++ b/LayoutTests/fast/dom/attr_dead_doc-expected.txt @@ -0,0 +1,14 @@ +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 diff --git a/LayoutTests/fast/dom/attr_dead_doc.html b/LayoutTests/fast/dom/attr_dead_doc.html new file mode 100644 index 0000000000000000000000000000000000000000..14b953f0871b54a3711155656e86c02683f20e27 GIT binary patch literal 1386 zcmb_cO;5s55S%l=qUi||Q}in6!HgR9&VAzKcwts%{6dQ@Ww!h+?!Mfm%tOjd?91DjXkDy% zpIO{%`jqF5;g%Q~Zi#Ek%4Wg8uoIrzRdCff&Rakhq4B&oB*l1RsEILGUpNG1*qz&* z(R_D!CDoP9UWn?rt6q9&|ird@U{r&yP$;qUoq~qh`)YR0$!NIk) zwd(5ZySuyf_4eiF=k4zA=jiF+;NkD^^4{Lx`T6-57Z=XX&-eHD$H&Ll*VnJFuhG%b z@bK{X`1s7s%m4rYA^8LW0018VEC2ui05kwV06+!*;3tk`X`bdGRF#0fa4ZTBu|UTW zB?2VFoCLsdAsCOwfCeB)3?dti0HCN5D2+g)K_LXDh0_5*kSrb#iJB8=Z{Ll}g@Qd~ z2D!*&GUyL72!R_D0tO}qPZJRi4iIN)Y!nL&1rQJpd3$|;8yglL9t8y$2?+=V0u(3< z0t1!{5*HkWI(vM6fC!$SqooN9zzV_|#2N|>3I+iv4*&ojfzg7x7S*8`q`tu0!o$VI z1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giAa zNu05dX)QP!5wRz|mfRt&)$l%jxp~`S^c>ecgtv6mKdD!OxEOZVoSMepi;H%mff*Eq zz`1hQsHG+}v&f|G2@3-S4i#50||=3lh%(|qqzzUbDJaXRV0Td+DR)u~ok z4UPSMWO#MBjVfrpA=GsKEqCRboATFnj5yA=7AJMau*BaY0fiNeb^S;F!B&dP&SD$~ GhyLF_x96Y$ literal 0 HcmV?d00001 diff --git a/LayoutTests/fast/dom/resources/top.html b/LayoutTests/fast/dom/resources/top.html new file mode 100644 index 0000000000000000000000000000000000000000..45dfa7f5f7db9d06ff78d0521a8b094c55cf6b60 GIT binary patch literal 126 zcmezOpTUN~gCT^$m%)d@j)4ovb7JskaAAmq@;reu?hFbH!3;qR&J4B;N({LS`3zMI onG88Vn8={VkPc+00mT&~02h}M*#H0l literal 0 HcmV?d00001 diff --git a/LayoutTests/fast/events/onload-re-entry.html b/LayoutTests/fast/events/onload-re-entry.html index 6eb51d063183..8c054a148490 100644 --- a/LayoutTests/fast/events/onload-re-entry.html +++ b/LayoutTests/fast/events/onload-re-entry.html @@ -7,6 +7,6 @@ function write_stuff() document.write("

" + x + "

"); } - + diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23 index 7aebab6e6b5a..4844d38f0057 100644 --- a/WebCore/ChangeLog-2005-08-23 +++ b/WebCore/ChangeLog-2005-08-23 @@ -1,3 +1,20 @@ +2005-05-11 Adele Peterson + + Reviewed by Darin. + + fix for 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 Reviewed by Kevin. diff --git a/WebCore/khtml/html/html_imageimpl.cpp b/WebCore/khtml/html/html_imageimpl.cpp index bfc70134bd81..636fee4170df 100644 --- a/WebCore/khtml/html/html_imageimpl.cpp +++ b/WebCore/khtml/html/html_imageimpl.cpp @@ -70,7 +70,8 @@ void HTMLImageLoader::updateFromElement() { // 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; diff --git a/WebCore/khtml/xml/dom_nodeimpl.h b/WebCore/khtml/xml/dom_nodeimpl.h index caacca6551ef..d0309a78544e 100644 --- a/WebCore/khtml/xml/dom_nodeimpl.h +++ b/WebCore/khtml/xml/dom_nodeimpl.h @@ -255,7 +255,8 @@ public: 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; } -- 2.36.0