• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ dispatchErrorEvent函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中dispatchErrorEvent函数的典型用法代码示例。如果您正苦于以下问题:C++ dispatchErrorEvent函数的具体用法?C++ dispatchErrorEvent怎么用?C++ dispatchErrorEvent使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了dispatchErrorEvent函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: originalDocument

bool ScriptElement::requestScript(const String& sourceUrl)
{
    Ref<Document> originalDocument(m_element->document());
    if (!m_element->dispatchBeforeLoadEvent(sourceUrl))
        return false;
    if (!m_element->inDocument() || &m_element->document() != &originalDocument.get())
        return false;
    if (!m_element->document().contentSecurityPolicy()->allowScriptNonce(m_element->fastGetAttribute(HTMLNames::nonceAttr), m_element->document().url(), m_startLineNumber, m_element->document().completeURL(sourceUrl)))
        return false;

    ASSERT(!m_cachedScript);
    if (!stripLeadingAndTrailingHTMLSpaces(sourceUrl).isEmpty()) {
        CachedResourceRequest request(ResourceRequest(m_element->document().completeURL(sourceUrl)));

        String crossOriginMode = m_element->fastGetAttribute(HTMLNames::crossoriginAttr);
        if (!crossOriginMode.isNull()) {
            m_requestUsesAccessControl = true;
            StoredCredentials allowCredentials = equalIgnoringCase(crossOriginMode, "use-credentials") ? AllowStoredCredentials : DoNotAllowStoredCredentials;
            updateRequestForAccessControl(request.mutableResourceRequest(), m_element->document().securityOrigin(), allowCredentials);
        }
        request.setCharset(scriptCharset());
        request.setInitiator(element());

        m_cachedScript = m_element->document().cachedResourceLoader()->requestScript(request);
        m_isExternalScript = true;
    }

    if (m_cachedScript) {
        return true;
    }

    dispatchErrorEvent();
    return false;
}
开发者ID:CannedFish,项目名称:webkitgtk,代码行数:34,代码来源:ScriptElement.cpp


示例2: ASSERT

void ScriptLoader::notifyFinished(Resource* resource)
{
    ASSERT(!m_willBeParserExecuted);

    RefPtrWillBeRawPtr<Document> elementDocument(m_element->document());
    RefPtrWillBeRawPtr<Document> contextDocument = elementDocument->contextDocument().get();
    if (!contextDocument)
        return;

    ASSERT_UNUSED(resource, resource == m_resource);

    ScriptRunner::ExecutionType runOrder = m_willExecuteInOrder ? ScriptRunner::IN_ORDER_EXECUTION : ScriptRunner::ASYNC_EXECUTION;
    if (m_resource->errorOccurred()) {
        dispatchErrorEvent();
        // The error handler can move the HTMLScriptElement to a new document.
        // In that case, we must notify the ScriptRunner of the new document,
        // not the ScriptRunner of the old docuemnt.
        contextDocument = m_element->document().contextDocument().get();
        if (!contextDocument)
            return;
        contextDocument->scriptRunner()->notifyScriptLoadError(this, runOrder);
        return;
    }
    contextDocument->scriptRunner()->notifyScriptReady(this, runOrder);
    m_pendingScript.stopWatchingForLoad(this);
}
开发者ID:somoso,项目名称:chromium-crosswalk,代码行数:26,代码来源:ScriptLoader.cpp


示例3: scope

// https://html.spec.whatwg.org/multipage/scripting.html#upgrades
bool ScriptCustomElementDefinition::runConstructor(Element* element) {
  if (!m_scriptState->contextIsValid())
    return false;
  ScriptState::Scope scope(m_scriptState.get());
  v8::Isolate* isolate = m_scriptState->isolate();

  // Step 5 says to rethrow the exception; but there is no one to
  // catch it. The side effect is to report the error.
  v8::TryCatch tryCatch(isolate);
  tryCatch.SetVerbose(true);

  Element* result = runConstructor();

  // To report exception thrown from runConstructor()
  if (tryCatch.HasCaught())
    return false;

  // To report InvalidStateError Exception, when the constructor returns some
  // different object
  if (result != element) {
    const String& message =
        "custom element constructors must call super() first and must "
        "not return a different object";
    v8::Local<v8::Value> exception = V8ThrowException::createDOMException(
        m_scriptState->isolate(), InvalidStateError, message);
    dispatchErrorEvent(isolate, exception, constructor());
    return false;
  }

  return true;
}
开发者ID:ollie314,项目名称:chromium,代码行数:32,代码来源:ScriptCustomElementDefinition.cpp


示例4: ASSERT

void ScriptElement::notifyFinished(CachedResource* resource)
{
    ASSERT(!m_willBeParserExecuted);

    // CachedResource possibly invokes this notifyFinished() more than
    // once because ScriptElement doesn't unsubscribe itself from
    // CachedResource here and does it in execute() instead.
    // We use m_cachedScript to check if this function is already called.
    ASSERT_UNUSED(resource, resource == m_cachedScript);
    if (!m_cachedScript)
        return;

    if (m_requestUsesAccessControl
        && !m_element->document()->securityOrigin()->canRequest(m_cachedScript->response().url())
        && !m_cachedScript->passesAccessControlCheck(m_element->document()->securityOrigin())) {

        dispatchErrorEvent();
        DEFINE_STATIC_LOCAL(String, consoleMessage, (ASCIILiteral("Cross-origin script load denied by Cross-Origin Resource Sharing policy.")));
        m_element->document()->addConsoleMessage(JSMessageSource, ErrorMessageLevel, consoleMessage);
        return;
    }

    if (m_willExecuteInOrder)
        m_element->document()->scriptRunner()->notifyScriptReady(this, ScriptRunner::IN_ORDER_EXECUTION);
    else
        m_element->document()->scriptRunner()->notifyScriptReady(this, ScriptRunner::ASYNC_EXECUTION);

    m_cachedScript = 0;
}
开发者ID:jbat100,项目名称:webkit,代码行数:29,代码来源:ScriptElement.cpp


示例5: ASSERT

bool ScriptElement::requestScript(const String& sourceUrl)
{
    RefPtr<Document> originalDocument = m_element->document();
    if (!m_element->dispatchBeforeLoadEvent(sourceUrl))
        return false;
    if (!m_element->inDocument() || m_element->document() != originalDocument)
        return false;

    ASSERT(!m_cachedScript);
    if (!stripLeadingAndTrailingHTMLSpaces(sourceUrl).isEmpty()) {
        ResourceRequest request(m_element->document()->completeURL(sourceUrl));
        m_cachedScript = m_element->document()->cachedResourceLoader()->requestScript(request, scriptCharset());
        m_isExternalScript = true;
    }

    if (m_cachedScript) {
#if PLATFORM(CHROMIUM)      
        ASSERT(m_cachedScriptState == NeverSet);
        m_cachedScriptState = Set;
#endif
        return true;
    }

    dispatchErrorEvent();
    return false;
}
开发者ID:sysrqb,项目名称:chromium-src,代码行数:26,代码来源:ScriptElement.cpp


示例6: ASSERT

bool ScriptElement::requestScript(const String& sourceUrl)
{
    RefPtr<Document> originalDocument = m_element->document();
    if (!m_element->dispatchBeforeLoadEvent(sourceUrl))
        return false;
    if (!m_element->inDocument() || m_element->document() != originalDocument)
        return false;

    ASSERT(!m_cachedScript);
    if (!stripLeadingAndTrailingHTMLSpaces(sourceUrl).isEmpty()) {
        ResourceRequest request = ResourceRequest(m_element->document()->completeURL(sourceUrl));

        String crossOriginMode = m_element->fastGetAttribute(HTMLNames::crossoriginAttr);
        if (!crossOriginMode.isNull()) {
            m_requestUsesAccessControl = true;
            StoredCredentials allowCredentials = equalIgnoringCase(crossOriginMode, "use-credentials") ? AllowStoredCredentials : DoNotAllowStoredCredentials;
            updateRequestForAccessControl(request, m_element->document()->securityOrigin(), allowCredentials);
        }

        m_cachedScript = m_element->document()->cachedResourceLoader()->requestScript(request, scriptCharset());
        m_isExternalScript = true;
    }

    if (m_cachedScript) {
        return true;
    }

    dispatchErrorEvent();
    return false;
}
开发者ID:Spencerx,项目名称:webkit,代码行数:30,代码来源:ScriptElement.cpp


