зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1489844 - Port DOMPrefs to StaticPrefs - part 1 - canvas_imagebitmap_extensions_enabled, r=ehsan
This commit is contained in:
Родитель
63cb9a2572
Коммит
84efbc6ccd
|
@ -24,12 +24,14 @@ DOMPrefs::Initialize()
|
|||
|
||||
#define DOM_PREF(name, pref) DOMPrefs::name();
|
||||
#define DOM_WEBIDL_PREF(name)
|
||||
#define DOM_WEBIDL_PREF2(name)
|
||||
#define DOM_UINT32_PREF(name, pref, defaultValue) DOMPrefs::name();
|
||||
|
||||
#include "DOMPrefsInternal.h"
|
||||
|
||||
#undef DOM_PREF
|
||||
#undef DOM_WEBIDL_PREF
|
||||
#undef DOM_WEBIDL_PREF2
|
||||
#undef DOM_UINT32_PREF
|
||||
}
|
||||
|
||||
|
@ -53,6 +55,15 @@ DOMPrefs::Initialize()
|
|||
return DOMPrefs::name(); \
|
||||
}
|
||||
|
||||
// TODO: this is going to be renamed DOM_WEBIDL_PREF in the last patch.
|
||||
#define DOM_WEBIDL_PREF2(name) \
|
||||
/* static */ bool \
|
||||
DOMPrefs::name(JSContext* aCx, JSObject* aObj) \
|
||||
{ \
|
||||
return StaticPrefs::name(); \
|
||||
}
|
||||
|
||||
|
||||
#define DOM_UINT32_PREF(name, pref, defaultValue) \
|
||||
/* static */ uint32_t \
|
||||
DOMPrefs::name() \
|
||||
|
@ -86,6 +97,7 @@ DOMPrefs::SchedulerTimingEnabled()
|
|||
|
||||
#undef DOM_PREF
|
||||
#undef DOM_WEBIDL_PREF
|
||||
#undef DOM_WEBIDL_PREF2
|
||||
#undef DOM_UINT32_PREF
|
||||
|
||||
} // dom namespace
|
||||
|
|
|
@ -24,12 +24,14 @@ public:
|
|||
|
||||
#define DOM_PREF(name, pref) static bool name();
|
||||
#define DOM_WEBIDL_PREF(name) static bool name(JSContext* aCx, JSObject* aObj);
|
||||
#define DOM_WEBIDL_PREF2(name) static bool name(JSContext* aCx, JSObject* aObj);
|
||||
#define DOM_UINT32_PREF(name, pref, defaultValue) static uint32_t name();
|
||||
|
||||
#include "DOMPrefsInternal.h"
|
||||
|
||||
#undef DOM_PREF
|
||||
#undef DOM_WEBIDL_PREF
|
||||
#undef DOM_WEBIDL_PREF2
|
||||
#undef DOM_UINT32_PREF
|
||||
};
|
||||
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
// * This defines DOMPrefs::FooBar(JSContext* aCx, JSObject* aObj);
|
||||
// This is allows the use of DOMPrefs in WebIDL files.
|
||||
|
||||
DOM_PREF(ImageBitmapExtensionsEnabled, "canvas.imagebitmap_extensions.enabled")
|
||||
DOM_PREF(DOMCachesEnabled, "dom.caches.enabled")
|
||||
DOM_PREF(DOMCachesTestingEnabled, "dom.caches.testing.enabled")
|
||||
DOM_PREF(PerformanceLoggingEnabled, "dom.performance.enable_user_timing_logging")
|
||||
|
@ -45,7 +44,7 @@ DOM_PREF(IndexedDBStorageOptionsEnabled, "dom.indexedDB.storageOption.enabled")
|
|||
DOM_PREF(BinASTEncodingEnabled, "dom.script_loader.binast_encoding.enabled")
|
||||
#endif
|
||||
|
||||
DOM_WEBIDL_PREF(ImageBitmapExtensionsEnabled)
|
||||
DOM_WEBIDL_PREF2(canvas_imagebitmap_extensions_enabled)
|
||||
DOM_WEBIDL_PREF(DOMCachesEnabled)
|
||||
DOM_WEBIDL_PREF(NotificationEnabledInServiceWorkers)
|
||||
DOM_WEBIDL_PREF(NotificationRIEnabled)
|
||||
|
|
|
@ -101,6 +101,7 @@
|
|||
#include "PostMessageEvent.h"
|
||||
#include "mozilla/dom/DocGroup.h"
|
||||
#include "mozilla/dom/TabGroup.h"
|
||||
#include "mozilla/StaticPrefs.h"
|
||||
|
||||
// Interfaces Needed
|
||||
#include "nsIFrame.h"
|
||||
|
@ -7725,7 +7726,7 @@ nsGlobalWindowInner::CreateImageBitmap(JSContext* aCx,
|
|||
const Sequence<ChannelPixelLayout>& aLayout,
|
||||
ErrorResult& aRv)
|
||||
{
|
||||
if (!DOMPrefs::ImageBitmapExtensionsEnabled()) {
|
||||
if (!StaticPrefs::canvas_imagebitmap_extensions_enabled()) {
|
||||
aRv.Throw(NS_ERROR_TYPE_ERR);
|
||||
return nullptr;
|
||||
}
|
||||
|
|
|
@ -403,10 +403,10 @@ dictionary ChannelPixelLayout {
|
|||
typedef sequence<ChannelPixelLayout> ImagePixelLayout;
|
||||
|
||||
partial interface ImageBitmap {
|
||||
[Throws, Func="mozilla::dom::DOMPrefs::ImageBitmapExtensionsEnabled"]
|
||||
[Throws, Func="mozilla::dom::DOMPrefs::canvas_imagebitmap_extensions_enabled"]
|
||||
ImageBitmapFormat findOptimalFormat (optional sequence<ImageBitmapFormat> aPossibleFormats);
|
||||
[Throws, Func="mozilla::dom::DOMPrefs::ImageBitmapExtensionsEnabled"]
|
||||
[Throws, Func="mozilla::dom::DOMPrefs::canvas_imagebitmap_extensions_enabled"]
|
||||
long mappedDataLength (ImageBitmapFormat aFormat);
|
||||
[Throws, Func="mozilla::dom::DOMPrefs::ImageBitmapExtensionsEnabled"]
|
||||
[Throws, Func="mozilla::dom::DOMPrefs::canvas_imagebitmap_extensions_enabled"]
|
||||
Promise<ImagePixelLayout> mapDataInto (ImageBitmapFormat aFormat, BufferSource aBuffer, long aOffset);
|
||||
};
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
#include "mozilla/dom/WorkerNavigator.h"
|
||||
#include "mozilla/dom/cache/CacheStorage.h"
|
||||
#include "mozilla/Services.h"
|
||||
#include "mozilla/StaticPrefs.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
|
||||
#include "nsIDocument.h"
|
||||
|
@ -504,7 +505,7 @@ WorkerGlobalScope::CreateImageBitmap(JSContext* aCx,
|
|||
const Sequence<ChannelPixelLayout>& aLayout,
|
||||
ErrorResult& aRv)
|
||||
{
|
||||
if (!DOMPrefs::ImageBitmapExtensionsEnabled()) {
|
||||
if (!StaticPrefs::canvas_imagebitmap_extensions_enabled()) {
|
||||
aRv.Throw(NS_ERROR_TYPE_ERR);
|
||||
return nullptr;
|
||||
}
|
||||
|
|
|
@ -202,6 +202,13 @@ VARCACHE_PREF(
|
|||
uint32_t, 5000
|
||||
)
|
||||
|
||||
// Disable the ImageBitmap-extensions for now.
|
||||
VARCACHE_PREF(
|
||||
"canvas.imagebitmap_extensions.enabled",
|
||||
canvas_imagebitmap_extensions_enabled,
|
||||
RelaxedAtomicBool, false
|
||||
)
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Clear-Site-Data prefs
|
||||
//---------------------------------------------------------------------------
|
||||
|
|
|
@ -968,9 +968,6 @@ pref("canvas.filters.enabled", true);
|
|||
pref("canvas.path.enabled", true);
|
||||
pref("canvas.capturestream.enabled", true);
|
||||
|
||||
// Disable the ImageBitmap-extensions for now.
|
||||
pref("canvas.imagebitmap_extensions.enabled", false);
|
||||
|
||||
// We want the ability to forcibly disable platform a11y, because
|
||||
// some non-a11y-related components attempt to bring it up. See bug
|
||||
// 538530 for details about Windows; we have a pref here that allows it
|
||||
|
|
Загрузка…
Ссылка в новой задаче