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)
        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

index 5755e50..57a1391 100644 (file)
@@ -1,3 +1,18 @@
+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  Martin Robinson  <mrobinson@igalia.com>
 
         Adding new test results for GTK+.
diff --git a/LayoutTests/fast/dom/HTMLScriptElement/async-false-inside-async-false-load-expected.txt b/LayoutTests/fast/dom/HTMLScriptElement/async-false-inside-async-false-load-expected.txt
new file mode 100644 (file)
index 0000000..d73318a
--- /dev/null
@@ -0,0 +1,7 @@
+Checks that adding an async=false script while executing an async=false script doesn't mess anything up.
+async-false
+async
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/dom/HTMLScriptElement/async-false-inside-async-false-load.html b/LayoutTests/fast/dom/HTMLScriptElement/async-false-inside-async-false-load.html
new file mode 100644 (file)
index 0000000..f9f2801
--- /dev/null
@@ -0,0 +1,22 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<link rel="stylesheet" href=".../../js/resources/js-test-style.css">
+<script src="../../js/resources/js-test-pre.js"></script>
+</head>
+<body onload="">
+Checks that adding an async=false script while executing an async=false script doesn't mess anything up.
+<div id="console"></div>
+<script>
+var jsTestIsAsync = true;
+
+first_script = document.createElement("script");
+first_script.async = false;
+first_script.src = "resources/async-false.js";
+document.getElementsByTagName("head")[0].appendChild(first_script);
+
+var successfullyParsed = true;
+</script>
+<script src="../../js/resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/fast/dom/HTMLScriptElement/resources/async-false.js b/LayoutTests/fast/dom/HTMLScriptElement/resources/async-false.js
new file mode 100644 (file)
index 0000000..c23d201
--- /dev/null
@@ -0,0 +1,6 @@
+debug("async-false");
+second_script = document.createElement("script");
+second_script.async = false;
+second_script.src = "resources/async.js";
+second_script.addEventListener("load", finishJSTest, false);
+document.getElementsByTagName("head")[0].appendChild(second_script);
index 7b8bf4d..e867f40 100644 (file)
@@ -8,8 +8,14 @@ PASS isAsync('s1') is true
 PASS isAsync('s2') is true
 PASS isAsync('s3') is true
 PASS isAsync('s4') is true
+PASS isAsync('s5') is true
+PASS isAsync('s6') is true
+PASS isAsync('s7') is true
+PASS isAsync('s8') is false
 PASS isDynamicallyInsertedScriptAsync(true) is true
 PASS isDynamicallyInsertedScriptAsync(false) is false
+PASS isDynamicallyInsertedScriptAsync("async") is true
+PASS isDynamicallyInsertedScriptAsync(null) is true
 PASS successfullyParsed is true
 
 TEST COMPLETE
index 4a3f3af..b0e406a 100644 (file)
 <script id="s2" src="ignored.js" async="async"></script>
 <script id="s3" src="ignored.js" async="ASYNC"></script>
 <script id="s4" src="ignored.js" async="true"></script>
+<script id="s5" src="ignored.js" async="false"></script>
+<script id="s6"></script>
+<script id="s7" async></script>
+<script id="s8" async></script>
 
 <script>
 description('This test checks for proper parsing of the async attribute on HTML script tags.');
 
-var nextScriptID = 0;
+var nextScriptID = 9;
 
 function isAsync(id)
 {
@@ -29,19 +33,27 @@ function isDynamicallyInsertedScriptAsync(async)
     var script = document.createElement("script");
     script.id = id;
     script.src = "resources/script-load.js";
-    if (async)
-        script.async = "async";
+    if (async != null)
+        script.async = async;
     document.getElementsByTagName("head")[0].appendChild(script);
     return isAsync(id);
 }
 
+document.getElementById("s8").removeAttribute("async");
+
 shouldBeFalse("isAsync('s0')");
 shouldBeTrue("isAsync('s1')");
 shouldBeTrue("isAsync('s2')");
 shouldBeTrue("isAsync('s3')");
 shouldBeTrue("isAsync('s4')");
+shouldBeTrue("isAsync('s5')");
+shouldBeTrue("isAsync('s6')");
+shouldBeTrue("isAsync('s7')");
+shouldBeFalse("isAsync('s8')");
 shouldBeTrue("isDynamicallyInsertedScriptAsync(true)");
 shouldBeFalse("isDynamicallyInsertedScriptAsync(false)");
+shouldBeTrue("isDynamicallyInsertedScriptAsync(\"async\")");
+shouldBeTrue("isDynamicallyInsertedScriptAsync(null)");
 
 var successfullyParsed = true;
 </script>
