Bug 1412463 - Remove the chromeonly DataTransfer.types.contains function. r=dom-core,emilio,edgar

This was originally added for backwards compatibility for extensions when fixing the DataTransfer.types type.
The extensions are no longer supported.

Differential Revision: https://phabricator.services.mozilla.com/D188330
This commit is contained in:
Mark Banner 2023-09-20 08:49:03 +00:00
Родитель 7c785df7d9
Коммит 780b7558fc
5 изменённых файлов: 4 добавлений и 39 удалений

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

@ -8960,10 +8960,6 @@ def wrapArgIntoCurrentCompartment(arg, value, isMember=True):
return wrap
def needsContainsHack(m):
return m.getExtendedAttribute("ReturnValueNeedsContainsHack")
def needsCallerType(m):
return m.getExtendedAttribute("NeedsCallerType")
@ -9577,23 +9573,6 @@ class CGPerSignatureCall(CGThing):
# the compartment we do our conversion in but after we've finished
# the initial conversion into args.rval().
postConversionSteps = ""
if needsContainsHack(self.idlNode):
# Define a .contains on the object that has the same value as
# .includes; needed for backwards compat in extensions as we
# migrate some DOMStringLists to FrozenArray.
postConversionSteps += dedent(
"""
if (args.rval().isObject() && nsContentUtils::ThreadsafeIsSystemCaller(cx)) {
JS::Rooted<JSObject*> rvalObj(cx, &args.rval().toObject());
JS::Rooted<JS::Value> includesVal(cx);
if (!JS_GetProperty(cx, rvalObj, "includes", &includesVal) ||
!JS_DefineProperty(cx, rvalObj, "contains", includesVal, JSPROP_ENUMERATE)) {
return false;
}
}
"""
)
if self.idlNode.getExtendedAttribute("Frozen"):
assert (
self.idlNode.type.isSequence() or self.idlNode.type.isDictionary()
@ -18883,7 +18862,7 @@ class CGBindingRoot(CGThing):
return (
any(
isChromeOnly(a) or needsContainsHack(a) or needsCallerType(a)
isChromeOnly(a) or needsCallerType(a)
for a in desc.interface.members
)
or desc.interface.getExtendedAttribute("ChromeOnly") is not None

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

@ -5719,7 +5719,6 @@ class IDLAttribute(IDLInterfaceMember):
or identifier == "SetterNeedsSubjectPrincipal"
or identifier == "GetterNeedsSubjectPrincipal"
or identifier == "NeedsCallerType"
or identifier == "ReturnValueNeedsContainsHack"
or identifier == "BinaryName"
or identifier == "NonEnumerable"
or identifier == "BindingTemplate"

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

@ -198,17 +198,6 @@ function test() {
isnot(languages1, languages2.wrappedJSObject,
"Must have distinct arrays no matter how we slice it");
// Check that DataTransfer's .types has the hack to alias contains()
// to includes().
var dataTransfer = new win.DataTransfer();
is(dataTransfer.types.contains, dataTransfer.types.includes,
"Should have contains() set up as an alias to includes()");
// Waive Xrays on the dataTransfer itself, since the .types we get is
// different over Xrays vs not.
is(dataTransfer.wrappedJSObject.types.contains, undefined,
"Underlying object should not have contains() set up as an alias to " +
"includes()");
// Check that deleters work correctly in the [OverrideBuiltins] case.
elem = win.document.documentElement;
var dataset = elem.dataset;

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

@ -61,7 +61,7 @@ function afterDragTests()
sendMouseEventsForDrag("link");
sendMouseEventsForDrag("image");
// disable testing input dragging for now, as it doesn't seem to be testable
// disable testing input dragging for now, as it doesn't seem to be testable
// draggable = $("input");
// draggable.setSelectionRange(0, 4);
// synthesizeMouse(draggable, 8, 8, { type: "mousedown" });
@ -188,7 +188,7 @@ function test_DataTransfer(dt)
var types = dt.types;
ok(Array.isArray(types), "empty types is an Array");
// The above test fails if we have SpecialPowers.wrap(dt).types instead of dt.types
// because chrome consumers get the 'ReturnValueNeedsContainsHack'.
// because dt.types will be wrapped and become a proxy.
// So wrap with special powers after the test
dt = SpecialPowers.wrap(dt);
checkTypes(dt, [], 0, "empty");

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

@ -19,9 +19,7 @@ interface DataTransfer {
undefined setDragImage(Element image, long x, long y);
// ReturnValueNeedsContainsHack on .types because lots of extension
// code was expecting .contains() back when it was a DOMStringList.
[Pure, Cached, Frozen, NeedsCallerType, ReturnValueNeedsContainsHack]
[Frozen, Cached, Pure, NeedsCallerType]
readonly attribute sequence<DOMString> types;
[Throws, NeedsSubjectPrincipal]
DOMString getData(DOMString format);