Changeset 61607 in webkit
- Timestamp:
- Jun 22, 2010 12:56:26 AM (14 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r61606 r61607 1 2010-06-22 Adam Barth <abarth@webkit.org> 2 3 Reviewed by Eric Seidel. 4 5 Expose HTMLInputStream to ScriptRunner so that ScriptRunner can save the insertion point itself 6 https://bugs.webkit.org/show_bug.cgi?id=40975 7 8 This saves us having to call back into the HTML5DocumentParser each 9 time we need to save the insertion point. This prepares us for another 10 place we need to save the insertion point. 11 12 * html/HTML5DocumentParser.cpp: 13 * html/HTML5DocumentParser.h: 14 (WebCore::HTML5DocumentParser::inputStream): 15 * html/HTML5ScriptRunner.cpp: 16 (WebCore::HTML5ScriptRunner::executeScript): 17 (WebCore::HTML5ScriptRunner::requestScript): 18 * html/HTML5ScriptRunnerHost.h: 19 1 20 2010-06-22 Adam Barth <abarth@webkit.org> 2 21 -
trunk/WebCore/html/HTML5DocumentParser.cpp
r61604 r61607 395 395 } 396 396 397 void HTML5DocumentParser::executeScript(const ScriptSourceCode& sourceCode)398 {399 ASSERT(m_scriptRunner->inScriptExecution());400 if (!m_document->frame())401 return;402 InsertionPointRecord savedInsertionPoint(m_input);403 m_document->frame()->script()->executeScript(sourceCode);404 }405 406 bool HTML5DocumentParser::dispatchBeforeLoad(Element* script, const AtomicString& srcValue)407 {408 InsertionPointRecord savedInsertionPoint(m_input);409 return script->dispatchBeforeLoadEvent(srcValue);410 }411 412 397 void HTML5DocumentParser::notifyFinished(CachedResource* cachedResource) 413 398 { -
trunk/WebCore/html/HTML5DocumentParser.h
r61606 r61607 73 73 virtual void stopWatchingForLoad(CachedResource*); 74 74 virtual bool shouldLoadExternalScriptFromSrc(const AtomicString&); 75 virtual void executeScript(const ScriptSourceCode&); 76 virtual bool dispatchBeforeLoad(Element* script, const AtomicString& srcValue); 75 virtual HTMLInputStream& inputStream() { return m_input; } 77 76 78 77 // CachedResourceClient -
trunk/WebCore/html/HTML5ScriptRunner.cpp
r61604 r61607 34 34 #include "Frame.h" 35 35 #include "HTML5ScriptRunnerHost.h" 36 #include "HTMLInputStream.h" 36 37 #include "HTMLNames.h" 37 38 #include "NotImplemented.h" … … 136 137 if (!scriptElement->shouldExecuteAsJavaScript()) 137 138 return; 138 139 // Always use the delegate to execute the script so that it can save any 140 // necessary state to prepare for rentrancy. 141 m_host->executeScript(sourceCode); 139 ASSERT(inScriptExecution()); 140 if (!m_document->frame()) 141 return; 142 143 InsertionPointRecord savedInsertionPoint(m_host->inputStream()); 144 m_document->frame()->script()->executeScript(sourceCode); 142 145 } 143 146 … … 234 237 return; 235 238 // FIXME: We need to resolve the url relative to the element. 236 if (!m_host->dispatchBeforeLoad(script, srcValue)) 237 return; 239 { 240 InsertionPointRecord savedInsertionPoint(m_host->inputStream()); 241 if (!script->dispatchBeforeLoadEvent(srcValue)) 242 return; 243 } 238 244 m_parsingBlockingScript.element = script; 239 245 // This should correctly return 0 for empty or invalid srcValues. -
trunk/WebCore/html/HTML5ScriptRunnerHost.h
r61604 r61607 32 32 class CachedResource; 33 33 class Element; 34 class HTMLInputStream; 34 35 class ScriptSourceCode; 35 36 … … 45 46 // Implementors can block certain script loads (for XSSAuditor, etc.) 46 47 virtual bool shouldLoadExternalScriptFromSrc(const AtomicString&) = 0; 47 // Implementors should handle possible rentry before/after calling ScriptController::executeScript 48 virtual void executeScript(const ScriptSourceCode&) = 0; 49 virtual bool dispatchBeforeLoad(Element* script, const AtomicString& srcValue) = 0; 48 virtual HTMLInputStream& inputStream() = 0; 50 49 }; 51 50
Note: See TracChangeset
for help on using the changeset viewer.