mirror of
https://github.com/roytam1/palemoon27.git
synced 2026-05-26 14:30:27 +00:00
09883465bd
- Bug 1143192 Allow Context initialization to be cancelled. (e408a5854) - Bug 1140065 Check for null actor before using it in CacheStorageChild::RecvOpenResponse(). (3a5875d64) - Bug 1149987 - Part 5: Hold a kungfu death grip in FetchPut::MaybeNotifyListener; (60845a3ef) - Bug 1149987 - Part 6: Release the FetchPut object on the right thread in FetchObserver::OnResponseEnd(); (bf9172b17) - Bug 1109751 - Consume FormData support in Fetch API. (be2ea94d7) - Bug 1149987 - Part 8: Do not store or match Response objects with a Vary:* header; (1f5de94f6) - Bug 1126819 - Part 1: Respect the RequestInit.cache member in Request's constructor; (b11b19aee) - Bug 1126819 - Part 2: Persist the Request.cache attribute in DOM Cache; (31c2db054) - Bug 1147695 - Enable interception of beacons through service workers; r=nsm (899b62ecd) - Bug 1142727 - Do not intercept sandboxed iframes with service workers; r=nsm (fee4c2ae6) - Bug 982726 - Test the number of clients returned by matchAll. (c2c0b0b9b) - Bug 1147367 - Add a test for checking the Request.context attribute for FetchEvents generated for fetch(); (c93d28f40) - Bug 1147699 - Part 1: Move Request::mContext to InternalRequest, and determine the mapping to nsContentPolicyType; r=nsm (356433175) - Bug 1147996 - Enable interception of CSP reports through service workers; r=nsm (9c040e1d6) - bug 1147490 - fix GLContextProviderNull. (95dbbc863) - Bug 1137814 - nsAString and nsACString in URL.cpp/h (687d66aad) - Bug 931249 - patch 1 - Scriptloader use cache if needed. Bug 931249 - Patch 1.1 - Set baseURI when script is obtained from cache. (7ab055659) - Bug 931249 - patch 2 - cachename integration. (f84945f92) - Bug 931249 - patch 2.1 - reuse cache name between updating and installing worker. (bf1846186) - Bug 931249 - patch 2.2 - purge old active worker cache when activating new worker. (116a50da3) - Bug 1131271 - Set ServiceWorker script redirect limit to zero. (af8ae3444) - Bug 931249 - patch 3 - tests. (eb9769c2f) - Bug 931249 - patch 4 - comparison. (ba0b8c833) - Bug 931249 - patch 5 - set redirection limit back to zero. (4ff8f49f2) - Bug 931249 - Patch 4.1 - Fix addref/release declarations on Windows builds. (c58f55fe8) - Bug 931249 - Patch 6 - Fix abort condition in CompareCache::OnStreamComplete. (2054a1d8b) - Bug 931249 - Patch 7 - Call Done() after Succeed() when cache and network match. (31ec38719) - Bug 931249 - Patch 8 - Provide direct getter to the fact that we are loading a worker instead of relying on cache name. (e5f62b684) - Bug 931249 - Patch 9 - Use ServiceWorker cache name as part of it's unique name. r=khuey (d6481d3cd) - Bug 931249 - Patch 10 - Bypass HTTP cache when downloading ServiceWorker script to compare against. r=bkelly (6309eaf90) - Bug 931249 - Patch 11 - Remove unused cacheName. (33bf983c5) - Bug 931249 - Patch 12 - Call LoadingFinished even if channel is not present. r=khuey (2a868e45a) - Bug 931249 - Patch 13 - Fix finish condition in CacheScriptLoader::Fail. r=baku (0033bc2ab) - Bug 931249 - Patch 14 - kungfuDeathGrip. r=baku (8d112108b) - Bug 931249 - Patch 15 - assert later. r=baku (9eca21509) - Bug 931249 - Patch 16 - Keep ServiceWorker alive during installation steps. r=baku (307dbe265)
177 lines
4.7 KiB
C++
177 lines
4.7 KiB
C++
/* -*- 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/. */
|
|
|
|
#include "mozilla/dom/cache/CacheStorageChild.h"
|
|
|
|
#include "mozilla/unused.h"
|
|
#include "mozilla/dom/cache/CacheChild.h"
|
|
#include "mozilla/dom/cache/CacheStorage.h"
|
|
#include "mozilla/dom/cache/StreamUtils.h"
|
|
|
|
namespace mozilla {
|
|
namespace dom {
|
|
namespace cache {
|
|
|
|
// declared in ActorUtils.h
|
|
void
|
|
DeallocPCacheStorageChild(PCacheStorageChild* aActor)
|
|
{
|
|
delete aActor;
|
|
}
|
|
|
|
CacheStorageChild::CacheStorageChild(CacheStorage* aListener, Feature* aFeature)
|
|
: mListener(aListener)
|
|
{
|
|
MOZ_COUNT_CTOR(cache::CacheStorageChild);
|
|
MOZ_ASSERT(mListener);
|
|
|
|
SetFeature(aFeature);
|
|
}
|
|
|
|
CacheStorageChild::~CacheStorageChild()
|
|
{
|
|
MOZ_COUNT_DTOR(cache::CacheStorageChild);
|
|
NS_ASSERT_OWNINGTHREAD(CacheStorageChild);
|
|
MOZ_ASSERT(!mListener);
|
|
}
|
|
|
|
void
|
|
CacheStorageChild::ClearListener()
|
|
{
|
|
NS_ASSERT_OWNINGTHREAD(CacheStorageChild);
|
|
MOZ_ASSERT(mListener);
|
|
mListener = nullptr;
|
|
}
|
|
|
|
void
|
|
CacheStorageChild::StartDestroy()
|
|
{
|
|
NS_ASSERT_OWNINGTHREAD(CacheStorageChild);
|
|
|
|
nsRefPtr<CacheStorage> listener = mListener;
|
|
|
|
// StartDestroy() can get called from either CacheStorage or the Feature.
|
|
// Theoretically we can get double called if the right race happens. Handle
|
|
// that by just ignoring the second StartDestroy() call.
|
|
if (!listener) {
|
|
return;
|
|
}
|
|
|
|
listener->DestroyInternal(this);
|
|
|
|
// CacheStorage listener should call ClearListener() in DestroyInternal()
|
|
MOZ_ASSERT(!mListener);
|
|
|
|
// Start actor destruction from parent process
|
|
unused << SendTeardown();
|
|
}
|
|
|
|
void
|
|
CacheStorageChild::ActorDestroy(ActorDestroyReason aReason)
|
|
{
|
|
NS_ASSERT_OWNINGTHREAD(CacheStorageChild);
|
|
nsRefPtr<CacheStorage> listener = mListener;
|
|
if (listener) {
|
|
listener->DestroyInternal(this);
|
|
// CacheStorage listener should call ClearListener() in DestroyInternal()
|
|
MOZ_ASSERT(!mListener);
|
|
}
|
|
|
|
RemoveFeature();
|
|
}
|
|
|
|
bool
|
|
CacheStorageChild::RecvMatchResponse(const RequestId& aRequestId,
|
|
const nsresult& aRv,
|
|
const PCacheResponseOrVoid& aResponseOrVoid)
|
|
{
|
|
NS_ASSERT_OWNINGTHREAD(CacheStorageChild);
|
|
|
|
AddFeatureToStreamChild(aResponseOrVoid, GetFeature());
|
|
|
|
nsRefPtr<CacheStorage> listener = mListener;
|
|
if (!listener) {
|
|
StartDestroyStreamChild(aResponseOrVoid);
|
|
return true;
|
|
}
|
|
|
|
listener->RecvMatchResponse(aRequestId, aRv, aResponseOrVoid);
|
|
|
|
return true;
|
|
}
|
|
|
|
bool
|
|
CacheStorageChild::RecvHasResponse(const RequestId& aRequestId,
|
|
const nsresult& aRv,
|
|
const bool& aSuccess)
|
|
{
|
|
NS_ASSERT_OWNINGTHREAD(CacheStorageChild);
|
|
nsRefPtr<CacheStorage> listener = mListener;
|
|
if (listener) {
|
|
listener->RecvHasResponse(aRequestId, aRv, aSuccess);
|
|
}
|
|
return true;
|
|
}
|
|
|
|
bool
|
|
CacheStorageChild::RecvOpenResponse(const RequestId& aRequestId,
|
|
const nsresult& aRv,
|
|
PCacheChild* aActor)
|
|
{
|
|
NS_ASSERT_OWNINGTHREAD(CacheStorageChild);
|
|
|
|
nsRefPtr<CacheStorage> listener = mListener;
|
|
if (!listener || FeatureNotified()) {
|
|
if (aActor) {
|
|
unused << aActor->SendTeardown();
|
|
}
|
|
return true;
|
|
}
|
|
|
|
CacheChild* cacheChild = static_cast<CacheChild*>(aActor);
|
|
|
|
// Since FeatureNotified() returned false above, we are guaranteed that
|
|
// the feature won't try to shutdown the actor until after we create the
|
|
// Cache DOM object in the listener's RecvOpenResponse() method. This
|
|
// is important because StartShutdown() expects a Cache object listener.
|
|
if (cacheChild) {
|
|
cacheChild->SetFeature(GetFeature());
|
|
}
|
|
|
|
listener->RecvOpenResponse(aRequestId, aRv, cacheChild);
|
|
return true;
|
|
}
|
|
|
|
bool
|
|
CacheStorageChild::RecvDeleteResponse(const RequestId& aRequestId,
|
|
const nsresult& aRv,
|
|
const bool& aResult)
|
|
{
|
|
NS_ASSERT_OWNINGTHREAD(CacheStorageChild);
|
|
nsRefPtr<CacheStorage> listener = mListener;
|
|
if (listener) {
|
|
listener->RecvDeleteResponse(aRequestId, aRv, aResult);
|
|
}
|
|
return true;
|
|
}
|
|
|
|
bool
|
|
CacheStorageChild::RecvKeysResponse(const RequestId& aRequestId,
|
|
const nsresult& aRv,
|
|
nsTArray<nsString>&& aKeys)
|
|
{
|
|
NS_ASSERT_OWNINGTHREAD(CacheStorageChild);
|
|
nsRefPtr<CacheStorage> listener = mListener;
|
|
if (listener) {
|
|
listener->RecvKeysResponse(aRequestId, aRv, aKeys);
|
|
}
|
|
return true;
|
|
}
|
|
|
|
} // namespace cache
|
|
} // namespace dom
|
|
} // namespace mozilla
|