diff --git a/LayoutTests/http/tests/misc/script-async-load-execute-in-order-expected.txt b/LayoutTests/http/tests/misc/script-async-load-execute-in-order-expected.txt
new file mode 100644 (file)
index 0000000..27cf695
--- /dev/null
@@ -0,0 +1,8 @@
+Checks that async=false enforces execution order dynamically inserted scripts. See: http://www.whatwg.org/specs/web-apps/current-work/multipage/scripting-1.html#force-async
+slowAsync
+async
+load
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/http/tests/misc/script-async-load-execute-in-order.html b/LayoutTests/http/tests/misc/script-async-load-execute-in-order.html
new file mode 100644 (file)
index 0000000..9c93677
--- /dev/null
@@ -0,0 +1,30 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<link rel="stylesheet" href="../../js-test-resources/js-test-style.css">
+<script src="../../js-test-resources/js-test-pre.js"></script>
+</head>
+<body onload="debug('load');finishJSTest();">
+Checks that async=false enforces execution order dynamically inserted scripts.
+See: http://www.whatwg.org/specs/web-apps/current-work/multipage/scripting-1.html#force-async
+<div id="console"></div>
+<script>
+var jsTestIsAsync = true;
+
+slowly_loaded_script = document.createElement("script");
+slowly_loaded_script.async = false;
+slowly_loaded_script.src = "resources/slow-async-script.cgi";
+document.getElementsByTagName("head")[0].appendChild(slowly_loaded_script);
+slowly_loaded_script.async = true; // Should have no effect, becaus script has already been requested.
+
+quickly_loaded_script = document.createElement("script");
+quickly_loaded_script.async = false;
+quickly_loaded_script.src = "resources/async-script.js";
+document.getElementsByTagName("head")[0].appendChild(quickly_loaded_script);
+quickly_loaded_script.async = true; // Should have no effect, becaus script has already been requested.
+
+var successfullyParsed = true;
+</script>
+<script src="../../js-test-resources/js-test-post.js"></script>
+</body>
+</html>
index 03a42e9..1a84190 100644 (file)
@@ -95,7 +95,6 @@ LOCAL_SRC_FILES := $(LOCAL_SRC_FILES) \
        css/WebKitCSSTransformValue.cpp \
        \
        dom/ActiveDOMObject.cpp \
-       dom/AsyncScriptRunner.cpp \
        dom/Attr.cpp \
        dom/Attribute.cpp \
        dom/BeforeTextInsertedEvent.cpp \
@@ -172,6 +171,7 @@ LOCAL_SRC_FILES := $(LOCAL_SRC_FILES) \
        dom/ScriptableDocumentParser.cpp \
        dom/ScriptElement.cpp \
        dom/ScriptExecutionContext.cpp \
+       dom/ScriptRunner.cpp \
        dom/SelectElement.cpp \
        dom/SelectorNodeList.cpp \
        dom/SpaceSplitString.cpp \
