Bug 1569735. Move almost all uses of binaryNames out of Bindings.conf and into .webidl files. r=peterv

The one exception, apart from tests, is a place where the constructor is being
renamed, because there is no way to support that syntactically yet.  There will
be if https://github.com/heycam/webidl/issues/636 is fixed.

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Boris Zbarsky 2019-08-28 17:51:37 +00:00
Родитель 99a260aa03
Коммит 58b843488c
21 изменённых файлов: 36 добавлений и 103 удалений

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

@ -70,13 +70,6 @@ DOMInterfaces = {
'implicitJSContext': [ 'buffer' ],
},
'AudioNode' : {
'binaryNames': {
'channelCountMode': 'channelCountModeValue',
'channelInterpretation': 'channelInterpretationValue',
},
},
'AudioWorklet': {
'nativeType': 'mozilla::dom::Worklet',
},
@ -117,9 +110,6 @@ DOMInterfaces = {
'implicitJSContext': [
'createImageData', 'getImageData', 'isPointInPath', 'isPointInStroke'
],
'binaryNames': {
'mozImageSmoothingEnabled': 'imageSmoothingEnabled'
}
},
'CaretPosition' : {
@ -195,7 +185,6 @@ DOMInterfaces = {
'CSSStyleSheet': {
'nativeType': 'mozilla::StyleSheet',
'binaryNames': { 'ownerRule': 'DOMOwnerRule' },
},
'CustomElementRegistry': {
@ -226,9 +215,6 @@ DOMInterfaces = {
},
'DOMException': {
'binaryNames': {
'message': 'messageMoz',
},
'implicitJSContext': [ 'filename', 'lineNumber', 'stack' ],
},
@ -265,12 +251,6 @@ DOMInterfaces = {
'nativeType': 'nsDOMTokenList',
},
'DynamicsCompressorNode': {
'binaryNames': {
'release': 'getRelease'
},
},
'Element': {
'concrete': True,
},
@ -285,9 +265,6 @@ DOMInterfaces = {
'Exception': {
'headerFile': 'mozilla/dom/DOMException.h',
'binaryNames': {
'message': 'messageMoz',
},
'implicitJSContext': [ '__stringifier', 'filename', 'lineNumber', 'stack' ],
},
@ -302,9 +279,6 @@ DOMInterfaces = {
'FetchEvent': {
'headerFile': 'ServiceWorkerEvents.h',
'binaryNames': {
'request': 'request_'
},
'implicitJSContext': [ 'respondWith' ],
},
@ -400,21 +374,12 @@ DOMInterfaces = {
'nativeType': 'mozilla::dom::HTMLSharedElement'
},
'HTMLTextAreaElement': {
'binaryNames': {
'textLength': 'getTextLength'
}
},
'HTMLUListElement': {
'nativeType' : 'mozilla::dom::HTMLSharedListElement'
},
'IDBCursor': {
'implicitJSContext': [ 'delete' ],
'binaryNames': {
'direction': 'getDirection'
},
'concrete': True,
},
@ -432,13 +397,6 @@ DOMInterfaces = {
'deleteForPrincipal' ],
},
'IDBIndex': {
'binaryNames': {
'mozGetAll': 'getAll',
'mozGetAllKeys': 'getAllKeys',
}
},
'IDBKeyRange': {
'wrapperCache': False,
'concrete': True,
@ -450,9 +408,6 @@ DOMInterfaces = {
},
'IDBObjectStore': {
'binaryNames': {
'mozGetAll': 'getAll'
},
'implicitJSContext': [ 'clear' ],
},
@ -468,10 +423,6 @@ DOMInterfaces = {
'headerFile': 'IDBEvents.h',
},
'ImageCapture': {
'binaryNames': { 'videoStreamTrack': 'GetVideoStreamTrack' }
},
'ImageData': {
'wrapperCache': False,
},
@ -534,10 +485,6 @@ DOMInterfaces = {
'nativeType': 'mozilla::DOMMediaStream'
},
'MediaStreamAudioDestinationNode': {
'binaryNames': { 'stream': 'DOMStream' }
},
'MediaStreamList': {
'headerFile': 'MediaStreamList.h',
},
@ -637,12 +584,6 @@ DOMInterfaces = {
'concrete': True,
},
'NotificationEvent': {
'binaryNames': {
'notification': 'notification_'
}
},
'OfflineAudioContext': {
'nativeType': 'mozilla::dom::AudioContext',
},
@ -719,16 +660,9 @@ DOMInterfaces = {
'Range': {
'nativeType': 'nsRange',
'binaryNames': {
'__stringifier': 'ToString'
}
},
'Request': {
'binaryNames': {
'headers': 'headers_',
'referrerPolicy': 'referrerPolicy_'
},
'implicitJSContext': [ 'arrayBuffer', 'blob', 'formData', 'json', 'text' ],
},
@ -743,7 +677,6 @@ DOMInterfaces = {
},
'Response': {
'binaryNames': { 'headers': 'headers_' },
'implicitJSContext': [ 'arrayBuffer', 'blob', 'formData', 'json', 'text',
'clone', 'cloneUnfiltered' ],
},
@ -1023,9 +956,6 @@ DOMInterfaces = {
'SVGTransform': {
'nativeType': 'mozilla::dom::DOMSVGTransform',
'headerFile': 'DOMSVGTransform.h',
'binaryNames': {
"matrix": "GetMatrix"
}
},
'SVGTransformList': {
@ -1520,9 +1450,6 @@ DOMInterfaces = {
'Window': {
'nativeType': 'nsGlobalWindowInner',
'headerFile': 'nsGlobalWindow.h',
'binaryNames': {
'postMessage': 'postMessageMoz',
},
'implicitJSContext': [
'createImageBitmap',
'requestIdleCallback'
@ -1548,11 +1475,6 @@ DOMInterfaces = {
'WorkerGlobalScope': {
'headerFile': 'mozilla/dom/WorkerScope.h',
'implicitJSContext': [ 'createImageBitmap', 'importScripts' ],
# Rename a few things so we don't have both classes and methods
# with the same name
'binaryNames': {
'performance': 'getPerformance',
},
},
'Worklet': {

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

@ -562,8 +562,6 @@ class Descriptor(DescriptorProvider):
addExtendedAttribute(attribute, desc.get(attribute, {}))
self._binaryNames = desc.get('binaryNames', {})
self._binaryNames.setdefault('__legacycaller', 'LegacyCall')
self._binaryNames.setdefault('__stringifier', 'Stringify')
if not self.interface.isExternal():
def isTestInterface(iface):
@ -580,6 +578,9 @@ class Descriptor(DescriptorProvider):
assert len(binaryName) == 1
self._binaryNames.setdefault(member.identifier.name,
binaryName[0])
# Some default binary names for cases when nothing else got set.
self._binaryNames.setdefault('__legacycaller', 'LegacyCall')
self._binaryNames.setdefault('__stringifier', 'Stringify')
# Build the prototype chain.
self.prototypeChain = []

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

@ -56,9 +56,9 @@ interface AudioNode : EventTarget {
// Channel up-mixing and down-mixing rules for all inputs.
[SetterThrows]
attribute unsigned long channelCount;
[SetterThrows]
[SetterThrows, BinaryName="channelCountModeValue"]
attribute ChannelCountMode channelCountMode;
[SetterThrows]
[SetterThrows, BinaryName="channelInterpretationValue"]
attribute ChannelInterpretation channelInterpretation;
};

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

@ -14,7 +14,7 @@ enum CSSStyleSheetParsingMode {
};
interface CSSStyleSheet : StyleSheet {
[Pure]
[Pure, BinaryName="DOMOwnerRule"]
readonly attribute CSSRule? ownerRule;
[Throws, NeedsSubjectPrincipal]
readonly attribute CSSRuleList cssRules;

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

@ -52,7 +52,8 @@ interface CanvasRenderingContext2D {
// image smoothing mode -- if disabled, images won't be smoothed
// if scaled.
[Deprecated="PrefixedImageSmoothingEnabled"]
[Deprecated="PrefixedImageSmoothingEnabled",
BinaryName="imageSmoothingEnabled"]
attribute boolean mozImageSmoothingEnabled;
// Show the caret if appropriate when drawing

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

@ -56,6 +56,7 @@ interface Exception {
// The name of the error code (ie, a string repr of |result|).
readonly attribute DOMString name;
// A custom message set by the thrower.
[BinaryName="messageMoz"]
readonly attribute DOMString message;
// A generic formatter - make it suitable to print, etc.
stringifier;
@ -72,6 +73,7 @@ interface DOMException {
// The name of the error code (ie, a string repr of |result|).
readonly attribute DOMString name;
// A custom message set by the thrower.
[BinaryName="messageMoz"]
readonly attribute DOMString message;
readonly attribute unsigned short code;

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

@ -27,6 +27,7 @@ interface DynamicsCompressorNode : AudioNode {
readonly attribute AudioParam ratio; // unit-less
readonly attribute float reduction; // in Decibels
readonly attribute AudioParam attack; // in Seconds
[BinaryName="getRelease"]
readonly attribute AudioParam release; // in Seconds
};

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

@ -11,7 +11,7 @@
Func="ServiceWorkerVisible",
Exposed=(ServiceWorker)]
interface FetchEvent : ExtendableEvent {
[SameObject] readonly attribute Request request;
[SameObject, BinaryName="request_"] readonly attribute Request request;
readonly attribute DOMString clientId;
readonly attribute DOMString resultingClientId;
readonly attribute boolean isReload;

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

@ -50,6 +50,7 @@ interface HTMLTextAreaElement : HTMLElement {
[CEReactions, Throws, Pure]
attribute DOMString defaultValue;
[CEReactions, SetterThrows] attribute [TreatNullAs=EmptyString] DOMString value;
[BinaryName="getTextLength"]
readonly attribute unsigned long textLength;
readonly attribute boolean willValidate;

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

@ -18,6 +18,7 @@ enum IDBCursorDirection {
interface IDBCursor {
readonly attribute (IDBObjectStore or IDBIndex) source;
[BinaryName="getDirection"]
readonly attribute IDBCursorDirection direction;
[Throws]

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

@ -57,15 +57,12 @@ interface IDBIndex {
};
partial interface IDBIndex {
[Throws]
IDBRequest mozGetAll (optional any key, optional [EnforceRange] unsigned long limit);
[Throws]
IDBRequest mozGetAllKeys (optional any key, optional [EnforceRange] unsigned long limit);
[Throws]
// If we decide to add use counters for the mozGetAll/mozGetAllKeys
// functions, we'll need to pull them out into sepatate operations
// with a BinaryName mapping to the same underlying implementation.
[Throws, Alias="mozGetAll"]
IDBRequest getAll (optional any key, optional [EnforceRange] unsigned long limit);
[Throws]
[Throws, Alias="mozGetAllKeys"]
IDBRequest getAllKeys (optional any key, optional [EnforceRange] unsigned long limit);
};

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

@ -60,10 +60,10 @@ interface IDBObjectStore {
partial interface IDBObjectStore {
// Success fires IDBTransactionEvent, result == array of values for given keys
[Throws]
IDBRequest mozGetAll (optional any key, optional [EnforceRange] unsigned long limit);
[Throws]
// If we decide to add use a counter for the mozGetAll function, we'll need
// to pull it out into a sepatate operation with a BinaryName mapping to the
// same underlying implementation.
[Throws, Alias="mozGetAll"]
IDBRequest getAll (optional any key, optional [EnforceRange] unsigned long limit);
[Throws]

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

@ -13,6 +13,7 @@
[Pref="dom.imagecapture.enabled", Constructor(MediaStreamTrack track)]
interface ImageCapture : EventTarget {
// readonly attribute PhotoSettingsOptions photoSettingsOptions;
[BinaryName="GetVideoStreamTrack"]
readonly attribute MediaStreamTrack videoStreamTrack;
attribute EventHandler onphoto;
attribute EventHandler onerror;

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

@ -13,5 +13,6 @@
[Pref="dom.webaudio.enabled",
Constructor(AudioContext context, optional AudioNodeOptions options = {})]
interface MediaStreamAudioDestinationNode : AudioNode {
[BinaryName="DOMStream"]
readonly attribute MediaStream stream;
};

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

@ -14,6 +14,7 @@
[Constructor(DOMString type, NotificationEventInit eventInitDict),
Exposed=ServiceWorker,Func="mozilla::dom::Notification::PrefEnabled"]
interface NotificationEvent : ExtendableEvent {
[BinaryName="notification_"]
readonly attribute Notification notification;
};

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

@ -64,7 +64,7 @@ interface Range : AbstractRange {
[Throws]
boolean intersectsNode(Node node);
[Throws]
[Throws, BinaryName="ToString"]
stringifier;
};

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

@ -15,10 +15,11 @@ typedef unsigned long nsContentPolicyType;
interface Request {
readonly attribute ByteString method;
readonly attribute USVString url;
[SameObject] readonly attribute Headers headers;
[SameObject, BinaryName="headers_"] readonly attribute Headers headers;
readonly attribute RequestDestination destination;
readonly attribute USVString referrer;
[BinaryName="referrerPolicy_"]
readonly attribute ReferrerPolicy referrerPolicy;
readonly attribute RequestMode mode;
readonly attribute RequestCredentials credentials;

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

@ -23,7 +23,7 @@ interface Response {
readonly attribute unsigned short status;
readonly attribute boolean ok;
readonly attribute ByteString statusText;
[SameObject] readonly attribute Headers headers;
[SameObject, BinaryName="headers_"] readonly attribute Headers headers;
[Throws,
NewObject] Response clone();

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

@ -22,6 +22,7 @@ interface SVGTransform {
const unsigned short SVG_TRANSFORM_SKEWY = 6;
readonly attribute unsigned short type;
[BinaryName="getMatrix"]
readonly attribute SVGMatrix matrix;
readonly attribute float angle;

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

@ -81,9 +81,11 @@ typedef OfflineResourceList ApplicationCache;
[Throws, Pref="dom.enable_window_print"]
void print();
[Throws, CrossOriginCallable, NeedsSubjectPrincipal]
[Throws, CrossOriginCallable, NeedsSubjectPrincipal,
BinaryName="postMessageMoz"]
void postMessage(any message, DOMString targetOrigin, optional sequence<object> transfer = []);
[Throws, CrossOriginCallable, NeedsSubjectPrincipal]
[Throws, CrossOriginCallable, NeedsSubjectPrincipal,
BinaryName="postMessageMoz"]
void postMessage(any message, optional WindowPostMessageOptions options = {});
// also has obsolete members

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

@ -45,7 +45,7 @@ partial interface WorkerGlobalScope {
void dump(optional DOMString str);
// https://w3c.github.io/hr-time/#the-performance-attribute
[Constant, Cached, Replaceable]
[Constant, Cached, Replaceable, BinaryName="getPerformance"]
readonly attribute Performance performance;
[Func="WorkerGlobalScope::IsInAutomation", Throws]