void ScriptElement::executeScriptForScriptRunner(PendingScript& pendingScript) { if (auto* loadableScript = pendingScript.loadableScript()) executeScriptAndDispatchEvent(*loadableScript); else { ASSERT(!pendingScript.wasErrored()); executeScript(ScriptSourceCode(scriptContent(), m_element.document().url(), pendingScript.startingPosition())); dispatchLoadEvent(); } }
ScriptSourceCode HTMLScriptRunner::sourceFromPendingScript(const PendingScript& script, bool& errorOccurred) const { if (script.cachedScript()) { errorOccurred = script.cachedScript()->errorOccurred(); ASSERT(script.cachedScript()->isLoaded()); return ScriptSourceCode(script.cachedScript()); } errorOccurred = false; return ScriptSourceCode(script.element()->textContent(), documentURLForScriptExecution(m_document), script.startingPosition()); }