Commit c915a7e4 authored by ggaren@apple.com's avatar ggaren@apple.com

2009-04-18 Geoffrey Garen <ggaren@apple.com>

        Reviewed by Cameron Zwarich.

        Fixed a layout test failure, caused by my last check-in
        (fast/dom/script-element-gc.html).

        * bindings/js/JSDOMBinding.cpp:
        (WebCore::isObservableThroughDOM):
        * html/HTMLScriptElement.h:
        (WebCore::HTMLScriptElement::haveFiredLoadEvent): Treat script elements
        just like image elements: if a script element is loading, mark its JS
        wrapper, even if the element is not in the document.



git-svn-id: svn://svn.chromium.org/blink/trunk@42650 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 475ebe22
2009-04-18 Geoffrey Garen <ggaren@apple.com>
Reviewed by Cameron Zwarich.
Fixed a layout test failure, caused by my last check-in
(fast/dom/script-element-gc.html).
* bindings/js/JSDOMBinding.cpp:
(WebCore::isObservableThroughDOM):
* html/HTMLScriptElement.h:
(WebCore::HTMLScriptElement::haveFiredLoadEvent): Treat script elements
just like image elements: if a script element is loading, mark its JS
wrapper, even if the element is not in the document.
2009-04-18 Jian Li <jianli@chromium.org> 2009-04-18 Jian Li <jianli@chromium.org>
Reviewed by Dimitri Glazkov. Reviewed by Dimitri Glazkov.
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
#include "ExceptionCode.h" #include "ExceptionCode.h"
#include "Frame.h" #include "Frame.h"
#include "HTMLImageElement.h" #include "HTMLImageElement.h"
#include "HTMLScriptElement.h"
#include "HTMLNames.h" #include "HTMLNames.h"
#include "JSDOMCoreException.h" #include "JSDOMCoreException.h"
#include "JSDOMWindowCustom.h" #include "JSDOMWindowCustom.h"
...@@ -278,13 +279,15 @@ static inline bool isObservableThroughDOM(JSNode* jsNode) ...@@ -278,13 +279,15 @@ static inline bool isObservableThroughDOM(JSNode* jsNode)
if (node->eventListeners().size()) if (node->eventListeners().size())
return true; // Technically, we may overzealously mark a wrapper for a node that has only non-JS event listeners. Oh well. return true; // Technically, we may overzealously mark a wrapper for a node that has only non-JS event listeners. Oh well.
} else { } else {
// 3. If a wrapper is the last reference to an image element that is loading // 3. If a wrapper is the last reference to an image or script element
// but not in the document -- which happens in the case of "new Image" -- the // that is loading but not in the document, the wrapper is observable
// wrapper is observable because it is the only thing keeping the image element // because it is the only thing keeping the image element alive, and if
// alive, and if the image element is destroyed, its load event will not fire. // the image element is destroyed, its load event will not fire.
// FIXME: The DOM should manage this issue without the help of JavaScript wrappers. // FIXME: The DOM should manage this issue without the help of JavaScript wrappers.
if (node->hasTagName(imgTag) && !static_cast<HTMLImageElement*>(node)->haveFiredLoadEvent()) if (node->hasTagName(imgTag) && !static_cast<HTMLImageElement*>(node)->haveFiredLoadEvent())
return true; return true;
if (node->hasTagName(scriptTag) && !static_cast<HTMLScriptElement*>(node)->haveFiredLoadEvent())
return true;
} }
return false; return false;
......
...@@ -75,6 +75,8 @@ public: ...@@ -75,6 +75,8 @@ public:
virtual void addSubresourceAttributeURLs(ListHashSet<KURL>&) const; virtual void addSubresourceAttributeURLs(ListHashSet<KURL>&) const;
bool haveFiredLoadEvent() const { return m_data.haveFiredLoadEvent(); }
protected: protected:
virtual String sourceAttributeValue() const; virtual String sourceAttributeValue() const;
virtual String charsetAttributeValue() const; virtual String charsetAttributeValue() const;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment