/* -*- 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 (Preferences::GetBool(kTestingPref)) {
obs->AddObserver(sSelf, "domstorage-test-flush-force", true); if (XRE_IsParentProcess()) { // Only to forward to child process.
obs->AddObserver(sSelf, "domstorage-test-flushed", true);
}
obs->AddObserver(sSelf, "domstorage-test-reload", true);
} else {
obs->RemoveObserver(sSelf, "domstorage-test-flush-force"); if (XRE_IsParentProcess()) { // Only to forward to child process.
obs->RemoveObserver(sSelf, "domstorage-test-flushed");
}
obs->RemoveObserver(sSelf, "domstorage-test-reload");
}
}
// Timer callback used to start the database a short timer after startup if (!strcmp(aTopic, NS_TIMER_CALLBACK_TOPIC)) {
MOZ_ASSERT(XRE_IsParentProcess());
MOZ_ASSERT(!NextGenLocalStorageEnabled());
nsCOMPtr<nsITimer> timer = do_QueryInterface(aSubject); if (!timer) { return NS_ERROR_UNEXPECTED;
}
if (timer == mDBThreadStartDelayTimer) {
mDBThreadStartDelayTimer = nullptr;
for (const uint32_t id : {0, 1}) {
StorageDBChild* storageChild = StorageDBChild::GetOrCreate(id); if (NS_WARN_IF(!storageChild)) { return NS_ERROR_FAILURE;
}
if (notification->GetAction() !=
nsICookieNotification::ALL_COOKIES_CLEARED) { return NS_OK;
}
if (!NextGenLocalStorageEnabled()) { for (const uint32_t id : {0, 1}) {
StorageDBChild* storageChild = StorageDBChild::GetOrCreate(id); if (NS_WARN_IF(!storageChild)) { return NS_ERROR_FAILURE;
}
storageChild->AsyncClearAll();
if (XRE_IsParentProcess()) {
storageChild->SendClearAll();
}
}
}
Notify("cookie-cleared");
return NS_OK;
}
// Clear from caches everything that has been stored // while in session-only mode if (!strcmp(aTopic, "perm-changed")) { // Check for cookie permission change
nsCOMPtr<nsIPermission> perm(do_QueryInterface(aSubject)); if (!perm) { return NS_OK;
}
Notify(topic, u""_ns, originScope);
} else { for (const uint32_t id : {0, 1}) {
StorageDBChild* storageChild = StorageDBChild::GetOrCreate(id); if (NS_WARN_IF(!storageChild)) { return NS_ERROR_FAILURE;
}
storageChild->AsyncClearAll();
if (XRE_IsParentProcess()) {
storageChild->SendClearAll();
}
}
Notify(topic);
}
return NS_OK;
}
if (!strcmp(aTopic, "browser:purge-sessionStorage")) { // The caller passed an nsIClearBySiteEntry object which consists of both // site and pattern. // If both are passed, aSubject takes precedence over aData. if (aSubject) {
nsCOMPtr<nsIClearBySiteEntry> entry = do_QueryInterface(aSubject);
// Clear all private-browsing caches if (!strcmp(aTopic, "last-pb-context-exited")) { if (NextGenLocalStorageEnabled()) { return NS_OK;
}
// We get the notification in both processes (parent and content), but the // clearing of the in-memory database should be triggered from the parent // process only to avoid creation of redundant clearing operations. // Also, if we create a new StorageDBChild instance late during content // process shutdown, then it might be leaked in debug builds because it // could happen that there is no chance to properly destroy it. if (XRE_IsParentProcess()) { // This doesn't use a loop with privateBrowsingId 0 and 1, since we only // need to clear the in-memory database which is represented by // privateBrowsingId 1. staticconst uint32_t id = 1;
StorageDBChild* storageChild = StorageDBChild::GetOrCreate(id); if (NS_WARN_IF(!storageChild)) { return NS_ERROR_FAILURE;
}
// Clear data of the origins whose prefixes will match the suffix. if (!strcmp(aTopic, "clear-origin-attributes-data") ||
!strcmp(aTopic, "dom-storage:clear-origin-attributes-data")) {
MOZ_ASSERT(XRE_IsParentProcess());
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.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.