2011-03-15 James Simonsen <simonjam@chromium.org>
authorsimonjam@chromium.org <simonjam@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 16 Mar 2011 00:00:09 +0000 (00:00 +0000)
committersimonjam@chromium.org <simonjam@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 16 Mar 2011 00:00:09 +0000 (00:00 +0000)
commit56d943da961a75e277647ae8f37382a892926796
tree5e64641f30779d44cd6497291a62c4e019c44afe
parent63d5886dcfe807e9697463e9dbe10c2e5827ef49
2011-03-15  James Simonsen  <simonjam@chromium.org>

        Reviewed by Tony Gentilcore.

        Need different behavior for ensuring execution order of dynamically loaded scripts
        https://bugs.webkit.org/show_bug.cgi?id=50115

        Dynamically added scripts with async=false will load in parallel, but execute in order.
        See: http://www.whatwg.org/specs/web-apps/current-work/multipage/scripting-1.html#force-async

        * fast/dom/HTMLScriptElement/script-async-attr-expected.txt: Added test cases for forceAsync.
        * fast/dom/HTMLScriptElement/script-async-attr.html: Ditto.
        * http/tests/misc/script-async-load-execute-in-order-expected.txt: Added.
        * http/tests/misc/script-async-load-execute-in-order.html: Added.
2011-03-15  James Simonsen  <simonjam@chromium.org>

        Reviewed by Tony Gentilcore.

        Need different behavior for ensuring execution order of dynamically loaded scripts
        https://bugs.webkit.org/show_bug.cgi?id=50115

        Dynamically added scripts with async=false will load in parallel, but execute in order.
        See: http://www.whatwg.org/specs/web-apps/current-work/multipage/scripting-1.html#force-async

        Tests: fast/dom/HTMLScriptElement/script-async-attr.html
               http/tests/misc/script-async-load-execute-in-order.html

        * Android.mk: Rename AsyncScriptRunner -> ScriptRunner.
        * CMakeLists.txt: Ditto.
        * GNUmakefile.am: Ditto.
        * WebCore.gypi: Ditto.
        * WebCore.pro: Ditto.
        * WebCore.vcproj/WebCore.vcproj: Ditto.
        * WebCore.xcodeproj/project.pbxproj: Ditto.
        * dom/DOMAllInOne.cpp: Ditto.
        * dom/Document.cpp:
        (WebCore::Document::Document): Ditto.
        (WebCore::Document::~Document): Ditto.
        * dom/Document.h:
        (WebCore::Document::scriptRunner): Ditto.
        * dom/ScriptElement.cpp:
        (WebCore::ScriptElement::ScriptElement): Added forceAsync and willExecuteInOrder.
        (WebCore::ScriptElement::handleAsyncAttribute): Called by HTMLScriptElement when async attribute changes.
        (WebCore::ScriptElement::prepareScript): Added support for forceAsync.
        (WebCore::ScriptElement::notifyFinished): Tell ScriptRunner to execute in order if needed.
        * dom/ScriptElement.h:
        (WebCore::ScriptElement::forceAsync): Added.
        * dom/ScriptRunner.cpp: Renamed from Source/WebCore/dom/AsyncScriptRunner.cpp.
        (WebCore::ScriptRunner::ScriptRunner): Added in-order script queue.
        (WebCore::ScriptRunner::~ScriptRunner): Ditto.
        (WebCore::ScriptRunner::executeScriptSoon):
        (WebCore::ScriptRunner::queueScriptForInOrderExecution): Added.
        (WebCore::ScriptRunner::suspend):
        (WebCore::ScriptRunner::resume):
        (WebCore::ScriptRunner::timerFired): Execute in-order scripts if ready.
        * dom/ScriptRunner.h: Renamed from Source/WebCore/dom/AsyncScriptRunner.h.
        (WebCore::ScriptRunner::create):
        (WebCore::ScriptRunner::hasPendingScripts): Check for in-order scripts too.
        * html/HTMLScriptElement.cpp:
        (WebCore::HTMLScriptElement::attributeChanged): Notify ScriptElement when async changes.
        (WebCore::HTMLScriptElement::setAsync): Ditto.
        (WebCore::HTMLScriptElement::async): Include forceAsync in calculation.
        * html/HTMLScriptElement.h:
        * html/HTMLScriptElement.idl: Removed Reflect from async for custom behavior.
        * page/PageGroupLoadDeferrer.cpp:
        (WebCore::PageGroupLoadDeferrer::PageGroupLoadDeferrer): Rename AsyncScriptRunner -> ScriptRunner.
        (WebCore::PageGroupLoadDeferrer::~PageGroupLoadDeferrer): Ditto.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@81198 268f45cc-cd09-0410-ab3c-d52691b4dbfc
27 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/dom/HTMLScriptElement/async-false-inside-async-false-load-expected.txt [new file with mode: 0644]
LayoutTests/fast/dom/HTMLScriptElement/async-false-inside-async-false-load.html [new file with mode: 0644]
LayoutTests/fast/dom/HTMLScriptElement/resources/async-false.js [new file with mode: 0644]
LayoutTests/fast/dom/HTMLScriptElement/script-async-attr-expected.txt
LayoutTests/fast/dom/HTMLScriptElement/script-async-attr.html
LayoutTests/http/tests/misc/script-async-load-execute-in-order-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/misc/script-async-load-execute-in-order.html [new file with mode: 0644]
Source/WebCore/Android.mk
Source/WebCore/CMakeLists.txt
Source/WebCore/ChangeLog
Source/WebCore/GNUmakefile.am
Source/WebCore/WebCore.gypi
Source/WebCore/WebCore.pro
Source/WebCore/WebCore.vcproj/WebCore.vcproj
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/dom/DOMAllInOne.cpp
Source/WebCore/dom/Document.cpp
Source/WebCore/dom/Document.h
Source/WebCore/dom/ScriptElement.cpp
Source/WebCore/dom/ScriptElement.h
Source/WebCore/dom/ScriptRunner.cpp [moved from Source/WebCore/dom/AsyncScriptRunner.cpp with 61% similarity]
Source/WebCore/dom/ScriptRunner.h [moved from Source/WebCore/dom/AsyncScriptRunner.h with 73% similarity]
Source/WebCore/html/HTMLScriptElement.cpp
Source/WebCore/html/HTMLScriptElement.h
Source/WebCore/html/HTMLScriptElement.idl
Source/WebCore/page/PageGroupLoadDeferrer.cpp