2011-03-10 Berend-Jan Wever <skylined@chromium.org>

        Reviewed by Darin Adler.

        Calling focus() on an area element not in a document should not cause a NULL ptr crash
        https://bugs.webkit.org/show_bug.cgi?id=54877

        * fast/dom/HTMLAreaElement: Added.
        * fast/dom/HTMLAreaElement/area-islink-focus-null-ptr-crash-expected.txt: Added.
        * fast/dom/HTMLAreaElement/area-islink-focus-null-ptr-crash.html: Added.
2011-03-10  Berend-Jan Wever  <skylined@chromium.org>

        Reviewed by Darin Adler.

        Calling focus() on an area element not in a document should not cause a NULL ptr crash
        https://bugs.webkit.org/show_bug.cgi?id=54877

        Test: fast/dom/HTMLAreaElement/area-islink-focus-null-ptr-crash.html

        * dom/Element.cpp:
        (WebCore::Element::focus): Check element is in the document before allowing focus
        * html/HTMLAreaElement.cpp:
        (WebCore::HTMLAreaElement::imageElement): Check element has a parent before checking if its parent is a map

git-svn-id: svn://svn.chromium.org/blink/trunk@80779 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 3af8a27c
2011-03-10 Berend-Jan Wever <skylined@chromium.org>
Reviewed by Darin Adler.
Calling focus() on an area element not in a document should not cause a NULL ptr crash
https://bugs.webkit.org/show_bug.cgi?id=54877
* fast/dom/HTMLAreaElement: Added.
* fast/dom/HTMLAreaElement/area-islink-focus-null-ptr-crash-expected.txt: Added.
* fast/dom/HTMLAreaElement/area-islink-focus-null-ptr-crash.html: Added.
2011-03-10 Ryosuke Niwa <rniwa@webkit.org> 2011-03-10 Ryosuke Niwa <rniwa@webkit.org>
Windows rebaselines for r80755. Windows rebaselines for r80755.
<!--
http://code.google.com/p/chromium/issues/detail?id=73650
https://bugs.webkit.org/show_bug.cgi?id=54877
-->
<div id="log">FAIL</div>
<script>
window.layoutTestController && layoutTestController.dumpAsText();
oArea = document.createElement('area');
oArea.href = 0;
oArea.focus();
log.innerHTML = "PASS";
</script>
2011-03-10 Berend-Jan Wever <skylined@chromium.org>
Reviewed by Darin Adler.
Calling focus() on an area element not in a document should not cause a NULL ptr crash
https://bugs.webkit.org/show_bug.cgi?id=54877
Test: fast/dom/HTMLAreaElement/area-islink-focus-null-ptr-crash.html
* dom/Element.cpp:
(WebCore::Element::focus): Check element is in the document before allowing focus
* html/HTMLAreaElement.cpp:
(WebCore::HTMLAreaElement::imageElement): Check element has a parent before checking if its parent is a map
2011-03-10 Xiyuan Xia <xiyuan@chromium.org> 2011-03-10 Xiyuan Xia <xiyuan@chromium.org>
Reviewed by Tony Chang. Reviewed by Tony Chang.
......
...@@ -1490,6 +1490,9 @@ CSSStyleDeclaration *Element::style() ...@@ -1490,6 +1490,9 @@ CSSStyleDeclaration *Element::style()
void Element::focus(bool restorePreviousSelection) void Element::focus(bool restorePreviousSelection)
{ {
if (!inDocument())
return;
Document* doc = document(); Document* doc = document();
if (doc->focusedNode() == this) if (doc->focusedNode() == this)
return; return;
......
...@@ -175,7 +175,7 @@ Path HTMLAreaElement::getRegion(const IntSize& size) const ...@@ -175,7 +175,7 @@ Path HTMLAreaElement::getRegion(const IntSize& size) const
HTMLImageElement* HTMLAreaElement::imageElement() const HTMLImageElement* HTMLAreaElement::imageElement() const
{ {
Node* mapElement = parentNode(); Node* mapElement = parentNode();
if (!mapElement->hasTagName(mapTag)) if (!mapElement || !mapElement->hasTagName(mapTag))
return 0; return 0;
return static_cast<HTMLMapElement*>(mapElement)->imageElement(); return static_cast<HTMLMapElement*>(mapElement)->imageElement();
......
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