index 3b8b286..c2cf86b 100644 (file)
@@ -688,7 +688,6 @@ SET(WebCore_SOURCES
     css/WebKitCSSTransformValue.cpp
 
     dom/ActiveDOMObject.cpp
-    dom/AsyncScriptRunner.cpp
     dom/Attr.cpp
     dom/Attribute.cpp
     dom/BeforeTextInsertedEvent.cpp
@@ -769,6 +768,7 @@ SET(WebCore_SOURCES
     dom/ScriptableDocumentParser.cpp
     dom/ScriptElement.cpp
     dom/ScriptExecutionContext.cpp
+    dom/ScriptRunner.cpp
     dom/SelectElement.cpp
     dom/SelectorNodeList.cpp
     dom/SpaceSplitString.cpp
index e810a26..8bbc95a 100644 (file)
@@ -1,3 +1,57 @@
+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.
+
 2011-03-15  Tony Chang  <tony@chromium.org>
 
         Reviewed by Adam Barth.
index 0b49eb4..ba03a50 100644 (file)
@@ -1117,8 +1117,6 @@ webcore_sources += \
        Source/WebCore/css/WebKitCSSTransformValue.h \
        Source/WebCore/dom/ActiveDOMObject.cpp \
        Source/WebCore/dom/ActiveDOMObject.h \
-       Source/WebCore/dom/AsyncScriptRunner.cpp \
-       Source/WebCore/dom/AsyncScriptRunner.h \
        Source/WebCore/dom/Attr.cpp \
        Source/WebCore/dom/Attr.h \
        Source/WebCore/dom/Attribute.cpp \
@@ -1308,6 +1306,8 @@ webcore_sources += \
        Source/WebCore/dom/ScriptElement.h \
        Source/WebCore/dom/ScriptExecutionContext.cpp \
        Source/WebCore/dom/ScriptExecutionContext.h \
+       Source/WebCore/dom/ScriptRunner.cpp \
+       Source/WebCore/dom/ScriptRunner.h \
        Source/WebCore/dom/SelectElement.cpp \
        Source/WebCore/dom/SelectElement.h \
        Source/WebCore/dom/SelectorNodeList.cpp \
index 47bb13b..9f04814 100644 (file)
             'css/WebKitCSSTransformValue.h',
             'dom/ActiveDOMObject.cpp',
             'dom/ActiveDOMObject.h',
-            'dom/AsyncScriptRunner.cpp',
-            'dom/AsyncScriptRunner.h',
             'dom/Attr.cpp',
             'dom/Attr.h',
             'dom/Attribute.cpp',
             'dom/ScriptElement.h',
             'dom/ScriptExecutionContext.cpp',
             'dom/ScriptExecutionContext.h',
+            'dom/ScriptRunner.cpp',
+            'dom/ScriptRunner.h',
             'dom/ScriptableDocumentParser.cpp',
             'dom/ScriptableDocumentParser.h',
             'dom/ScriptedAnimationController.cpp',
index 7c1e866..0b32392 100644 (file)
@@ -440,7 +440,6 @@ SOURCES += \
     css/WebKitCSSMatrix.cpp \
     css/WebKitCSSTransformValue.cpp \
     dom/ActiveDOMObject.cpp \
-    dom/AsyncScriptRunner.cpp \
     dom/Attr.cpp \
     dom/Attribute.cpp \
     dom/BeforeProcessEvent.cpp \
@@ -524,6 +523,7 @@ SOURCES += \
     dom/ScriptableDocumentParser.cpp \
     dom/ScriptElement.cpp \
     dom/ScriptExecutionContext.cpp \
+    dom/ScriptRunner.cpp \
     dom/SelectElement.cpp \
     dom/SelectorNodeList.cpp \
     dom/SpaceSplitString.cpp \
index 34d7764..73fef13 100755 (executable)
                                >
                        </File>
                        <File
-                               RelativePath="..\dom\AsyncScriptRunner.cpp"
-                               >
-                               <FileConfiguration
-                                       Name="Debug|Win32"
-                                       ExcludedFromBuild="true"
-                                       >
-                                       <Tool
-                                               Name="VCCLCompilerTool"
-                                       />
-                               </FileConfiguration>
-                               <FileConfiguration
-                                       Name="Release|Win32"
-                                       ExcludedFromBuild="true"
-                                       >
-                                       <Tool
-                                               Name="VCCLCompilerTool"
-                                       />
-                               </FileConfiguration>
-                               <FileConfiguration
-                                       Name="Debug_Cairo_CFLite|Win32"
-                                       ExcludedFromBuild="true"
-                                       >
-                                       <Tool
-                                               Name="VCCLCompilerTool"
-                                       />
-                               </FileConfiguration>
-                               <FileConfiguration
-                                       Name="Release_Cairo_CFLite|Win32"
-                                       ExcludedFromBuild="true"
-                                       >
-                                       <Tool
-                                               Name="VCCLCompilerTool"
-                                       />
-                               </FileConfiguration>
-                               <FileConfiguration
-                                       Name="Debug_All|Win32"
-                                       ExcludedFromBuild="true"
-                                       >
-                                       <Tool
-                                               Name="VCCLCompilerTool"
-                                       />
-                               </FileConfiguration>
-                               <FileConfiguration
-                                       Name="Release_LTCG|Win32"
-                                       ExcludedFromBuild="true"
-                                       >
-                                       <Tool
-                                               Name="VCCLCompilerTool"
-                                       />
-                               </FileConfiguration>
-                       </File>
-                       <File
-                               RelativePath="..\dom\AsyncScriptRunner.h"
-                               >
-                       </File>
-                       <File
                                RelativePath="..\dom\AtomicStringList.h"
                                >
                        </File>
                                >
                        </File>
                        <File
+                               RelativePath="..\dom\ScriptRunner.cpp"
+                               >
+                               <FileConfiguration
+                                       Name="Debug|Win32"
+                                       ExcludedFromBuild="true"
+                                       >
+                                       <Tool
+                                               Name="VCCLCompilerTool"
+                                       />
+                               </FileConfiguration>
+                               <FileConfiguration
+                                       Name="Release|Win32"
+                                       ExcludedFromBuild="true"
+                                       >
+                                       <Tool
+                                               Name="VCCLCompilerTool"
+                                       />
+                               </FileConfiguration>
+                               <FileConfiguration
+                                       Name="Debug_Cairo_CFLite|Win32"
+                                       ExcludedFromBuild="true"
+                                       >
+                                       <Tool
+                                               Name="VCCLCompilerTool"
+                                       />
+                               </FileConfiguration>
+                               <FileConfiguration
+                                       Name="Release_Cairo_CFLite|Win32"
+                                       ExcludedFromBuild="true"
+                                       >
+                                       <Tool
+                                               Name="VCCLCompilerTool"
+                                       />
+                               </FileConfiguration>
+                               <FileConfiguration
+                                       Name="Debug_All|Win32"
+                                       ExcludedFromBuild="true"
+                                       >
+                                       <Tool
+                                               Name="VCCLCompilerTool"
+                                       />
+                               </FileConfiguration>
+                               <FileConfiguration
+                                       Name="Release_LTCG|Win32"
+                                       ExcludedFromBuild="true"
+                                       >
+                                       <Tool
+                                               Name="VCCLCompilerTool"
+                                       />
+                               </FileConfiguration>
+                       </File>
+                       <File
+                               RelativePath="..\dom\ScriptRunner.h"
+                               >
+                       </File>
+                       <File
                                RelativePath="..\dom\SelectElement.cpp"
                                >
                                <FileConfiguration
index bc8898c..c9cf9b3 100644 (file)
                89D08DA112228451001241DF /* AsyncFileSystemCallbacks.h in Headers */ = {isa = PBXBuildFile; fileRef = 89D08D9E12228451001241DF /* AsyncFileSystemCallbacks.h */; };
                8A12E35D11FA33280025836A /* DocumentLoadTiming.h in Headers */ = {isa = PBXBuildFile; fileRef = 8A12E35C11FA33280025836A /* DocumentLoadTiming.h */; settings = {ATTRIBUTES = (Private, ); }; };
                8A309C9F123950BE00CB9204 /* NestingLevelIncrementer.h in Headers */ = {isa = PBXBuildFile; fileRef = 8A309C9E123950BE00CB9204 /* NestingLevelIncrementer.h */; };
-               8A413AE01207BBA50082016E /* AsyncScriptRunner.h in Headers */ = {isa = PBXBuildFile; fileRef = 8A413ADE1207BBA50082016E /* AsyncScriptRunner.h */; settings = {ATTRIBUTES = (Private, ); }; };
-               8A413AE11207BBA50082016E /* AsyncScriptRunner.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8A413ADF1207BBA50082016E /* AsyncScriptRunner.cpp */; };
+               8A413AE01207BBA50082016E /* ScriptRunner.h in Headers */ = {isa = PBXBuildFile; fileRef = 8A413ADE1207BBA50082016E /* ScriptRunner.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               8A413AE11207BBA50082016E /* ScriptRunner.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8A413ADF1207BBA50082016E /* ScriptRunner.cpp */; };
                8A7CC96B12076D73001D4588 /* PendingScript.h in Headers */ = {isa = PBXBuildFile; fileRef = 8A7CC96A12076D73001D4588 /* PendingScript.h */; settings = {ATTRIBUTES = (Private, ); }; };
                8A7CC97012076F8A001D4588 /* PendingScript.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8A7CC96F12076F8A001D4588 /* PendingScript.cpp */; };
                8A81BF8511DCFD9000DA2B98 /* ResourceLoadTiming.h in Headers */ = {isa = PBXBuildFile; fileRef = 8A81BF8411DCFD9000DA2B98 /* ResourceLoadTiming.h */; settings = {ATTRIBUTES = (Private, ); }; };
                89D08D9E12228451001241DF /* AsyncFileSystemCallbacks.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AsyncFileSystemCallbacks.h; sourceTree = "<group>"; };
                8A12E35C11FA33280025836A /* DocumentLoadTiming.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DocumentLoadTiming.h; sourceTree = "<group>"; };
                8A309C9E123950BE00CB9204 /* NestingLevelIncrementer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = NestingLevelIncrementer.h; path = parser/NestingLevelIncrementer.h; sourceTree = "<group>"; };
-               8A413ADE1207BBA50082016E /* AsyncScriptRunner.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AsyncScriptRunner.h; sourceTree = "<group>"; };
-               8A413ADF1207BBA50082016E /* AsyncScriptRunner.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AsyncScriptRunner.cpp; sourceTree = "<group>"; };
+               8A413ADE1207BBA50082016E /* ScriptRunner.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScriptRunner.h; sourceTree = "<group>"; };
+               8A413ADF1207BBA50082016E /* ScriptRunner.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScriptRunner.cpp; sourceTree = "<group>"; };
                8A7CC96A12076D73001D4588 /* PendingScript.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PendingScript.h; sourceTree = "<group>"; };
                8A7CC96F12076F8A001D4588 /* PendingScript.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PendingScript.cpp; sourceTree = "<group>"; };
                8A81BF8411DCFD9000DA2B98 /* ResourceLoadTiming.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ResourceLoadTiming.h; sourceTree = "<group>"; };
                        children = (
                                E1C4DE6D0EA75C650023CCD6 /* ActiveDOMObject.cpp */,
                                E1C4DE680EA75C1E0023CCD6 /* ActiveDOMObject.h */,
