Changeset 64704 in webkit
- Timestamp:
- Aug 4, 2010 7:22:44 PM (14 years ago)
- Location:
- trunk
- Files:
-
- 25 deleted
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r64702 r64704 1 2010-08-04 Sheriff Bot <webkit.review.bot@gmail.com> 2 3 Unreviewed, rolling out r64674. 4 http://trac.webkit.org/changeset/64674 5 https://bugs.webkit.org/show_bug.cgi?id=43532 6 7 Doesn't work with HTML5 tree builder (Requested by tonyg-cr on 8 #webkit). 9 10 * fast/dom/HTMLScriptElement/defer-double-defer-write-expected.txt: Removed. 11 * fast/dom/HTMLScriptElement/defer-double-defer-write.html: Removed. 12 * fast/dom/HTMLScriptElement/defer-double-write-expected.txt: Removed. 13 * fast/dom/HTMLScriptElement/defer-double-write.html: Removed. 14 * fast/dom/HTMLScriptElement/defer-inline-script-expected.txt: Removed. 15 * fast/dom/HTMLScriptElement/defer-inline-script.html: Removed. 16 * fast/dom/HTMLScriptElement/defer-onbeforeload-expected.txt: Removed. 17 * fast/dom/HTMLScriptElement/defer-onbeforeload.html: Removed. 18 * fast/dom/HTMLScriptElement/defer-script-invalid-url-expected.txt: Removed. 19 * fast/dom/HTMLScriptElement/defer-script-invalid-url.html: Removed. 20 * fast/dom/HTMLScriptElement/resources/defer.js: Removed. 21 * fast/dom/HTMLScriptElement/resources/external.js: Removed. 22 * fast/dom/HTMLScriptElement/resources/shouldnotexecute.js: Removed. 23 * http/tests/misc/resources/defer-script.js: Removed. 24 * http/tests/misc/resources/external-script.js: Removed. 25 * http/tests/misc/resources/script-debug-body-background.js: Removed. 26 * http/tests/misc/resources/script-write-slow-stylesheet.js: Removed. 27 * http/tests/misc/resources/slow-defer-script.cgi: Removed. 28 * http/tests/misc/resources/slow-stylesheet.cgi: Removed. 29 * http/tests/misc/script-defer-after-slow-stylesheet-expected.txt: Removed. 30 * http/tests/misc/script-defer-after-slow-stylesheet.html: Removed. 31 * http/tests/misc/script-defer-expected.txt: Removed. 32 * http/tests/misc/script-defer-write-slow-stylesheet-expected.txt: Removed. 33 * http/tests/misc/script-defer-write-slow-stylesheet.html: Removed. 34 * http/tests/misc/script-defer.html: Removed. 35 1 36 2010-08-04 Adam Barth <abarth@webkit.org> 2 37 -
trunk/WebCore/ChangeLog
r64702 r64704 1 2010-08-04 Sheriff Bot <webkit.review.bot@gmail.com> 2 3 Unreviewed, rolling out r64674. 4 http://trac.webkit.org/changeset/64674 5 https://bugs.webkit.org/show_bug.cgi?id=43532 6 7 Doesn't work with HTML5 tree builder (Requested by tonyg-cr on 8 #webkit). 9 10 * html/HTMLDocumentParser.cpp: 11 (WebCore::HTMLDocumentParser::attemptToEnd): 12 (WebCore::HTMLDocumentParser::endIfDelayed): 13 * html/HTMLDocumentParser.h: 14 * html/HTMLScriptRunner.cpp: 15 (WebCore::HTMLScriptRunner::requestScript): 16 (WebCore::HTMLScriptRunner::runScript): 17 * html/HTMLScriptRunner.h: 18 1 19 2010-08-04 Adam Barth <abarth@webkit.org> 2 20 -
trunk/WebCore/html/HTMLDocumentParser.cpp
r64674 r64704 282 282 return; 283 283 } 284 e xecuteScriptsWaitingForParsingAndEnd();284 end(); 285 285 } 286 286 … … 291 291 292 292 m_endWasDelayed = false; 293 executeScriptsWaitingForParsingAndEnd();294 }295 296 void HTMLDocumentParser::executeScriptsWaitingForParsingAndEnd()297 {298 if (m_scriptRunner) {299 bool continueParsing = m_scriptRunner->executeScriptsWaitingForParsing();300 if (!continueParsing) {301 m_treeBuilder->setPaused(true);302 m_endWasDelayed = true;303 return;304 }305 }306 293 end(); 307 294 } -
trunk/WebCore/html/HTMLDocumentParser.h
r64674 r64704 106 106 void attemptToEnd(); 107 107 void endIfDelayed(); 108 void executeScriptsWaitingForParsingAndEnd();109 108 void end(); 110 109 -
trunk/WebCore/html/HTMLScriptRunner.cpp
r64674 r64704 229 229 } 230 230 231 bool HTMLScriptRunner::executeScriptsWaitingForParsing() 232 { 233 while (!m_scriptsToExecuteAfterParsing.isEmpty()) { 234 ASSERT(!haveParsingBlockingScript()); 235 m_parsingBlockingScript = m_scriptsToExecuteAfterParsing.takeFirst(); 236 ASSERT(m_parsingBlockingScript.cachedScript()); 237 if (!m_parsingBlockingScript.cachedScript()->isLoaded()) { 238 watchForLoad(m_parsingBlockingScript); 239 return false; 240 } 241 if (!executeParsingBlockingScripts()) 242 return false; 243 } 244 245 return m_scriptsToExecuteAfterParsing.isEmpty(); 246 } 247 248 bool HTMLScriptRunner::requestScript(PendingScript& pendingScript, Element* scriptElement) 249 { 250 ASSERT(!pendingScript.element); 251 const AtomicString& srcValue = scriptElement->getAttribute(srcAttr); 231 void HTMLScriptRunner::requestScript(Element* script) 232 { 233 ASSERT(!m_parsingBlockingScript.element); 234 AtomicString srcValue = script->getAttribute(srcAttr); 235 // Allow the host to disllow script loads (using the XSSAuditor, etc.) 252 236 if (!m_host->shouldLoadExternalScriptFromSrc(srcValue)) 253 return false;237 return; 254 238 // FIXME: We need to resolve the url relative to the element. 255 if (!script Element->dispatchBeforeLoadEvent(srcValue))256 return false;257 pendingScript.element = scriptElement;239 if (!script->dispatchBeforeLoadEvent(srcValue)) 240 return; 241 m_parsingBlockingScript.element = script; 258 242 // This should correctly return 0 for empty or invalid srcValues. 259 CachedScript* cachedScript = m_document->docLoader()->requestScript(srcValue, toScriptElement(script Element)->scriptCharset());243 CachedScript* cachedScript = m_document->docLoader()->requestScript(srcValue, toScriptElement(script)->scriptCharset()); 260 244 if (!cachedScript) { 261 245 notImplemented(); // Dispatch error event. 262 return false; 263 } 264 265 pendingScript.setCachedScript(cachedScript); 266 return true; 267 } 268 269 void HTMLScriptRunner::requestParsingBlockingScript(Element* scriptElement) 270 { 271 if (!requestScript(m_parsingBlockingScript, scriptElement)) 272 return; 273 274 ASSERT(m_parsingBlockingScript.cachedScript()); 246 return; 247 } 248 249 m_parsingBlockingScript.setCachedScript(cachedScript); 275 250 276 251 // We only care about a load callback if cachedScript is not already … … 281 256 } 282 257 283 void HTMLScriptRunner::requestDeferredScript(Element* scriptElement)284 {285 PendingScript pendingScript;286 if (!requestScript(pendingScript, scriptElement))287 return;288 289 ASSERT(pendingScript.cachedScript());290 m_scriptsToExecuteAfterParsing.append(pendingScript);291 }292 293 258 // This method is meant to match the HTML5 definition of "running a script" 294 259 // http://www.whatwg.org/specs/web-apps/current-work/multipage/scripting-1.html#running-a-script … … 303 268 304 269 if (script->hasAttribute(srcAttr)) { 305 // FIXME: Handle async 306 if (script->hasAttribute(deferAttr)) 307 requestDeferredScript(script); 308 else 309 requestParsingBlockingScript(script); 270 // FIXME: Handle defer and async 271 requestScript(script); 310 272 } else { 311 273 // FIXME: We do not block inline <script> tags on stylesheets to match the -
trunk/WebCore/html/HTMLScriptRunner.h
r64674 r64704 29 29 #include "CachedResourceClient.h" 30 30 #include "CachedResourceHandle.h" 31 #include <wtf/Deque.h>32 31 #include <wtf/Noncopyable.h> 33 32 #include <wtf/PassRefPtr.h> … … 54 53 bool hasScriptsWaitingForStylesheets() const { return m_hasScriptsWaitingForStylesheets; } 55 54 bool executeScriptsWaitingForStylesheets(); 56 bool executeScriptsWaitingForParsing();57 55 58 56 bool isExecutingScript() { return !!m_scriptNestingLevel; } … … 66 64 // 67 65 // FIXME: Finish turning this into a proper class. 68 class PendingScript : public CachedResourceClient {66 class PendingScript : public CachedResourceClient, Noncopyable { 69 67 public: 70 68 PendingScript() … … 72 70 , m_watchingForLoad(false) 73 71 { 74 }75 76 PendingScript(const PendingScript& other)77 : CachedResourceClient(other)78 , element(other.element)79 , startingLineNumber(other.startingLineNumber)80 , m_watchingForLoad(other.m_watchingForLoad)81 {82 setCachedScript(other.cachedScript());83 }84 85 PendingScript& operator=(const PendingScript& other)86 {87 if (this == &other)88 return *this;89 90 element = other.element;91 startingLineNumber = other.startingLineNumber;92 m_watchingForLoad = other.m_watchingForLoad;93 setCachedScript(other.cachedScript());94 95 return *this;96 72 } 97 73 … … 126 102 void executePendingScript(); 127 103 128 bool requestScript(PendingScript&, Element*); 129 void requestParsingBlockingScript(Element*); 130 void requestDeferredScript(Element*); 104 void requestScript(Element*); 131 105 void runScript(Element*, int startingLineNumber); 132 106 … … 142 116 HTMLScriptRunnerHost* m_host; 143 117 PendingScript m_parsingBlockingScript; 144 Deque<PendingScript> m_scriptsToExecuteAfterParsing;145 118 unsigned m_scriptNestingLevel; 146 119
Note: See TracChangeset
for help on using the changeset viewer.