void XMLHttpRequest::callReadyStateChangeListener() { if (!m_doc || !m_doc->frame()) return; dispatchReadyStateChangeEvent(); if (m_state == DONE) dispatchLoadEvent(); }
void XMLHttpRequest::callReadyStateChangeListener() { if (!scriptExecutionContext()) return; dispatchReadyStateChangeEvent(); if (m_state == DONE) dispatchLoadEvent(); }
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(); } }
void ImageLoader::dispatchPendingLoadEvent() { if (m_firedLoad) return; if (!m_image) return; if (!m_element->document()->attached()) return; m_firedLoad = true; dispatchLoadEvent(); }
void ScriptElement::execute(CachedScript* cachedScript) { ASSERT(!m_willBeParserExecuted); ASSERT(cachedScript); if (cachedScript->errorOccurred()) dispatchErrorEvent(); else if (!cachedScript->wasCanceled()) { executeScript(ScriptSourceCode(cachedScript)); dispatchLoadEvent(); } cachedScript->removeClient(this); }
void ScriptElement::executeScriptAndDispatchEvent(LoadableScript& loadableScript) { if (Optional<LoadableScript::Error> error = loadableScript.wasErrored()) { if (Optional<LoadableScript::ConsoleMessage> message = error->consoleMessage) m_element.document().addConsoleMessage(message->source, message->level, message->message); dispatchErrorEvent(); } else if (!loadableScript.wasCanceled()) { ASSERT(!loadableScript.wasErrored()); loadableScript.execute(*this); dispatchLoadEvent(); } }
void ScriptLoader::execute(ScriptResource* resource) { ASSERT(!m_willBeParserExecuted); ASSERT(resource); if (resource->errorOccurred()) { dispatchErrorEvent(); } else if (!resource->wasCanceled()) { executeScript(ScriptSourceCode(resource)); dispatchLoadEvent(); } resource->removeClient(this); }
void ImageLoader::dispatchPendingLoadEvent() { if (!m_hasPendingLoadEvent) return; if (!m_image) return; m_hasPendingLoadEvent = false; if (element()->document()->attached()) dispatchLoadEvent(); // Only consider updating the protection ref-count of the Element immediately before returning // from this function as doing so might result in the destruction of this ImageLoader. updatedHasPendingEvent(); }
void ScriptLoader::execute() { ASSERT(!m_willBeParserExecuted); ASSERT(m_pendingScript.resource()); bool errorOccurred = false; ScriptSourceCode source = m_pendingScript.getSource(KURL(), errorOccurred); RefPtrWillBeRawPtr<Element> element = m_pendingScript.releaseElementAndClear(); ALLOW_UNUSED_LOCAL(element); if (errorOccurred) { dispatchErrorEvent(); } else if (!m_resource->wasCanceled()) { executeScript(source); dispatchLoadEvent(); } m_resource = 0; }
void ScriptLoader::execute() { DCHECK(!m_willBeParserExecuted); DCHECK(m_asyncExecType != ScriptRunner::None); DCHECK(m_pendingScript->resource()); bool errorOccurred = false; ScriptSourceCode source = m_pendingScript->getSource(KURL(), errorOccurred); m_pendingScript->dispose(); if (errorOccurred) { dispatchErrorEvent(); } else if (!m_resource->wasCanceled()) { if (executeScript(source)) dispatchLoadEvent(); else dispatchErrorEvent(); } m_resource = nullptr; }
void ScriptLoader::execute() { DCHECK(!m_willBeParserExecuted); DCHECK(m_pendingScript->resource()); bool errorOccurred = false; ScriptSourceCode source = m_pendingScript->getSource(KURL(), errorOccurred); Element* element = m_pendingScript->releaseElementAndClear(); ALLOW_UNUSED_LOCAL(element); if (errorOccurred) { dispatchErrorEvent(); } else if (!m_resource->wasCanceled()) { if (executeScript(source)) dispatchLoadEvent(); else dispatchErrorEvent(); } m_resource = nullptr; }