示例7: ASSERT

bool ScriptLoader::fetchScript(const String& sourceUrl, FetchRequest::DeferOption defer)
{
    ASSERT(m_element);

    RefPtrWillBeRawPtr<Document> elementDocument(m_element->document());
    if (!m_element->inDocument() || m_element->document() != elementDocument)
        return false;

    ASSERT(!m_resource);
    if (!stripLeadingAndTrailingHTMLSpaces(sourceUrl).isEmpty()) {
        FetchRequest request(ResourceRequest(elementDocument->completeURL(sourceUrl)), m_element->localName());

        AtomicString crossOriginMode = m_element->fastGetAttribute(HTMLNames::crossoriginAttr);
        if (!crossOriginMode.isNull())
            request.setCrossOriginAccessControl(elementDocument->securityOrigin(), crossOriginMode);
        request.setCharset(scriptCharset());

        bool scriptPassesCSP = elementDocument->contentSecurityPolicy()->allowScriptWithNonce(m_element->fastGetAttribute(HTMLNames::nonceAttr));
        if (scriptPassesCSP)
            request.setContentSecurityCheck(DoNotCheckContentSecurityPolicy);
        request.setDefer(defer);

        m_resource = elementDocument->fetcher()->fetchScript(request);
        m_isExternalScript = true;
    }

    if (m_resource)
        return true;

    dispatchErrorEvent();
    return false;
}
开发者ID:eth-srl,项目名称:BlinkER,代码行数:32,代码来源:ScriptLoader.cpp


示例8: DCHECK

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;
}
开发者ID:endlessm,项目名称:chromium-browser,代码行数:18,代码来源:ScriptLoader.cpp


示例9: genericError

void XMLHttpRequest::networkError()
{
    genericError();
    dispatchErrorEvent();
    if (!m_uploadComplete) {
        m_uploadComplete = true;
        if (m_upload)
            m_upload->dispatchErrorEvent();
    }
}
开发者ID:Czerrr,项目名称:ISeeBrowser,代码行数:10,代码来源:XMLHttpRequest.cpp


示例10: genericError

void XMLHttpRequest::networkError()
{
    genericError();
    dispatchErrorEvent();
    if (!m_uploadComplete) {
        m_uploadComplete = true;
        if (m_upload && m_uploadEventsAllowed)
            m_upload->dispatchErrorEvent();
    }
    internalAbort();
}
开发者ID:jackiekaon,项目名称:owb-mirror,代码行数:11,代码来源:XMLHttpRequest.cpp


示例11: ASSERT

void Notification::taskTimerFired(Timer<Notification>* timer)
{
    ASSERT(scriptExecutionContext()->isDocument());
    ASSERT(static_cast<Document*>(scriptExecutionContext())->page());
    ASSERT_UNUSED(timer, timer == m_taskTimer.get());
    if (NotificationController::from(static_cast<Document*>(scriptExecutionContext())->page())->client()->checkPermission(scriptExecutionContext()) != NotificationClient::PermissionAllowed) {
        dispatchErrorEvent();
        return;
    }
    show();
}
开发者ID:Moondee,项目名称:Artemis,代码行数:11,代码来源:Notification.cpp


示例12: DCHECK_EQ

void Notification::prepareShow() {
  DCHECK_EQ(m_state, State::Loading);
  if (NotificationManager::from(getExecutionContext())->permissionStatus() !=
      mojom::blink::PermissionStatus::GRANTED) {
    dispatchErrorEvent();
    return;
  }

  m_loader = new NotificationResourcesLoader(
      WTF::bind(&Notification::didLoadResources, wrapWeakPersistent(this)));
  m_loader->start(getExecutionContext(), m_data);
}
开发者ID:ollie314,项目名称:chromium,代码行数:12,代码来源:Notification.cpp


