/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* vim: set ts=8 sts=2 et sw=2 tw=80: */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
// If the actor was terminated for some unknown reason, then indicate the // operation is dead. if (mPromise) {
mPromise->MaybeReject(NS_ERROR_FAILURE);
mPromise = nullptr;
}
mParentActor->NoteDeletedActor();
RemoveWorkerRef();
}
switch (aResult.type()) { case CacheOpResult::TCacheMatchResult: {
HandleResponse(aResult.get_CacheMatchResult().maybeResponse()); break;
} case CacheOpResult::TCacheMatchAllResult: {
HandleResponseList(aResult.get_CacheMatchAllResult().responseList()); break;
} case CacheOpResult::TCachePutAllResult: {
mPromise->MaybeResolveWithUndefined(); break;
} case CacheOpResult::TCacheDeleteResult: {
mPromise->MaybeResolve(aResult.get_CacheDeleteResult().success()); break;
} case CacheOpResult::TCacheKeysResult: {
HandleRequestList(aResult.get_CacheKeysResult().requestList()); break;
} case CacheOpResult::TStorageMatchResult: {
HandleResponse(aResult.get_StorageMatchResult().maybeResponse()); break;
} case CacheOpResult::TStorageHasResult: {
mPromise->MaybeResolve(aResult.get_StorageHasResult().success()); break;
} case CacheOpResult::TStorageOpenResult: { auto result = aResult.get_StorageOpenResult(); auto actor = static_cast<CacheChild*>(result.actor().AsChild());
// If we have a success status then we should have an actor. Gracefully // reject instead of crashing, though, if we get a nullptr here.
MOZ_DIAGNOSTIC_ASSERT(actor); if (!actor) {
mPromise->MaybeRejectWithTypeError( "CacheStorage.open() failed to access the storage system."); break;
}
actor->SetWorkerRef(CacheWorkerRef::PreferBehavior(
GetWorkerRefPtr().clonePtr(), CacheWorkerRef::eIPCWorkerRef));
RefPtr<Cache> cache = new Cache(mGlobal, actor, result.ns());
mPromise->MaybeResolve(cache); break;
} case CacheOpResult::TStorageDeleteResult: {
mPromise->MaybeResolve(aResult.get_StorageDeleteResult().success()); break;
} case CacheOpResult::TStorageKeysResult: {
mPromise->MaybeResolve(aResult.get_StorageKeysResult().keyList()); break;
} default:
MOZ_CRASH("Unknown Cache op result type!");
}
for (uint32_t i = 0; i < aResponseList.Length(); ++i) {
AddWorkerRefToStreamChild(aResponseList[i], GetWorkerRefPtr());
responses.AppendElement(ToResponse(aResponseList[i]));
}
for (uint32_t i = 0; i < aRequestList.Length(); ++i) {
AddWorkerRefToStreamChild(aRequestList[i], GetWorkerRefPtr());
requests.AppendElement(ToRequest(aRequestList[i]));
}
mPromise->MaybeResolve(requests);
}
} // namespace cache
} // namespace mozilla::dom
¤ Dauer der Verarbeitung: 0.14 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.