diff --git a/dom/events/DataTransfer.cpp b/dom/events/DataTransfer.cpp index b209ba55a8f2..ea3882df0fd4 100644 --- a/dom/events/DataTransfer.cpp +++ b/dom/events/DataTransfer.cpp @@ -1540,12 +1540,5 @@ void DataTransfer::SetMode(DataTransfer::Mode aMode) { } } -/* static */ -bool DataTransfer::MozAtAPIsEnabled(JSContext* aCx, JSObject* aObj /*unused*/) { - // We can expose moz* APIs if we are chrome code or if pref is enabled - return nsContentUtils::IsSystemCaller(aCx) || - StaticPrefs::dom_datatransfer_mozAtAPIs_DoNotUseDirectly(); -} - } // namespace dom } // namespace mozilla diff --git a/dom/events/DataTransfer.h b/dom/events/DataTransfer.h index dcef9f549327..6b5576c1dcb5 100644 --- a/dom/events/DataTransfer.h +++ b/dom/events/DataTransfer.h @@ -395,12 +395,6 @@ class DataTransfer final : public nsISupports, public nsWrapperCache { bool aPlainTextOnly, nsTArray* aResult); - // Returns true if moz* APIs should be exposed (true for chrome code or if - // dom.datatransfer.moz pref is enabled). - // The affected moz* APIs are mozItemCount, mozTypesAt, mozClearDataAt, - // mozSetDataAt, mozGetDataAt - static bool MozAtAPIsEnabled(JSContext* cx, JSObject* obj); - protected: // caches text and uri-list data formats that exist in the drag service or // clipboard for retrieval later. diff --git a/dom/tests/mochitest/general/mochitest.ini b/dom/tests/mochitest/general/mochitest.ini index a72a7efc2a97..21406815216d 100644 --- a/dom/tests/mochitest/general/mochitest.ini +++ b/dom/tests/mochitest/general/mochitest.ini @@ -80,7 +80,6 @@ skip-if = headless # bug 1403542 [test_consoleAPI.html] [test_contentViewer_overrideDPPX.html] [test_CCW_optimization.html] -[test_datatransfer_disallowed.html] [test_devicePixelRatio_with_zoom.html] [test_DOMMatrix.html] [test_domWindowUtils.html] diff --git a/dom/tests/mochitest/general/test_datatransfer_disallowed.html b/dom/tests/mochitest/general/test_datatransfer_disallowed.html deleted file mode 100644 index 8aba82b77c74..000000000000 --- a/dom/tests/mochitest/general/test_datatransfer_disallowed.html +++ /dev/null @@ -1,31 +0,0 @@ - - - - Test for DataTransfer moz* APIs - - - - - - diff --git a/dom/webidl/DataTransfer.webidl b/dom/webidl/DataTransfer.webidl index f37bcf729d0c..7f7528d9c0fd 100644 --- a/dom/webidl/DataTransfer.webidl +++ b/dom/webidl/DataTransfer.webidl @@ -57,7 +57,7 @@ partial interface DataTransfer { /** * The number of items being dragged. */ - [Func="DataTransfer::MozAtAPIsEnabled"] + [ChromeOnly] readonly attribute unsigned long mozItemCount; /** @@ -80,7 +80,7 @@ partial interface DataTransfer { * at the specified index. If the index is not in the range from 0 to * itemCount - 1, an empty string list is returned. */ - [Throws, NeedsCallerType, Func="DataTransfer::MozAtAPIsEnabled"] + [Throws, NeedsCallerType, ChromeOnly] DOMStringList mozTypesAt(unsigned long index); /** @@ -97,7 +97,7 @@ partial interface DataTransfer { * @throws NS_ERROR_DOM_INDEX_SIZE_ERR if index is greater or equal than itemCount * @throws NO_MODIFICATION_ALLOWED_ERR if the item cannot be modified */ - [Throws, NeedsSubjectPrincipal, Func="DataTransfer::MozAtAPIsEnabled"] + [Throws, NeedsSubjectPrincipal, ChromeOnly] void mozClearDataAt(DOMString format, unsigned long index); /* @@ -121,7 +121,7 @@ partial interface DataTransfer { * @throws NS_ERROR_DOM_INDEX_SIZE_ERR if index is greater than itemCount * @throws NO_MODIFICATION_ALLOWED_ERR if the item cannot be modified */ - [Throws, NeedsSubjectPrincipal, Func="DataTransfer::MozAtAPIsEnabled"] + [Throws, NeedsSubjectPrincipal, ChromeOnly] void mozSetDataAt(DOMString format, any data, unsigned long index); /** @@ -133,7 +133,7 @@ partial interface DataTransfer { * @returns the data of the given format, or null if it doesn't exist. * @throws NS_ERROR_DOM_INDEX_SIZE_ERR if index is greater or equal than itemCount */ - [Throws, NeedsSubjectPrincipal, Func="DataTransfer::MozAtAPIsEnabled"] + [Throws, NeedsSubjectPrincipal, ChromeOnly] any mozGetDataAt(DOMString format, unsigned long index); /** diff --git a/modules/libpref/init/StaticPrefList.yaml b/modules/libpref/init/StaticPrefList.yaml index 6c7933726fb9..db788b277f5a 100644 --- a/modules/libpref/init/StaticPrefList.yaml +++ b/modules/libpref/init/StaticPrefList.yaml @@ -1572,14 +1572,6 @@ 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