зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1451486 - Part 1 - Ignore the storage attribute on indexedDB.open() by default. r=asuth,baku
MozReview-Commit-ID: 844FRkx3rKZ --HG-- extra : rebase_source : 962cd1ade83b34561ebd6cd70365b44b85a3aa95
This commit is contained in:
Родитель
e2ad665009
Коммит
29d2c4832d
|
@ -8,6 +8,10 @@
|
|||
"use strict";
|
||||
|
||||
add_task(async function() {
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
set: [["dom.indexedDB.storageOption.enabled", true]]
|
||||
});
|
||||
|
||||
const TESTPAGE = MAIN_DOMAIN + "storage-indexeddb-duplicate-names.html";
|
||||
|
||||
setPermission(TESTPAGE, "indexedDB");
|
||||
|
|
|
@ -41,6 +41,7 @@ DOM_PREF(ResistFingerprintingEnabled, "privacy.resistFingerprinting")
|
|||
DOM_PREF(EnableAutoDeclineCanvasPrompts, "privacy.resistFingerprinting.autoDeclineNoUserInputCanvasPrompts")
|
||||
DOM_PREF(DevToolsEnabled, "devtools.enabled")
|
||||
DOM_PREF(PerformanceObserverEnabled, "dom.enable_performance_observer")
|
||||
DOM_PREF(IndexedDBStorageOptionsEnabled, "dom.indexedDB.storageOption.enabled")
|
||||
|
||||
DOM_WEBIDL_PREF(ImageBitmapExtensionsEnabled)
|
||||
DOM_WEBIDL_PREF(DOMCachesEnabled)
|
||||
|
|
|
@ -701,11 +701,27 @@ IDBFactory::OpenInternal(JSContext* aCx,
|
|||
isInternal = QuotaManager::IsOriginInternal(origin);
|
||||
}
|
||||
|
||||
// Allow storage attributes for add-ons independent of the pref.
|
||||
// This works in the main thread only, workers don't have the principal.
|
||||
bool isAddon = false;
|
||||
if (NS_IsMainThread()) {
|
||||
// aPrincipal is passed inconsistently, so even when we are already on
|
||||
// the main thread, we may have been passed a null aPrincipal.
|
||||
nsCOMPtr<nsIPrincipal> principal = PrincipalInfoToPrincipal(principalInfo);
|
||||
if (principal) {
|
||||
nsAutoString addonId;
|
||||
Unused << NS_WARN_IF(NS_FAILED(principal->GetAddonId(addonId)));
|
||||
isAddon = !addonId.IsEmpty();
|
||||
}
|
||||
}
|
||||
|
||||
if (isInternal) {
|
||||
// Chrome privilege and internal origins always get persistent storage.
|
||||
persistenceType = PERSISTENCE_TYPE_PERSISTENT;
|
||||
} else {
|
||||
} else if (isAddon || DOMPrefs::IndexedDBStorageOptionsEnabled()) {
|
||||
persistenceType = PersistenceTypeFromStorage(aStorageType);
|
||||
} else {
|
||||
persistenceType = PERSISTENCE_TYPE_DEFAULT;
|
||||
}
|
||||
|
||||
DatabaseMetadata& metadata = commonParams.metadata();
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
[DEFAULT]
|
||||
prefs =
|
||||
dom.indexedDB.storageOption.enabled=true
|
||||
skip-if = (buildapp != "browser")
|
||||
support-files =
|
||||
head.js
|
||||
|
|
|
@ -3,6 +3,8 @@
|
|||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
[DEFAULT]
|
||||
prefs =
|
||||
dom.indexedDB.storageOption.enabled=true
|
||||
support-files =
|
||||
bfcache_page1.html
|
||||
bfcache_page2.html
|
||||
|
|
|
@ -7,6 +7,11 @@ var testGenerator = testSteps();
|
|||
|
||||
function* testSteps()
|
||||
{
|
||||
Services.prefs.setBoolPref("dom.indexedDB.storageOption.enabled", true);
|
||||
registerCleanupFunction(() => {
|
||||
Services.prefs.clearUserPref("dom.indexedDB.storageOption.enabled");
|
||||
});
|
||||
|
||||
const openParams = [
|
||||
// This one lives in storage/default/http+++localhost
|
||||
{ url: "http://localhost", dbName: "dbA", dbVersion: 1 },
|
||||
|
|
|
@ -7,6 +7,11 @@ var testGenerator = testSteps();
|
|||
|
||||
function* testSteps()
|
||||
{
|
||||
Services.prefs.setBoolPref("dom.indexedDB.storageOption.enabled", true);
|
||||
registerCleanupFunction(() => {
|
||||
Services.prefs.clearUserPref("dom.indexedDB.storageOption.enabled");
|
||||
});
|
||||
|
||||
const openParams = [
|
||||
// This one lives in storage/permanent/chrome
|
||||
// The .metadata-v2 file was intentionally removed for this origin directory
|
||||
|
|
|
@ -7,6 +7,11 @@ var testGenerator = testSteps();
|
|||
|
||||
function* testSteps()
|
||||
{
|
||||
Services.prefs.setBoolPref("dom.indexedDB.storageOption.enabled", true);
|
||||
registerCleanupFunction(() => {
|
||||
Services.prefs.clearUserPref("dom.indexedDB.storageOption.enabled");
|
||||
});
|
||||
|
||||
const openParams = [
|
||||
// This one lives in storage/permanent/chrome
|
||||
{ dbName: "dbA",
|
||||
|
|
|
@ -138,6 +138,8 @@ pref("dom.indexedDB.logging.enabled", true);
|
|||
pref("dom.indexedDB.logging.details", true);
|
||||
// Enable profiler marks for indexedDB events.
|
||||
pref("dom.indexedDB.logging.profiler-marks", false);
|
||||
// Enable passing the "storage" option to indexedDB.open.
|
||||
pref("dom.indexedDB.storageOption.enabled", false);
|
||||
|
||||
// Whether or not File Handle is enabled.
|
||||
pref("dom.fileHandle.enabled", true);
|
||||
|
|
Загрузка…
Ссылка в новой задаче