-                               8A413ADF1207BBA50082016E /* AsyncScriptRunner.cpp */,
-                               8A413ADE1207BBA50082016E /* AsyncScriptRunner.h */,
                                A8C4A7FC09D563270003AC8D /* Attr.cpp */,
                                A8C4A7FB09D563270003AC8D /* Attr.h */,
                                93EEC1E509C2877700C515D1 /* Attr.idl */,
                                08A484760E5272C500C3FE76 /* ScriptElement.h */,
                                E11C9DAF0EB3699500E409DB /* ScriptExecutionContext.cpp */,
                                E11C9D9A0EB3681200E409DB /* ScriptExecutionContext.h */,
+                               8A413ADF1207BBA50082016E /* ScriptRunner.cpp */,
+                               8A413ADE1207BBA50082016E /* ScriptRunner.h */,
                                084AEBE20FB505FA0038483E /* SelectElement.cpp */,
                                084AEBE30FB505FA0038483E /* SelectElement.h */,
                                BC7FA6800D1F167900DB22A9 /* SelectorNodeList.cpp */,
                                976D6C77122B8A3D001FD1F7 /* AsyncFileWriter.h in Headers */,
                                976D6C93122B8A3D001FD1F7 /* AsyncFileWriterClient.h in Headers */,
                                B0149E7E11A4B21500196A7B /* AsyncImageResizer.h in Headers */,
-                               8A413AE01207BBA50082016E /* AsyncScriptRunner.h in Headers */,
                                37C61F0112095C87007A3C67 /* AtomicStringKeyedMRUCache.h in Headers */,
                                A8C4A80D09D563270003AC8D /* Attr.h in Headers */,
                                A8C4A80B09D563270003AC8D /* Attribute.h in Headers */,
                                9F72304F11184B4100AD0126 /* ScriptProfile.h in Headers */,
                                9FA37EE41172FC8000C4CD55 /* ScriptProfileNode.h in Headers */,
                                9F72305111184B4100AD0126 /* ScriptProfiler.h in Headers */,
+                               8A413AE01207BBA50082016E /* ScriptRunner.h in Headers */,
                                934CC10A0EDB223900A658F2 /* ScriptSourceCode.h in Headers */,
                                CE54FD381016D9A6008B44C8 /* ScriptSourceProvider.h in Headers */,
                                41C760B10EDE03D300C1655F /* ScriptState.h in Headers */,
                                49EECDDF10503C2400099FAB /* ArrayBufferView.cpp in Sources */,
                                89D08D9F12228451001241DF /* AsyncFileSystem.cpp in Sources */,
                                B0149E7D11A4B21500196A7B /* AsyncImageResizer.cpp in Sources */,
-                               8A413AE11207BBA50082016E /* AsyncScriptRunner.cpp in Sources */,
                                A8C4A80E09D563270003AC8D /* Attr.cpp in Sources */,
                                A8C4A80C09D563270003AC8D /* Attribute.cpp in Sources */,
                                FD315FF612B0267600C1A359 /* AudioBasicProcessorNode.cpp in Sources */,
                                41F066E50F64BCF600A07EAC /* ScriptObject.cpp in Sources */,
                                F33F0282120947F200E5743A /* ScriptProfile.cpp in Sources */,
                                9F72305011184B4100AD0126 /* ScriptProfiler.cpp in Sources */,
+                               8A413AE11207BBA50082016E /* ScriptRunner.cpp in Sources */,
                                4127D5370F8AAB1D00E424F5 /* ScriptState.cpp in Sources */,
                                934CC0E10ED39D6F00A658F2 /* ScriptValue.cpp in Sources */,
                                BC8AE34E12EA096A00EB3AE6 /* ScrollableArea.cpp in Sources */,
index c88aecf..08a7680 100644 (file)
@@ -26,7 +26,6 @@
 // This all-in-one cpp file cuts down on template bloat to allow us to build our Windows release build.
 
 #include "ActiveDOMObject.cpp"
-#include "AsyncScriptRunner.cpp"
 #include "Attr.cpp"
 #include "Attribute.cpp"
 #include "BeforeProcessEvent.cpp"
 #include "ScopedEventQueue.cpp"
 #include "ScriptElement.cpp"
 #include "ScriptExecutionContext.cpp"
+#include "ScriptRunner.cpp"
 #include "ScriptableDocumentParser.cpp"
 #include "SelectElement.cpp"
 #include "SelectorNodeList.cpp"
index fee2af2..6ab60b0 100644 (file)
@@ -29,7 +29,6 @@
 
 #include "AXObjectCache.h"
 #include "AnimationController.h"
-#include "AsyncScriptRunner.h"
 #include "Attr.h"
 #include "Attribute.h"
 #include "CDATASection.h"
 #include "ScriptController.h"
 #include "ScriptElement.h"
 #include "ScriptEventListener.h"
+#include "ScriptRunner.h"
 #include "SecurityOrigin.h"
 #include "SegmentedString.h"
 #include "SelectionController.h"
@@ -395,7 +395,7 @@ Document::Document(Frame* frame, const KURL& url, bool isXHTML, bool isHTML)
     , m_startTime(currentTime())
     , m_overMinimumLayoutThreshold(false)
     , m_extraLayoutDelay(0)
-    , m_asyncScriptRunner(AsyncScriptRunner::create(this))
+    , m_scriptRunner(ScriptRunner::create(this))
     , m_xmlVersion("1.0")
     , m_xmlStandalone(false)
     , m_savedRenderer(0)
@@ -566,7 +566,7 @@ Document::~Document()
     ASSERT(m_ranges.isEmpty());
     ASSERT(!m_styleRecalcTimer.isActive());
 
-    m_asyncScriptRunner.clear();
+    m_scriptRunner.clear();
 
     removeAllEventListeners();
 
