Bug 1622111 - Convert dom.datatransfer.mozAtAPIs to static pref. r=njn

Converts dom.datatransfer.mozAtAPIs to a static pref and adds the `do_not_use_directly` field, since the pref is used in combination with an additional check in `DataTransfer::MozAtAPIsEnabled`.

Differential Revision: https://phabricator.services.mozilla.com/D67202

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Kristen Wright 2020-03-19 00:54:15 +00:00
Родитель a2f61f37b1
Коммит 74a5665bf6
3 изменённых файлов: 10 добавлений и 15 удалений

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

@ -44,8 +44,6 @@
#include "nsNetUtil.h"
#include "nsReadableUtils.h"
#define MOZ_CALLS_ENABLED_PREF "dom.datatransfer.mozAtAPIs"
namespace mozilla {
namespace dom {
@ -1545,17 +1543,9 @@ void DataTransfer::SetMode(DataTransfer::Mode aMode) {
/* static */
bool DataTransfer::MozAtAPIsEnabled(JSContext* aCx, JSObject* aObj /*unused*/) {
// Read the pref
static bool sPrefCached = false;
static bool sPrefCacheValue = false;
if (!sPrefCached) {
sPrefCached = true;
Preferences::AddBoolVarCache(&sPrefCacheValue, MOZ_CALLS_ENABLED_PREF);
}
// We can expose moz* APIs if we are chrome code or if pref is enabled
return nsContentUtils::IsSystemCaller(aCx) || sPrefCacheValue;
return nsContentUtils::IsSystemCaller(aCx) ||
StaticPrefs::dom_datatransfer_mozAtAPIs_DoNotUseDirectly();
}
} // namespace dom

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

@ -1460,6 +1460,14 @@
value: false
mirror: always
# Disable moz* APIs in DataTransfer.
# Should be accessed via DataTransfer::MozAtAPIsEnabled.
- name: dom.datatransfer.mozAtAPIs
type: bool
value: false
mirror: always
do_not_use_directly: true
# Any how many seconds we allow external protocol URLs in iframe when not in
# single events
- name: dom.delay.block_external_protocol_in_iframes

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

@ -4708,9 +4708,6 @@ pref("dom.noopener.newprocess.enabled", true);
// loops with faulty converters involved.
pref("general.document_open_conversion_depth_limit", 20);
// Disable moz* APIs in DataTransfer
pref("dom.datatransfer.mozAtAPIs", false);
pref("fission.rebuild_frameloaders_on_remoteness_change", true);
// Support for legacy customizations that rely on checking the