Bug 967414 - Enable DataStore API in B2G for certified apps only by default, r=bz

This commit is contained in:
Andrea Marchesini 2014-02-06 17:44:03 +00:00
Родитель 6b700fff83
Коммит e41626ff95
7 изменённых файлов: 14 добавлений и 9 удалений

Просмотреть файл

@ -816,11 +816,7 @@ pref("network.sntp.port", 123);
pref("network.sntp.timeout", 30); // In seconds.
// Enable dataStore
#ifdef RELEASE_BUILD
pref("dom.datastore.enabled", false);
#else
pref("dom.datastore.enabled", true);
#endif
// DOM Inter-App Communication API.
pref("dom.inter-app-communication-api.enabled", true);

Просмотреть файл

@ -1926,6 +1926,11 @@ Navigator::HasDataStoreSupport(JSContext* cx, JSObject* aGlobal)
{
JS::Rooted<JSObject*> global(cx, aGlobal);
// DataStore is enabled by default for chrome code.
if (nsContentUtils::IsCallerChrome()) {
return true;
}
// First of all, the general pref has to be turned on.
bool enabled = false;
Preferences::GetBool("dom.datastore.enabled", &enabled);

Просмотреть файл

@ -16,6 +16,8 @@
alert('DONE');
}
ok(!("DataStore" in window), "DataStore is not an available interface");
ok(!("DataStoreChangeEvent" in window), "DataStore is not an available interface");
ok(!("getDataStores" in navigator), "DataStore not available");
finish();
</script>

Просмотреть файл

@ -82,6 +82,8 @@
},
function() {
ok(!("DataStore" in window), "DataStore is not an available interface");
ok(!("DataStoreChangeEvent" in window), "DataStore is not an available interface");
ok(!("getDataStores" in navigator), "getDataStores should not exist");
runTest();
},

Просмотреть файл

@ -263,11 +263,11 @@ var interfaceNamesInGlobalScope =
// IMPORTANT: Do not change this list without review from a DOM peer!
{name: "DataErrorEvent", b2g: true, pref: "dom.mobileconnection.enabled"},
// IMPORTANT: Do not change this list without review from a DOM peer!
{name: "DataStore", b2g: true, release: false},
{name: "DataStore", b2g: true},
// IMPORTANT: Do not change this list without review from a DOM peer!
{name: "DataStoreChangeEvent", b2g: true, release: false},
{name: "DataStoreChangeEvent", b2g: true},
// IMPORTANT: Do not change this list without review from a DOM peer!
{name: "DataStoreCursor", b2g: true, release: false},
{name: "DataStoreCursor", b2g: true},
// IMPORTANT: Do not change this list without review from a DOM peer!
"DataTransfer",
// IMPORTANT: Do not change this list without review from a DOM peer!

Просмотреть файл

@ -6,7 +6,7 @@
typedef (DOMString or unsigned long) DataStoreKey;
[Pref="dom.datastore.enabled",
[Func="Navigator::HasDataStoreSupport",
JSImplementation="@mozilla.org/dom/datastore;1"]
interface DataStore : EventTarget {
// Returns the label of the DataSource.

Просмотреть файл

@ -10,7 +10,7 @@ dictionary DataStoreChangeEventInit : EventInit {
DOMString operation = "";
};
[Pref="dom.datastore.enabled",
[Func="Navigator::HasDataStoreSupport",
Constructor(DOMString type, optional DataStoreChangeEventInit eventInitDict)]
interface DataStoreChangeEvent : Event {
readonly attribute DOMString revisionId;