Skip to content

Commit 58b8434

Browse files
committed
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 whatwg/webidl#636 is fixed. Differential Revision: https://phabricator.services.mozilla.com/D39792 --HG-- extra : moz-landing-system : lando
1 parent 99a260a commit 58b8434

21 files changed

+36
-103
lines changed

dom/bindings/Bindings.conf

Lines changed: 0 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -70,13 +70,6 @@ DOMInterfaces = {
7070
'implicitJSContext': [ 'buffer' ],
7171
},
7272

73-
'AudioNode' : {
74-
'binaryNames': {
75-
'channelCountMode': 'channelCountModeValue',
76-
'channelInterpretation': 'channelInterpretationValue',
77-
},
78-
},
79-
8073
'AudioWorklet': {
8174
'nativeType': 'mozilla::dom::Worklet',
8275
},
@@ -117,9 +110,6 @@ DOMInterfaces = {
117110
'implicitJSContext': [
118111
'createImageData', 'getImageData', 'isPointInPath', 'isPointInStroke'
119112
],
120-
'binaryNames': {
121-
'mozImageSmoothingEnabled': 'imageSmoothingEnabled'
122-
}
123113
},
124114

125115
'CaretPosition' : {
@@ -195,7 +185,6 @@ DOMInterfaces = {
195185

196186
'CSSStyleSheet': {
197187
'nativeType': 'mozilla::StyleSheet',
198-
'binaryNames': { 'ownerRule': 'DOMOwnerRule' },
199188
},
200189

201190
'CustomElementRegistry': {
@@ -226,9 +215,6 @@ DOMInterfaces = {
226215
},
227216

228217
'DOMException': {
229-
'binaryNames': {
230-
'message': 'messageMoz',
231-
},
232218
'implicitJSContext': [ 'filename', 'lineNumber', 'stack' ],
233219
},
234220

@@ -265,12 +251,6 @@ DOMInterfaces = {
265251
'nativeType': 'nsDOMTokenList',
266252
},
267253

268-
'DynamicsCompressorNode': {
269-
'binaryNames': {
270-
'release': 'getRelease'
271-
},
272-
},
273-
274254
'Element': {
275255
'concrete': True,
276256
},
@@ -285,9 +265,6 @@ DOMInterfaces = {
285265

286266
'Exception': {
287267
'headerFile': 'mozilla/dom/DOMException.h',
288-
'binaryNames': {
289-
'message': 'messageMoz',
290-
},
291268
'implicitJSContext': [ '__stringifier', 'filename', 'lineNumber', 'stack' ],
292269
},
293270

@@ -302,9 +279,6 @@ DOMInterfaces = {
302279

303280
'FetchEvent': {
304281
'headerFile': 'ServiceWorkerEvents.h',
305-
'binaryNames': {
306-
'request': 'request_'
307-
},
308282
'implicitJSContext': [ 'respondWith' ],
309283
},
310284

@@ -400,21 +374,12 @@ DOMInterfaces = {
400374
'nativeType': 'mozilla::dom::HTMLSharedElement'
401375
},
402376

403-
'HTMLTextAreaElement': {
404-
'binaryNames': {
405-
'textLength': 'getTextLength'
406-
}
407-
},
408-
409377
'HTMLUListElement': {
410378
'nativeType' : 'mozilla::dom::HTMLSharedListElement'
411379
},
412380

413381
'IDBCursor': {
414382
'implicitJSContext': [ 'delete' ],
415-
'binaryNames': {
416-
'direction': 'getDirection'
417-
},
418383
'concrete': True,
419384
},
420385

@@ -432,13 +397,6 @@ DOMInterfaces = {
432397
'deleteForPrincipal' ],
433398
},
434399

435-
'IDBIndex': {
436-
'binaryNames': {
437-
'mozGetAll': 'getAll',
438-
'mozGetAllKeys': 'getAllKeys',
439-
}
440-
},
441-
442400
'IDBKeyRange': {
443401
'wrapperCache': False,
444402
'concrete': True,
@@ -450,9 +408,6 @@ DOMInterfaces = {
450408
},
451409

452410
'IDBObjectStore': {
453-
'binaryNames': {
454-
'mozGetAll': 'getAll'
455-
},
456411
'implicitJSContext': [ 'clear' ],
457412
},
458413

@@ -468,10 +423,6 @@ DOMInterfaces = {
468423
'headerFile': 'IDBEvents.h',
469424
},
470425

471-
'ImageCapture': {
472-
'binaryNames': { 'videoStreamTrack': 'GetVideoStreamTrack' }
473-
},
474-
475426
'ImageData': {
476427
'wrapperCache': False,
477428
},
@@ -534,10 +485,6 @@ DOMInterfaces = {
534485
'nativeType': 'mozilla::DOMMediaStream'
535486
},
536487

537-
'MediaStreamAudioDestinationNode': {
538-
'binaryNames': { 'stream': 'DOMStream' }
539-
},
540-
541488
'MediaStreamList': {
542489
'headerFile': 'MediaStreamList.h',
543490
},
@@ -637,12 +584,6 @@ DOMInterfaces = {
637584
'concrete': True,
638585
},
639586

640-
'NotificationEvent': {
641-
'binaryNames': {
642-
'notification': 'notification_'
643-
}
644-
},
645-
646587
'OfflineAudioContext': {
647588
'nativeType': 'mozilla::dom::AudioContext',
648589
},
@@ -719,16 +660,9 @@ DOMInterfaces = {
719660

720661
'Range': {
721662
'nativeType': 'nsRange',
722-
'binaryNames': {
723-
'__stringifier': 'ToString'
724-
}
725663
},
726664

727665
'Request': {
728-
'binaryNames': {
729-
'headers': 'headers_',
730-
'referrerPolicy': 'referrerPolicy_'
731-
},
732666
'implicitJSContext': [ 'arrayBuffer', 'blob', 'formData', 'json', 'text' ],
733667
},
734668

@@ -743,7 +677,6 @@ DOMInterfaces = {
743677
},
744678

745679
'Response': {
746-
'binaryNames': { 'headers': 'headers_' },
747680
'implicitJSContext': [ 'arrayBuffer', 'blob', 'formData', 'json', 'text',
748681
'clone', 'cloneUnfiltered' ],
749682
},
@@ -1023,9 +956,6 @@ DOMInterfaces = {
1023956
'SVGTransform': {
1024957
'nativeType': 'mozilla::dom::DOMSVGTransform',
1025958
'headerFile': 'DOMSVGTransform.h',
1026-
'binaryNames': {
1027-
"matrix": "GetMatrix"
1028-
}
1029959
},
1030960

1031961
'SVGTransformList': {
@@ -1520,9 +1450,6 @@ DOMInterfaces = {
15201450
'Window': {
15211451
'nativeType': 'nsGlobalWindowInner',
15221452
'headerFile': 'nsGlobalWindow.h',
1523-
'binaryNames': {
1524-
'postMessage': 'postMessageMoz',
1525-
},
15261453
'implicitJSContext': [
15271454
'createImageBitmap',
15281455
'requestIdleCallback'
@@ -1548,11 +1475,6 @@ DOMInterfaces = {
15481475
'WorkerGlobalScope': {
15491476
'headerFile': 'mozilla/dom/WorkerScope.h',
15501477
'implicitJSContext': [ 'createImageBitmap', 'importScripts' ],
1551-
# Rename a few things so we don't have both classes and methods
1552-
# with the same name
1553-
'binaryNames': {
1554-
'performance': 'getPerformance',
1555-
},
15561478
},
15571479

15581480
'Worklet': {

dom/bindings/Configuration.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -562,8 +562,6 @@ def add(key, members, attribute):
562562
addExtendedAttribute(attribute, desc.get(attribute, {}))
563563

564564
self._binaryNames = desc.get('binaryNames', {})
565-
self._binaryNames.setdefault('__legacycaller', 'LegacyCall')
566-
self._binaryNames.setdefault('__stringifier', 'Stringify')
567565

568566
if not self.interface.isExternal():
569567
def isTestInterface(iface):
@@ -580,6 +578,9 @@ def isTestInterface(iface):
580578
assert len(binaryName) == 1
581579
self._binaryNames.setdefault(member.identifier.name,
582580
binaryName[0])
581+
# Some default binary names for cases when nothing else got set.
582+
self._binaryNames.setdefault('__legacycaller', 'LegacyCall')
583+
self._binaryNames.setdefault('__stringifier', 'Stringify')
583584

584585
# Build the prototype chain.
585586
self.prototypeChain = []

dom/webidl/AudioNode.webidl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,9 @@ interface AudioNode : EventTarget {
5656
// Channel up-mixing and down-mixing rules for all inputs.
5757
[SetterThrows]
5858
attribute unsigned long channelCount;
59-
[SetterThrows]
59+
[SetterThrows, BinaryName="channelCountModeValue"]
6060
attribute ChannelCountMode channelCountMode;
61-
[SetterThrows]
61+
[SetterThrows, BinaryName="channelInterpretationValue"]
6262
attribute ChannelInterpretation channelInterpretation;
6363

6464
};

dom/webidl/CSSStyleSheet.webidl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ enum CSSStyleSheetParsingMode {
1414
};
1515

1616
interface CSSStyleSheet : StyleSheet {
17-
[Pure]
17+
[Pure, BinaryName="DOMOwnerRule"]
1818
readonly attribute CSSRule? ownerRule;
1919
[Throws, NeedsSubjectPrincipal]
2020
readonly attribute CSSRuleList cssRules;

dom/webidl/CanvasRenderingContext2D.webidl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@ interface CanvasRenderingContext2D {
5252

5353
// image smoothing mode -- if disabled, images won't be smoothed
5454
// if scaled.
55-
[Deprecated="PrefixedImageSmoothingEnabled"]
55+
[Deprecated="PrefixedImageSmoothingEnabled",
56+
BinaryName="imageSmoothingEnabled"]
5657
attribute boolean mozImageSmoothingEnabled;
5758

5859
// Show the caret if appropriate when drawing

dom/webidl/DOMException.webidl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ interface Exception {
5656
// The name of the error code (ie, a string repr of |result|).
5757
readonly attribute DOMString name;
5858
// A custom message set by the thrower.
59+
[BinaryName="messageMoz"]
5960
readonly attribute DOMString message;
6061
// A generic formatter - make it suitable to print, etc.
6162
stringifier;
@@ -72,6 +73,7 @@ interface DOMException {
7273
// The name of the error code (ie, a string repr of |result|).
7374
readonly attribute DOMString name;
7475
// A custom message set by the thrower.
76+
[BinaryName="messageMoz"]
7577
readonly attribute DOMString message;
7678
readonly attribute unsigned short code;
7779

dom/webidl/DynamicsCompressorNode.webidl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ interface DynamicsCompressorNode : AudioNode {
2727
readonly attribute AudioParam ratio; // unit-less
2828
readonly attribute float reduction; // in Decibels
2929
readonly attribute AudioParam attack; // in Seconds
30+
[BinaryName="getRelease"]
3031
readonly attribute AudioParam release; // in Seconds
3132

3233
};

dom/webidl/FetchEvent.webidl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
Func="ServiceWorkerVisible",
1212
Exposed=(ServiceWorker)]
1313
interface FetchEvent : ExtendableEvent {
14-
[SameObject] readonly attribute Request request;
14+
[SameObject, BinaryName="request_"] readonly attribute Request request;
1515
readonly attribute DOMString clientId;
1616
readonly attribute DOMString resultingClientId;
1717
readonly attribute boolean isReload;

dom/webidl/HTMLTextAreaElement.webidl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ interface HTMLTextAreaElement : HTMLElement {
5050
[CEReactions, Throws, Pure]
5151
attribute DOMString defaultValue;
5252
[CEReactions, SetterThrows] attribute [TreatNullAs=EmptyString] DOMString value;
53+
[BinaryName="getTextLength"]
5354
readonly attribute unsigned long textLength;
5455

5556
readonly attribute boolean willValidate;

dom/webidl/IDBCursor.webidl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ enum IDBCursorDirection {
1818
interface IDBCursor {
1919
readonly attribute (IDBObjectStore or IDBIndex) source;
2020

21+
[BinaryName="getDirection"]
2122
readonly attribute IDBCursorDirection direction;
2223

2324
[Throws]

dom/webidl/IDBIndex.webidl

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -57,15 +57,12 @@ interface IDBIndex {
5757
};
5858

5959
partial interface IDBIndex {
60-
[Throws]
61-
IDBRequest mozGetAll (optional any key, optional [EnforceRange] unsigned long limit);
62-
63-
[Throws]
64-
IDBRequest mozGetAllKeys (optional any key, optional [EnforceRange] unsigned long limit);
65-
66-
[Throws]
60+
// If we decide to add use counters for the mozGetAll/mozGetAllKeys
61+
// functions, we'll need to pull them out into sepatate operations
62+
// with a BinaryName mapping to the same underlying implementation.
63+
[Throws, Alias="mozGetAll"]
6764
IDBRequest getAll (optional any key, optional [EnforceRange] unsigned long limit);
6865

69-
[Throws]
66+
[Throws, Alias="mozGetAllKeys"]
7067
IDBRequest getAllKeys (optional any key, optional [EnforceRange] unsigned long limit);
7168
};

dom/webidl/IDBObjectStore.webidl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,10 @@ interface IDBObjectStore {
6060

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

6969
[Throws]

dom/webidl/ImageCapture.webidl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
[Pref="dom.imagecapture.enabled", Constructor(MediaStreamTrack track)]
1414
interface ImageCapture : EventTarget {
1515
// readonly attribute PhotoSettingsOptions photoSettingsOptions;
16+
[BinaryName="GetVideoStreamTrack"]
1617
readonly attribute MediaStreamTrack videoStreamTrack;
1718
attribute EventHandler onphoto;
1819
attribute EventHandler onerror;

dom/webidl/MediaStreamAudioDestinationNode.webidl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,6 @@
1313
[Pref="dom.webaudio.enabled",
1414
Constructor(AudioContext context, optional AudioNodeOptions options = {})]
1515
interface MediaStreamAudioDestinationNode : AudioNode {
16+
[BinaryName="DOMStream"]
1617
readonly attribute MediaStream stream;
1718
};

dom/webidl/NotificationEvent.webidl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
[Constructor(DOMString type, NotificationEventInit eventInitDict),
1515
Exposed=ServiceWorker,Func="mozilla::dom::Notification::PrefEnabled"]
1616
interface NotificationEvent : ExtendableEvent {
17+
[BinaryName="notification_"]
1718
readonly attribute Notification notification;
1819
};
1920

dom/webidl/Range.webidl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ interface Range : AbstractRange {
6464
[Throws]
6565
boolean intersectsNode(Node node);
6666

67-
[Throws]
67+
[Throws, BinaryName="ToString"]
6868
stringifier;
6969
};
7070

dom/webidl/Request.webidl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,11 @@ typedef unsigned long nsContentPolicyType;
1515
interface Request {
1616
readonly attribute ByteString method;
1717
readonly attribute USVString url;
18-
[SameObject] readonly attribute Headers headers;
18+
[SameObject, BinaryName="headers_"] readonly attribute Headers headers;
1919

2020
readonly attribute RequestDestination destination;
2121
readonly attribute USVString referrer;
22+
[BinaryName="referrerPolicy_"]
2223
readonly attribute ReferrerPolicy referrerPolicy;
2324
readonly attribute RequestMode mode;
2425
readonly attribute RequestCredentials credentials;

0 commit comments

Comments
 (0)