index 8e20097..1770bc8 100644 (file)
@@ -51,7 +51,6 @@
 
 namespace WebCore {
 
-class AsyncScriptRunner;
 class Attr;
 class AXObjectCache;
 class CDATASection;
@@ -115,6 +114,7 @@ class RenderView;
 class RenderFullScreen;
 class ScriptableDocumentParser;
 class ScriptElementData;
+class ScriptRunner;
 class SecurityOrigin;
 class SerializedScriptValue;
 class SegmentedString;
@@ -902,7 +902,7 @@ public:
 
     int docID() const { return m_docID; }
     
-    AsyncScriptRunner* asyncScriptRunner() { return m_asyncScriptRunner.get(); }
+    ScriptRunner* scriptRunner() { return m_scriptRunner.get(); }
 
 #if ENABLE(XSLT)
     void applyXSLTransform(ProcessingInstruction* pi);
@@ -1319,7 +1319,7 @@ private:
     // points during the lifetime of the Document.
     int m_extraLayoutDelay;
     
-    OwnPtr<AsyncScriptRunner> m_asyncScriptRunner;
+    OwnPtr<ScriptRunner> m_scriptRunner;
 
 #if ENABLE(XSLT)
     OwnPtr<TransformSource> m_transformSource;
index 3bba9a0..b4d3670 100644 (file)
@@ -24,7 +24,6 @@
 #include "config.h"
 #include "ScriptElement.h"
 
-#include "AsyncScriptRunner.h"
 #include "CachedScript.h"
 #include "CachedResourceLoader.h"
 #include "Document.h"
@@ -37,6 +36,7 @@
 #include "MIMETypeRegistry.h"
 #include "Page.h"
 #include "ScriptController.h"
+#include "ScriptRunner.h"
 #include "ScriptSourceCode.h"
 #include "ScriptValue.h"
 #include "Settings.h"
@@ -61,6 +61,8 @@ ScriptElement::ScriptElement(Element* element, bool parserInserted, bool already
     , m_willBeParserExecuted(false)
     , m_readyToBeParserExecuted(false)
     , m_willExecuteWhenDocumentFinishedParsing(false)
+    , m_forceAsync(!parserInserted)
+    , m_willExecuteInOrder(false)
 {
     ASSERT(m_element);
 }
@@ -96,6 +98,11 @@ void ScriptElement::handleSourceAttribute(const String& sourceUrl)
     prepareScript(); // FIXME: Provide a real starting line number here.
 }
 
+void ScriptElement::handleAsyncAttribute()
+{
+    m_forceAsync = false;
+}
+
 // Helper function
 static bool isLegacySupportedJavaScriptLanguage(const String& language)
 {
@@ -159,7 +166,8 @@ bool ScriptElement::prepareScript(const TextPosition1& scriptStartPosition, Lega
     } else
         wasParserInserted = false;
 
-    // FIXME: HTML5 spec says we should set forceAsync.
+    if (wasParserInserted && !asyncAttributeValue())
+        m_forceAsync = true;
 
     // FIXME: HTML5 spec says we should check that all children are either comments or empty text nodes.
     if (!hasSourceAttribute() && !m_element->firstChild())
@@ -171,8 +179,10 @@ bool ScriptElement::prepareScript(const TextPosition1& scriptStartPosition, Lega
     if (!isScriptTypeSupported(supportLegacyTypes))
         return false;
 
-    if (wasParserInserted)
+    if (wasParserInserted) {
         m_parserInserted = true;
+        m_forceAsync = false;
+    }
 
     m_alreadyStarted = true;
 
@@ -207,6 +217,10 @@ bool ScriptElement::prepareScript(const TextPosition1& scriptStartPosition, Lega
     else if (!hasSourceAttribute() && m_parserInserted && !m_element->document()->haveStylesheetsLoaded()) {
         m_willBeParserExecuted = true;
         m_readyToBeParserExecuted = true;
+    } else if (hasSourceAttribute() && !asyncAttributeValue() && !m_forceAsync) {
+        m_willExecuteInOrder = true;
+        m_element->document()->scriptRunner()->queueScriptForExecution(this, m_cachedScript, ScriptRunner::IN_ORDER_EXECUTION);
+        m_cachedScript->addClient(this);
     } else if (hasSourceAttribute())
         m_cachedScript->addClient(this);
     else
@@ -286,7 +300,10 @@ void ScriptElement::notifyFinished(CachedResource* o)
 {
     ASSERT(!m_willBeParserExecuted);
     ASSERT_UNUSED(o, o == m_cachedScript);
-    m_element->document()->asyncScriptRunner()->executeScriptSoon(this, m_cachedScript);
+    if (m_willExecuteInOrder)
+        m_element->document()->scriptRunner()->notifyInOrderScriptReady();
+    else
+        m_element->document()->scriptRunner()->queueScriptForExecution(this, m_cachedScript, ScriptRunner::ASYNC_EXECUTION);
     m_cachedScript = 0;
 }
 
index 79dff33..9ce66e5 100644 (file)
@@ -63,12 +63,14 @@ protected:
     void setHaveFiredLoadEvent(bool haveFiredLoad) { m_haveFiredLoad = haveFiredLoad; }
     bool isParserInserted() const { return m_parserInserted; }
     bool alreadyStarted() const { return m_alreadyStarted; }
+    bool forceAsync() const { return m_forceAsync; }
 
     // Helper functions used by our parent classes.
     void insertedIntoDocument();
     void removedFromDocument();
     void childrenChanged();
     void handleSourceAttribute(const String& sourceUrl);
+    void handleAsyncAttribute();
 
 private:
     bool ignoresLoadRequest() const;
@@ -98,6 +100,8 @@ private:
     bool m_willBeParserExecuted : 1; // Same as "The parser will handle executing the script."
     bool m_readyToBeParserExecuted : 1;
     bool m_willExecuteWhenDocumentFinishedParsing : 1;
+    bool m_forceAsync : 1;
+    bool m_willExecuteInOrder : 1;
     String m_characterEncoding;
     String m_fallbackCharacterEncoding;
 };
similarity index 61%
rename from Source/WebCore/dom/AsyncScriptRunner.cpp
rename to Source/WebCore/dom/ScriptRunner.cpp
index 28b1b31..10198bf 100644 (file)
@@ -24,7 +24,7 @@
  */
 
 #include "config.h"
-#include "AsyncScriptRunner.h"
+#include "ScriptRunner.h"
 
 #include "CachedScript.h"
 #include "Document.h"
 
 namespace WebCore {
 
-AsyncScriptRunner::AsyncScriptRunner(Document* document)
+ScriptRunner::ScriptRunner(Document* document)
     : m_document(document)
-    , m_timer(this, &AsyncScriptRunner::timerFired)
+    , m_timer(this, &ScriptRunner::timerFired)
 {
     ASSERT(document);
 }
 
-AsyncScriptRunner::~AsyncScriptRunner()
+ScriptRunner::~ScriptRunner()
 {
     for (size_t i = 0; i < m_scriptsToExecuteSoon.size(); ++i)
         m_document->decrementLoadEventDelayCount();
+    for (size_t i = 0; i < m_scriptsToExecuteInOrder.size(); ++i)
+        m_document->decrementLoadEventDelayCount();
 }
 
-void AsyncScriptRunner::executeScriptSoon(ScriptElement* scriptElement, CachedResourceHandle<CachedScript> cachedScript)
+void ScriptRunner::queueScriptForExecution(ScriptElement* scriptElement, CachedResourceHandle<CachedScript> cachedScript, ExecutionType executionType)
 {
-    ASSERT_ARG(scriptElement, scriptElement);
+    ASSERT(scriptElement);
 
     Element* element = scriptElement->element();
     ASSERT(element);
     ASSERT(element->inDocument());
 
     m_document->incrementLoadEventDelayCount();
-    m_scriptsToExecuteSoon.append(PendingScript(element, cachedScript.get()));
-    if (!m_timer.isActive())
-        m_timer.startOneShot(0);
+
+    switch (executionType) {
+    case ASYNC_EXECUTION:
+        m_scriptsToExecuteSoon.append(PendingScript(element, cachedScript.get()));
+        if (!m_timer.isActive())
+            m_timer.startOneShot(0);
+        break;
+
+    case IN_ORDER_EXECUTION:
+        m_scriptsToExecuteInOrder.append(PendingScript(element, cachedScript.get()));
+        break;
+
+    default:
+        ASSERT_NOT_REACHED();
+    }
 }
 
-void AsyncScriptRunner::suspend()
+void ScriptRunner::suspend()
 {
     m_timer.stop();
 }
 
-void AsyncScriptRunner::resume()
+void ScriptRunner::resume()
 {
     if (hasPendingScripts())
         m_timer.startOneShot(0);
 }
 
-void AsyncScriptRunner::timerFired(Timer<AsyncScriptRunner>* timer)
+void ScriptRunner::notifyInOrderScriptReady()
+{
+    ASSERT(!m_scriptsToExecuteInOrder.isEmpty());
+    m_timer.startOneShot(0);
+}
+
+void ScriptRunner::timerFired(Timer<ScriptRunner>* timer)
 {
     ASSERT_UNUSED(timer, timer == &m_timer);
 
     RefPtr<Document> protect(m_document);
-    
+
     Vector<PendingScript> scripts;
     scripts.swap(m_scriptsToExecuteSoon);
+
+    size_t numInOrderScriptsToExecute = 0;
+    for (; numInOrderScriptsToExecute < m_scriptsToExecuteInOrder.size() && m_scriptsToExecuteInOrder[numInOrderScriptsToExecute].cachedScript()->isLoaded(); ++numInOrderScriptsToExecute)
+        scripts.append(m_scriptsToExecuteInOrder[numInOrderScriptsToExecute]);
+    if (numInOrderScriptsToExecute)
+        m_scriptsToExecuteInOrder.remove(0, numInOrderScriptsToExecute);
+
     size_t size = scripts.size();
     for (size_t i = 0; i < size; ++i) {
         CachedScript* cachedScript = scripts[i].cachedScript();
similarity index 73%
rename from Source/WebCore/dom/AsyncScriptRunner.h
rename to Source/WebCore/dom/ScriptRunner.h
index 6a75323..d6d7411 100644 (file)
@@ -23,8 +23,8 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
  */
 
-#ifndef AsyncScriptRunner_h
-#define AsyncScriptRunner_h
+#ifndef ScriptRunner_h
+#define ScriptRunner_h
 
 #include "CachedResourceHandle.h"
 #include "Timer.h"
@@ -38,26 +38,29 @@ class CachedScript;
 class Document;
 class PendingScript;
 class ScriptElement;
-    
-class AsyncScriptRunner {
-    WTF_MAKE_NONCOPYABLE(AsyncScriptRunner); WTF_MAKE_FAST_ALLOCATED;
+
+class ScriptRunner {
+    WTF_MAKE_NONCOPYABLE(ScriptRunner); WTF_MAKE_FAST_ALLOCATED;
 public:
-    static PassOwnPtr<AsyncScriptRunner> create(Document* document) { return new AsyncScriptRunner(document); }
-    ~AsyncScriptRunner();
+    static PassOwnPtr<ScriptRunner> create(Document* document) { return new ScriptRunner(document); }
+    ~ScriptRunner();
 
-    void executeScriptSoon(ScriptElement*, CachedResourceHandle<CachedScript>);
-    bool hasPendingScripts() const { return !m_scriptsToExecuteSoon.isEmpty(); }
+    enum ExecutionType { ASYNC_EXECUTION, IN_ORDER_EXECUTION };
+    void queueScriptForExecution(ScriptElement*, CachedResourceHandle<CachedScript>, ExecutionType);
+    bool hasPendingScripts() const { return !m_scriptsToExecuteSoon.isEmpty() || !m_scriptsToExecuteInOrder.isEmpty(); }
     void suspend();
     void resume();
+    void notifyInOrderScriptReady();
 
 private:
-    AsyncScriptRunner(Document*);
+    ScriptRunner(Document*);
 
-    void timerFired(Timer<AsyncScriptRunner>*);
+    void timerFired(Timer<ScriptRunner>*);
 
     Document* m_document;
+    Vector<PendingScript> m_scriptsToExecuteInOrder;
     Vector<PendingScript> m_scriptsToExecuteSoon; // http://www.whatwg.org/specs/web-apps/current-work/#set-of-scripts-that-will-execute-as-soon-as-possible
-    Timer<AsyncScriptRunner> m_timer;
+    Timer<ScriptRunner> m_timer;
 };
 
 }
index 8e708d1..b56b375 100644 (file)
@@ -58,6 +58,13 @@ void HTMLScriptElement::childrenChanged(bool changedByParser, Node* beforeChange
     HTMLElement::childrenChanged(changedByParser, beforeChange, afterChange, childCountDelta);
 }
 
+void HTMLScriptElement::attributeChanged(Attribute* attr, bool preserveDecls)
+{
+    if (attr->name() == asyncAttr)
+        handleAsyncAttribute();
+    HTMLElement::attributeChanged(attr, preserveDecls);
+}
+
 void HTMLScriptElement::parseMappedAttribute(Attribute* attr)
 {
     const QualifiedName& attrName = attr->name();
@@ -102,6 +109,17 @@ void HTMLScriptElement::setText(const String &value)
     appendChild(document()->createTextNode(value.impl()), ec);
 }
 
+void HTMLScriptElement::setAsync(bool async)
+{
+    setBooleanAttribute(asyncAttr, async);
+    handleAsyncAttribute();
+}
+
+bool HTMLScriptElement::async() const
+{
+    return fastHasAttribute(asyncAttr) || forceAsync();
+}
+
 KURL HTMLScriptElement::src() const
 {
     return document()->completeURL(sourceAttributeValue());
index efe6a6a..cbe7258 100644 (file)
@@ -38,6 +38,9 @@ public:
 
     KURL src() const;
 
+    void setAsync(bool);
+    bool async() const;
+
 private:
     HTMLScriptElement(const QualifiedName&, Document*, bool wasInsertedByParser, bool alreadyStarted);
 
@@ -45,6 +48,7 @@ private:
     virtual void insertedIntoDocument();
     virtual void removedFromDocument();
     virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
+    virtual void attributeChanged(Attribute*, bool preserveDecls = false);
 
     virtual bool isURLAttribute(Attribute*) const;
 
index 20b7331..fa799cb 100644 (file)
@@ -24,7 +24,7 @@ module html {
         attribute [Reflect=for] DOMString htmlFor;
         attribute [Reflect] DOMString event;
         attribute [Reflect] DOMString charset;
-        attribute [Reflect] boolean async;
+        attribute boolean async;
         attribute [Reflect] boolean defer;
         attribute [Reflect, URL] DOMString src;
         attribute [Reflect] DOMString type;
index dea2cd7..dfbb244 100644 (file)
 #include "config.h"
 #include "PageGroupLoadDeferrer.h"
 
-#include "AsyncScriptRunner.h"
 #include "DocumentParser.h"
 #include "Frame.h"
 #include "Page.h"
 #include "PageGroup.h"
+#include "ScriptRunner.h"
 #include <wtf/HashSet.h>
 
 namespace WebCore {
@@ -50,7 +50,7 @@ PageGroupLoadDeferrer::PageGroupLoadDeferrer(Page* page, bool deferSelf)
                 for (Frame* frame = otherPage->mainFrame(); frame; frame = frame->tree()->traverseNext()) {
                     frame->document()->suspendScriptedAnimationControllerCallbacks();
                     frame->document()->suspendActiveDOMObjects(ActiveDOMObject::WillShowDialog);
-                    frame->document()->asyncScriptRunner()->suspend();
+                    frame->document()->scriptRunner()->suspend();
                     if (DocumentParser* parser = frame->document()->parser())
                         parser->suspendScheduledTasks();
                 }
@@ -73,7 +73,7 @@ PageGroupLoadDeferrer::~PageGroupLoadDeferrer()
             for (Frame* frame = page->mainFrame(); frame; frame = frame->tree()->traverseNext()) {
                 frame->document()->resumeActiveDOMObjects();
                 frame->document()->resumeScriptedAnimationControllerCallbacks();
-                frame->document()->asyncScriptRunner()->resume();
+                frame->document()->scriptRunner()->resume();
                 if (DocumentParser* parser = frame->document()->parser())
                     parser->resumeScheduledTasks();
             }