示例13: RESOURCE_LOADING_DVLOG

void ImageLoader::imageNotifyFinished(ImageResource* resource) {
    RESOURCE_LOADING_DVLOG(1)
            << "ImageLoader::imageNotifyFinished " << this
            << "; m_hasPendingLoadEvent=" << m_hasPendingLoadEvent;

    DCHECK(m_failedLoadURL.isEmpty());
    DCHECK_EQ(resource, m_image.get());

    m_imageComplete = true;

    // Update ImageAnimationPolicy for m_image.
    if (m_image)
        m_image->updateImageAnimationPolicy();

    updateLayoutObject();

    if (m_image && m_image->getImage() && m_image->getImage()->isSVGImage())
        toSVGImage(m_image->getImage())->updateUseCounters(element()->document());

    if (!m_hasPendingLoadEvent)
        return;

    if (resource->errorOccurred()) {
        loadEventSender().cancelEvent(this);
        m_hasPendingLoadEvent = false;

        if (resource->resourceError().isAccessCheck()) {
            crossSiteOrCSPViolationOccurred(
                AtomicString(resource->resourceError().failingURL()));
        }

        // The error event should not fire if the image data update is a result of
        // environment change.
        // https://html.spec.whatwg.org/multipage/embedded-content.html#the-img-element:the-img-element-55
        if (!m_suppressErrorEvents)
            dispatchErrorEvent();

        // 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();
        return;
    }
    if (resource->wasCanceled()) {
        m_hasPendingLoadEvent = false;
        // 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();
        return;
    }
    loadEventSender().dispatchEventSoon(this);
}
开发者ID:ollie314,项目名称:chromium,代码行数:53,代码来源:ImageLoader.cpp


示例14: ASSERT

void Notification::show()
{
    ASSERT(m_state == NotificationStateIdle);
    if (!toDocument(executionContext())->page())
        return;

    if (m_client->checkPermission(executionContext()) != NotificationClient::PermissionAllowed) {
        dispatchErrorEvent();
        return;
    }

    if (m_client->show(this))
        m_state = NotificationStateShowing;
}
开发者ID:RobinWuDev,项目名称:Qt,代码行数:14,代码来源:Notification.cpp


示例15: ASSERT

void Notification::show()
{
    ASSERT(m_state == NotificationStateIdle);
    if (Notification::checkPermission(executionContext()) != WebNotificationPermissionAllowed) {
        dispatchErrorEvent();
        return;
    }

    SecurityOrigin* origin = executionContext()->securityOrigin();
    ASSERT(origin);

    notificationManager()->show(WebSecurityOrigin(origin), m_data, this);

    m_state = NotificationStateShowing;
}
开发者ID:shaoboyan,项目名称:chromium-crosswalk,代码行数:15,代码来源:Notification.cpp


示例16: dispatchErrorEvent

void Notification::show()
{
    // prevent double-showing
    if (m_state == Idle) {
        if (!toDocument(scriptExecutionContext())->page())
            return;
        if (NotificationController::from(toDocument(scriptExecutionContext())->page())->client()->checkPermission(scriptExecutionContext()) != NotificationClient::PermissionAllowed) {
            dispatchErrorEvent();
            return;
        }
        if (m_notificationClient->show(this)) {
            m_state = Showing;
            setPendingActivity(this);
        }
    }
}
开发者ID:huningxin,项目名称:blink-crosswalk,代码行数:16,代码来源:Notification.cpp


示例17: ASSERT

void Worker::notifyFinished(CachedResource* resource)
{
    ASSERT(resource == m_cachedScript.get());
    if (m_cachedScript->errorOccurred())
        dispatchErrorEvent();
    else {
        String userAgent = document()->frame() ? document()->frame()->loader()->userAgent(m_scriptURL) : String();
        RefPtr<WorkerThread> thread = WorkerThread::create(m_scriptURL, userAgent, m_cachedScript->script(), m_messagingProxy);
        m_messagingProxy->workerThreadCreated(thread);
        thread->start();
    }

    m_cachedScript->removeClient(this);
    m_cachedScript = 0;

    unsetPendingActivity(this);
}
开发者ID:jackiekaon,项目名称:owb-mirror,代码行数:17,代码来源:Worker.cpp


