[Webkit-unassigned] [Bug 104221] Add support for document.currentScript

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Feb 5 19:53:52 PST 2013


https://bugs.webkit.org/show_bug.cgi?id=104221





--- Comment #5 from Adam Barth <abarth at webkit.org>  2013-02-05 19:55:58 PST ---
(From update of attachment 186725)
View in context: https://bugs.webkit.org/attachment.cgi?id=186725&action=review

> Source/WebCore/dom/Document.cpp:552
> +    m_currentScript = 0;

This should be part of the initializer list.

> Source/WebCore/dom/Document.h:1573
> +    HTMLScriptElement* m_currentScript;

How do you know this pointer remains valid through the script's execution?  Perhaps this should be a RefPtr.

> Source/WebCore/dom/Document.idl:178
> +    readonly attribute HTMLScriptElement currentScript;

What happens when we're executing a non-HTML script element?

> Source/WebCore/dom/ScriptElement.cpp:301
> +    if (m_element->isHTMLElement())
> +        document->setCurrentScript(static_cast<HTMLScriptElement*>(m_element));

Please also test the cases of nesting HTML and non-HTML script elements.

> Source/WebCore/dom/ScriptElement.cpp:313
> +    document->setCurrentScript(oldScriptElement);

How do you know oldScriptElement still points of a valid element?  Perhaps oldScriptElement needs to be a RefPtr<HTMLScriptElement>

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.


More information about the webkit-unassigned mailing list