Changeset 67163 in webkit
- Timestamp:
- Sep 9, 2010 9:30:51 PM (14 years ago)
- Location:
- trunk
- Files:
-
- 13 added
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r67162 r67163 1 2010-09-09 Tony Gentilcore <tonyg@chromium.org> 2 3 Reviewed by Adam Barth. 4 5 Support <script async> as specified by HTML5 6 https://bugs.webkit.org/show_bug.cgi?id=45310 7 8 * fast/dom/Document/readystate.html: Dynamically inserted scripts now block the load event like in FF4. So move the finishJSTest call to load. 9 * fast/dom/Document/readystate-expected.txt: Dynamically inserted script now runs before load during "interactive" phase. 10 * fast/dom/HTMLScriptElement/async-inline-script-expected.txt: Added. 11 * fast/dom/HTMLScriptElement/async-inline-script.html: Added. The async attribute doesn't apply to inline scripts, so check that they execute in order. 12 * fast/dom/HTMLScriptElement/async-onbeforeload-expected.txt: Added. 13 * fast/dom/HTMLScriptElement/async-onbeforeload.html: Added. Check that onbeforeload events fire synchronously and that they may be cancelled. 14 * fast/dom/HTMLScriptElement/async-write-expected.txt: Added. 15 * fast/dom/HTMLScriptElement/async-write.html: Added. Check that writes from async scripts are neutralized. 16 * fast/dom/HTMLScriptElement/resources/async.js: Added. 17 * http/tests/misc/async-and-defer-script-expected.txt: Added. 18 * http/tests/misc/async-and-defer-script.html: Added. The async attributes takes precendence over the defer attribute. 19 Check that a script which has both async and defer acts as async by ensuring it loads after DOMContentLoaded. 20 A deferred scripts would block DCL. 21 * http/tests/misc/resources/async-script.js: Added. 22 * http/tests/misc/resources/slow-async-script.cgi: Added. 23 * http/tests/misc/script-async-expected.txt: Added. 24 * http/tests/misc/script-async.html: Added. Test general execution order of deferred scripts. 25 The test checks for multiple valid orders since it is indeterminate. 26 1 27 2010-09-09 Dirk Pranke <dpranke@chromium.org> 2 28 -
trunk/LayoutTests/fast/dom/Document/readystate-expected.txt
r66841 r67163 4 4 PASS document.readyState is "interactive" 5 5 PASS document.readyState is "interactive" 6 PASS document.readyState is " complete"6 PASS document.readyState is "interactive" 7 7 PASS document.readyState is "complete" 8 8 PASS successfullyParsed is true -
trunk/LayoutTests/fast/dom/Document/readystate.html
r66841 r67163 5 5 <script src="../../js/resources/js-test-pre.js"></script> 6 6 </head> 7 <body onload="shouldBeEqualToString('document.readyState', 'complete'); ">7 <body onload="shouldBeEqualToString('document.readyState', 'complete');finishJSTest();"> 8 8 Tests that the document's readyState is set properly at various phases during load. 9 9 <div id="console"></div> … … 19 19 20 20 var el = document.createElement('script'); 21 el.src = "data:text/javascript,shouldBeEqualToString('document.readyState', 'complete');"; 22 el.onload = function() { finishJSTest(); } 21 el.src = "data:text/javascript,shouldBeEqualToString('document.readyState', 'interactive');"; 23 22 document.getElementsByTagName('head')[0].appendChild(el); 24 23 }, false); -
trunk/WebCore/ChangeLog
r67161 r67163 1 2010-09-09 Tony Gentilcore <tonyg@chromium.org> 2 3 Reviewed by Adam Barth. 4 5 Support <script async> as specified by HTML5 6 https://bugs.webkit.org/show_bug.cgi?id=45310 7 8 Tests: fast/dom/HTMLScriptElement/async-inline-script.html 9 fast/dom/HTMLScriptElement/async-onbeforeload.html 10 fast/dom/HTMLScriptElement/async-write.html 11 http/tests/misc/async-and-defer-script.html 12 http/tests/misc/script-async.html 13 14 * dom/AsyncScriptRunner.cpp: 15 (WebCore::AsyncScriptRunner::AsyncScriptRunner): 16 (WebCore::AsyncScriptRunner::~AsyncScriptRunner): 17 (WebCore::AsyncScriptRunner::executeScriptSoon): Increment the delay count when a task to execute scripts is queued up. 18 (WebCore::AsyncScriptRunner::timerFired): decrementLoadEventDelayCount handles calling checkCompleted(). 19 * dom/AsyncScriptRunner.h: 20 (WebCore::AsyncScriptRunner::create): 21 * dom/Document.cpp: 22 (WebCore::Document::Document): 23 * dom/ScriptElement.cpp: 24 (WebCore::ScriptElement::insertedIntoDocument): Treats async scripts just like a dynamically inserted script element rather than a parser inserted one. 25 * html/parser/HTMLScriptRunner.cpp: 26 (WebCore::HTMLScriptRunner::runScript): 27 1 28 2010-09-09 Alexey Marinichev <amarinichev@chromium.org> 2 29 -
trunk/WebCore/dom/AsyncScriptRunner.cpp
r64873 r67163 28 28 29 29 #include "CachedScript.h" 30 #include "Document.h" 30 31 #include "Element.h" 31 32 #include "ScriptElement.h" … … 33 34 namespace WebCore { 34 35 35 AsyncScriptRunner::AsyncScriptRunner() 36 : m_timer(this, &AsyncScriptRunner::timerFired) 36 AsyncScriptRunner::AsyncScriptRunner(Document* document) 37 : m_document(document) 38 , m_timer(this, &AsyncScriptRunner::timerFired) 37 39 { 40 ASSERT(document); 38 41 } 39 42 40 43 AsyncScriptRunner::~AsyncScriptRunner() 41 44 { 42 for (size_t i = 0; i < m_scriptsToExecuteSoon.size(); ++i) 43 m_scriptsToExecuteSoon[i].first->element()->deref(); // Balances ref() in executeScriptSoon(). 45 for (size_t i = 0; i < m_scriptsToExecuteSoon.size(); ++i) { 46 m_scriptsToExecuteSoon[i].first->element()->deref(); // Balances ref() in executeScriptSoon(). 47 m_document->decrementLoadEventDelayCount(); 48 } 44 49 } 45 50 … … 52 57 ASSERT(element->inDocument()); 53 58 59 m_document->incrementLoadEventDelayCount(); 54 60 m_scriptsToExecuteSoon.append(make_pair(data, cachedScript)); 55 61 element->ref(); // Balanced by deref()s in timerFired() and dtor. … … 79 85 scripts[i].first->execute(scripts[i].second.get()); 80 86 scripts[i].first->element()->deref(); // Balances ref() in executeScriptSoon(). 87 m_document->decrementLoadEventDelayCount(); 81 88 } 82 89 } -
trunk/WebCore/dom/AsyncScriptRunner.h
r64873 r67163 36 36 37 37 class CachedScript; 38 class Document; 38 39 class ScriptElementData; 39 40 40 41 class AsyncScriptRunner : public Noncopyable { 41 42 public: 42 static PassOwnPtr<AsyncScriptRunner> create( ) { return new AsyncScriptRunner(); }43 static PassOwnPtr<AsyncScriptRunner> create(Document* document) { return new AsyncScriptRunner(document); } 43 44 ~AsyncScriptRunner(); 44 45 … … 49 50 50 51 private: 51 AsyncScriptRunner( );52 AsyncScriptRunner(Document*); 52 53 53 54 void timerFired(Timer<AsyncScriptRunner>*); 54 55 56 Document* m_document; 55 57 Vector<std::pair<ScriptElementData*, CachedResourceHandle<CachedScript> > > m_scriptsToExecuteSoon; 56 58 Timer<AsyncScriptRunner> m_timer; -
trunk/WebCore/dom/Document.cpp
r66963 r67163 372 372 , m_overMinimumLayoutThreshold(false) 373 373 , m_extraLayoutDelay(0) 374 , m_asyncScriptRunner(AsyncScriptRunner::create( ))374 , m_asyncScriptRunner(AsyncScriptRunner::create(this)) 375 375 , m_xmlVersion("1.0") 376 376 , m_xmlStandalone(false) -
trunk/WebCore/dom/ScriptElement.cpp
r66963 r67163 53 53 void ScriptElement::insertedIntoDocument(ScriptElementData& data, const String& sourceUrl) 54 54 { 55 if (data.createdByParser() )55 if (data.createdByParser() && !data.isAsynchronous()) 56 56 return; 57 57 -
trunk/WebCore/html/parser/HTMLScriptRunner.cpp
r66963 r67163 322 322 323 323 if (script->hasAttribute(srcAttr)) { 324 // FIXME: Handle async. 324 if (script->hasAttribute(asyncAttr)) // Async takes precendence over defer. 325 return; // Asynchronous scripts handle themselves. 326 325 327 if (script->hasAttribute(deferAttr)) 326 328 requestDeferredScript(script);
Note: See TracChangeset
for help on using the changeset viewer.