WebCore: Scripts should not be executed before preceding stylesheets are loaded
authorantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 4 Jan 2011 20:46:01 +0000 (20:46 +0000)
committerantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 4 Jan 2011 20:46:01 +0000 (20:46 +0000)
commit911f4ad8ee048795d9582e3c355f6f342fb26630
treeff1a299a0c021e74c78b44a51291f4fd0311886b
parentcd3cecd11b9bece49e67da3c3151cd7ad1f35120
WebCore: Scripts should not be executed before preceding stylesheets are loaded
https://bugs.webkit.org/show_bug.cgi?id=8852

Reviewed by Dave Hyatt.

Block inline script execution on pending stylesheet loads. This matches
other browsers and HTML5.

Tests: fast/tokenizer/inline-script-stylesheet-write.html
       fast/tokenizer/inline-script-stylesheet.html

* dom/PendingScript.cpp:
(WebCore::PendingScript::releaseElementAndClear):
* dom/PendingScript.h:
(WebCore::PendingScript::PendingScript):
(WebCore::PendingScript::operator=):
(WebCore::PendingScript::startingPosition):
(WebCore::PendingScript::setStartingPosition):
* html/HTMLLinkElement.cpp:
(WebCore::HTMLLinkElement::process):

This fixes an unrelated bug with beforeload events that was exposed by the other
changes (fast/dom/beforeload/remove-link-in-beforeload-listener.html).

* html/parser/HTMLScriptRunner.cpp:
(WebCore::HTMLScriptRunner::sourceFromPendingScript):
(WebCore::HTMLScriptRunner::runScript):

LayoutTests: Scripts should not be executed before preceding stylesheets are loaded
https://bugs.webkit.org/show_bug.cgi?id=8852

Reviewed by Dave Hyatt.

New tests plus a few test with slightly changed output due to different load serialization behavior.

* fast/tokenizer/inline-script-stylesheet-expected.txt: Added.
* fast/tokenizer/inline-script-stylesheet-write-expected.txt: Added.
* fast/tokenizer/inline-script-stylesheet-write.html: Added.
* fast/tokenizer/inline-script-stylesheet.html: Added.
* http/tests/security/mixedContent/insecure-css-in-main-frame-expected.txt:
* platform/mac/fast/repaint/renderer-destruction-by-invalidateSelection-crash-expected.txt:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@74995 268f45cc-cd09-0410-ab3c-d52691b4dbfc
12 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/tokenizer/inline-script-stylesheet-expected.txt [new file with mode: 0644]
LayoutTests/fast/tokenizer/inline-script-stylesheet-write-expected.txt [new file with mode: 0644]
LayoutTests/fast/tokenizer/inline-script-stylesheet-write.html [new file with mode: 0644]
LayoutTests/fast/tokenizer/inline-script-stylesheet.html [new file with mode: 0644]
LayoutTests/http/tests/security/mixedContent/insecure-css-in-main-frame-expected.txt
LayoutTests/platform/mac/fast/repaint/renderer-destruction-by-invalidateSelection-crash-expected.txt
WebCore/ChangeLog
WebCore/dom/PendingScript.cpp
WebCore/dom/PendingScript.h
WebCore/html/HTMLLinkElement.cpp
WebCore/html/parser/HTMLScriptRunner.cpp