void PresentationConnectionCallbacks::onSuccess(WebPassOwnPtr<WebPresentationConnectionClient> PresentationConnectionClient)
{
    OwnPtr<WebPresentationConnectionClient> result(PresentationConnectionClient.release());

    if (!m_resolver->getExecutionContext() || m_resolver->getExecutionContext()->activeDOMObjectsAreStopped())
        return;
    m_resolver->resolve(PresentationConnection::take(m_resolver.get(), result.release(), m_request));
}
void PermissionsCallback::onSuccess(WebPassOwnPtr<WebVector<WebPermissionStatus>> permissionStatus)
{
    if (!m_resolver->getExecutionContext() || m_resolver->getExecutionContext()->activeDOMObjectsAreStopped())
        return;

    OwnPtr<WebVector<WebPermissionStatus>> statusPtr = permissionStatus.release();
    HeapVector<Member<PermissionStatus>> result(m_callerIndexToInternalIndex->size());

    // Create the response vector by finding the status for each index by
    // using the caller to internal index mapping and looking up the status
    // using the internal index obtained.
    for (size_t i = 0; i < m_callerIndexToInternalIndex->size(); ++i) {
        int internalIndex = m_callerIndexToInternalIndex->operator[](i);
        result[i] = PermissionStatus::createAndListen(m_resolver->getExecutionContext(), statusPtr->operator[](internalIndex), m_internalPermissions->operator[](internalIndex));
    }
    m_resolver->resolve(result);
}
void ServiceWorkerGlobalScope::setRegistration(WebPassOwnPtr<WebServiceWorkerRegistration::Handle> handle)
{
    if (!executionContext())
        return;
    m_registration = ServiceWorkerRegistration::getOrCreate(executionContext(), handle.release());
}