StyleElement ownerNode is not cleared correctly
authorarv@chromium.org <arv@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 11 Apr 2012 19:21:59 +0000 (19:21 +0000)
committerarv@chromium.org <arv@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 11 Apr 2012 19:21:59 +0000 (19:21 +0000)
commitc668a50ebdb9e9ce9067838f79efd28ca1c36402
tree0775abf391728bbbf3c5d3e4d0afd221e24eeb1d
parent114b51cf8d7f0decdf79ddcfaf7470277514afb7
StyleElement ownerNode is not cleared correctly
https://bugs.webkit.org/show_bug.cgi?id=83696

Reviewed by Antti Koivisto.

Source/WebCore:

When the css text changes in such a way that we remove the sheet of a style element or a link[rel=stylesheet]
element we need to ensure that the ownerNode of the sheet is cleared. If we don't do this and there is a
wrapper for the sheet the sheet is kept alive but the ownerNode of the sheet may point to a deleted node.

Tests: fast/dom/StyleSheet/detached-sheet-owner-node-link.html
       fast/dom/StyleSheet/detached-sheet-owner-node.html

* dom/StyleElement.cpp:
(WebCore::StyleElement::removedFromDocument):
(WebCore::StyleElement::clearSheet):
(WebCore):
(WebCore::StyleElement::createSheet):
* dom/StyleElement.h:
(StyleElement):
* html/HTMLLinkElement.cpp:
(WebCore::HTMLLinkElement::process):
(WebCore::HTMLLinkElement::clearSheet):
(WebCore):
* html/HTMLLinkElement.h:
(HTMLLinkElement):

LayoutTests:

* fast/dom/StyleSheet/detached-sheet-owner-node-expected.txt: Added.
* fast/dom/StyleSheet/detached-sheet-owner-node-link-expected.txt: Added.
* fast/dom/StyleSheet/detached-sheet-owner-node-link.html: Added.
* fast/dom/StyleSheet/detached-sheet-owner-node.html: Added.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@113887 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/fast/dom/StyleSheet/detached-sheet-owner-node-expected.txt [new file with mode: 0644]
LayoutTests/fast/dom/StyleSheet/detached-sheet-owner-node-link-expected.txt [new file with mode: 0644]
LayoutTests/fast/dom/StyleSheet/detached-sheet-owner-node-link.html [new file with mode: 0644]
LayoutTests/fast/dom/StyleSheet/detached-sheet-owner-node.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/dom/StyleElement.cpp
Source/WebCore/dom/StyleElement.h
Source/WebCore/html/HTMLLinkElement.cpp
Source/WebCore/html/HTMLLinkElement.h