示例18: ENABLE

void Notification::show() 
{
    // prevent double-showing
    if (m_state == Idle && m_notificationCenter->client()) {
#if ENABLE(NOTIFICATIONS)
        if (!downcast<Document>(*scriptExecutionContext()).page())
            return;
        if (NotificationController::from(downcast<Document>(*scriptExecutionContext()).page())->client()->checkPermission(scriptExecutionContext()) != NotificationClient::PermissionAllowed) {
            dispatchErrorEvent();
            return;
        }
#endif
        if (m_notificationCenter->client()->show(this)) {
            m_state = Showing;
            setPendingActivity(this);
        }
    }
}
开发者ID:clbr,项目名称:webkitfltk,代码行数:18,代码来源:Notification.cpp


示例19: ASSERT

void ScriptLoader::finishLoading(Document* contextDocument, ScriptLoader::FinishType type)
{
    ASSERT(!m_willBeParserExecuted);

    if (!contextDocument)
        return;

    if (type == FinishWithErrorOrCancel) {
        dispatchErrorEvent();
        contextDocument->scriptRunner()->notifyScriptLoadError(this, m_willExecuteInOrder ? ScriptRunner::IN_ORDER_EXECUTION : ScriptRunner::ASYNC_EXECUTION);
        return;
    }
    if (m_willExecuteInOrder)
        contextDocument->scriptRunner()->notifyScriptReady(this, ScriptRunner::IN_ORDER_EXECUTION);
    else
        contextDocument->scriptRunner()->notifyScriptReady(this, ScriptRunner::ASYNC_EXECUTION);

    m_resource = 0;
}
开发者ID:jeremyroman,项目名称:blink,代码行数:19,代码来源:ScriptLoader.cpp


示例20: ASSERT

bool ScriptLoader::fetchScript(const String& sourceUrl, FetchRequest::DeferOption defer)
{
    ASSERT(m_element);

    RefPtrWillBeRawPtr<Document> elementDocument(m_element->document());
    if (!m_element->inDocument() || m_element->document() != elementDocument)
        return false;

    ASSERT(!m_resource);
    if (!stripLeadingAndTrailingHTMLSpaces(sourceUrl).isEmpty()) {
        FetchRequest request(ResourceRequest(elementDocument->completeURL(sourceUrl)), m_element->localName());

        CrossOriginAttributeValue crossOrigin = crossOriginAttributeValue(m_element->fastGetAttribute(HTMLNames::crossoriginAttr));
        if (crossOrigin != CrossOriginAttributeNotSet)
            request.setCrossOriginAccessControl(elementDocument->securityOrigin(), crossOrigin);
        request.setCharset(scriptCharset());

        bool scriptPassesCSP = elementDocument->contentSecurityPolicy()->allowScriptWithNonce(m_element->fastGetAttribute(HTMLNames::nonceAttr));
        if (scriptPassesCSP)
            request.setContentSecurityCheck(DoNotCheckContentSecurityPolicy);
        request.setDefer(defer);

        String integrityAttr = m_element->fastGetAttribute(HTMLNames::integrityAttr);
        IntegrityMetadataSet metadataSet;
        if (!integrityAttr.isEmpty()) {
            SubresourceIntegrity::parseIntegrityAttribute(integrityAttr, metadataSet, elementDocument.get());
            request.setIntegrityMetadata(metadataSet);
        }

        m_resource = ScriptResource::fetch(request, elementDocument->fetcher());
        if (m_resource && !integrityAttr.isEmpty())
            m_resource->setIntegrityMetadata(metadataSet);

        m_isExternalScript = true;
    }

    if (m_resource)
        return true;

    dispatchErrorEvent();
    return false;
}
开发者ID:howardroark2018,项目名称:chromium,代码行数:42,代码来源:ScriptLoader.cpp



注:本文中的dispatchErrorEvent函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ dispatchEvent函数代码示例发布时间:2022-05-30
下一篇:
C++ dispatch函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap