Skip to content

Commit

Permalink
Bug 1569735. Move almost all uses of binaryNames out of Bindings.conf…
Browse files Browse the repository at this point in the history
… 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
  • Loading branch information
bzbarsky committed Aug 28, 2019
1 parent df034cb commit 2b98952
Show file tree
Hide file tree
Showing 21 changed files with 36 additions and 103 deletions.
78 changes: 0 additions & 78 deletions dom/bindings/Bindings.conf
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,6 @@ DOMInterfaces = {
'implicitJSContext': [ 'buffer' ],
},

'AudioNode' : {
'binaryNames': {
'channelCountMode': 'channelCountModeValue',
'channelInterpretation': 'channelInterpretationValue',
},
},

'AudioWorklet': {
'nativeType': 'mozilla::dom::Worklet',
},
Expand Down Expand Up @@ -117,9 +110,6 @@ DOMInterfaces = {
'implicitJSContext': [
'createImageData', 'getImageData', 'isPointInPath', 'isPointInStroke'
],
'binaryNames': {
'mozImageSmoothingEnabled': 'imageSmoothingEnabled'
}
},

'CaretPosition' : {
Expand Down Expand Up @@ -195,7 +185,6 @@ DOMInterfaces = {

'CSSStyleSheet': {
'nativeType': 'mozilla::StyleSheet',
'binaryNames': { 'ownerRule': 'DOMOwnerRule' },
},

'CustomElementRegistry': {
Expand Down Expand Up @@ -226,9 +215,6 @@ DOMInterfaces = {
},

'DOMException': {
'binaryNames': {
'message': 'messageMoz',
},
'implicitJSContext': [ 'filename', 'lineNumber', 'stack' ],
},

Expand Down Expand Up @@ -265,12 +251,6 @@ DOMInterfaces = {
'nativeType': 'nsDOMTokenList',
},

'DynamicsCompressorNode': {
'binaryNames': {
'release': 'getRelease'
},
},

'Element': {
'concrete': True,
},
Expand All @@ -285,9 +265,6 @@ DOMInterfaces = {

'Exception': {
'headerFile': 'mozilla/dom/DOMException.h',
'binaryNames': {
'message': 'messageMoz',
},
'implicitJSContext': [ '__stringifier', 'filename', 'lineNumber', 'stack' ],
},

Expand All @@ -302,9 +279,6 @@ DOMInterfaces = {

'FetchEvent': {
'headerFile': 'ServiceWorkerEvents.h',
'binaryNames': {
'request': 'request_'
},
'implicitJSContext': [ 'respondWith' ],
},

Expand Down Expand Up @@ -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,
},

Expand All @@ -432,13 +397,6 @@ DOMInterfaces = {
'deleteForPrincipal' ],
},

'IDBIndex': {
'binaryNames': {
'mozGetAll': 'getAll',
'mozGetAllKeys': 'getAllKeys',
}
},

'IDBKeyRange': {
'wrapperCache': False,
'concrete': True,
Expand All @@ -450,9 +408,6 @@ DOMInterfaces = {
},

'IDBObjectStore': {
'binaryNames': {
'mozGetAll': 'getAll'
},
'implicitJSContext': [ 'clear' ],
},

Expand All @@ -468,10 +423,6 @@ DOMInterfaces = {
'headerFile': 'IDBEvents.h',
},

'ImageCapture': {
'binaryNames': { 'videoStreamTrack': 'GetVideoStreamTrack' }
},

'ImageData': {
'wrapperCache': False,
},
Expand Down Expand Up @@ -534,10 +485,6 @@ DOMInterfaces = {
'nativeType': 'mozilla::DOMMediaStream'
},

'MediaStreamAudioDestinationNode': {
'binaryNames': { 'stream': 'DOMStream' }
},

'MediaStreamList': {
'headerFile': 'MediaStreamList.h',
},
Expand Down Expand Up @@ -637,12 +584,6 @@ DOMInterfaces = {
'concrete': True,
},

'NotificationEvent': {
'binaryNames': {
'notification': 'notification_'
}
},

'OfflineAudioContext': {
'nativeType': 'mozilla::dom::AudioContext',
},
Expand Down Expand Up @@ -719,16 +660,9 @@ DOMInterfaces = {

'Range': {
'nativeType': 'nsRange',
'binaryNames': {
'__stringifier': 'ToString'
}
},

'Request': {
'binaryNames': {
'headers': 'headers_',
'referrerPolicy': 'referrerPolicy_'
},
'implicitJSContext': [ 'arrayBuffer', 'blob', 'formData', 'json', 'text' ],
},

Expand All @@ -743,7 +677,6 @@ DOMInterfaces = {
},

'Response': {
'binaryNames': { 'headers': 'headers_' },
'implicitJSContext': [ 'arrayBuffer', 'blob', 'formData', 'json', 'text',
'clone', 'cloneUnfiltered' ],
},
Expand Down Expand Up @@ -1023,9 +956,6 @@ DOMInterfaces = {
'SVGTransform': {
'nativeType': 'mozilla::dom::DOMSVGTransform',
'headerFile': 'DOMSVGTransform.h',
'binaryNames': {
"matrix": "GetMatrix"
}
},

'SVGTransformList': {
Expand Down Expand Up @@ -1520,9 +1450,6 @@ DOMInterfaces = {
'Window': {
'nativeType': 'nsGlobalWindowInner',
'headerFile': 'nsGlobalWindow.h',
'binaryNames': {
'postMessage': 'postMessageMoz',
},
'implicitJSContext': [
'createImageBitmap',
'requestIdleCallback'
Expand All @@ -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': {
Expand Down
5 changes: 3 additions & 2 deletions dom/bindings/Configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -562,8 +562,6 @@ def add(key, members, attribute):
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):
Expand All @@ -580,6 +578,9 @@ def isTestInterface(iface):
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 = []
Expand Down
4 changes: 2 additions & 2 deletions dom/webidl/AudioNode.webidl
Original file line number Diff line number Diff line change
Expand Up @@ -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;

};
Expand Down
2 changes: 1 addition & 1 deletion dom/webidl/CSSStyleSheet.webidl
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ enum CSSStyleSheetParsingMode {
};

interface CSSStyleSheet : StyleSheet {
[Pure]
[Pure, BinaryName="DOMOwnerRule"]
readonly attribute CSSRule? ownerRule;
[Throws, NeedsSubjectPrincipal]
readonly attribute CSSRuleList cssRules;
Expand Down
3 changes: 2 additions & 1 deletion dom/webidl/CanvasRenderingContext2D.webidl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions dom/webidl/DOMException.webidl
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;

Expand Down
1 change: 1 addition & 0 deletions dom/webidl/DynamicsCompressorNode.webidl
Original file line number Diff line number Diff line change
Expand Up @@ -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

};
Expand Down
2 changes: 1 addition & 1 deletion dom/webidl/FetchEvent.webidl
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions dom/webidl/HTMLTextAreaElement.webidl
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions dom/webidl/IDBCursor.webidl
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ enum IDBCursorDirection {
interface IDBCursor {
readonly attribute (IDBObjectStore or IDBIndex) source;

[BinaryName="getDirection"]
readonly attribute IDBCursorDirection direction;

[Throws]
Expand Down
13 changes: 5 additions & 8 deletions dom/webidl/IDBIndex.webidl
Original file line number Diff line number Diff line change
Expand Up @@ -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);
};
8 changes: 4 additions & 4 deletions dom/webidl/IDBObjectStore.webidl
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
1 change: 1 addition & 0 deletions dom/webidl/ImageCapture.webidl
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions dom/webidl/MediaStreamAudioDestinationNode.webidl
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,6 @@
[Pref="dom.webaudio.enabled",
Constructor(AudioContext context, optional AudioNodeOptions options = {})]
interface MediaStreamAudioDestinationNode : AudioNode {
[BinaryName="DOMStream"]
readonly attribute MediaStream stream;
};
1 change: 1 addition & 0 deletions dom/webidl/NotificationEvent.webidl
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};

Expand Down
2 changes: 1 addition & 1 deletion dom/webidl/Range.webidl
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ interface Range : AbstractRange {
[Throws]
boolean intersectsNode(Node node);

[Throws]
[Throws, BinaryName="ToString"]
stringifier;
};

Expand Down
3 changes: 2 additions & 1 deletion dom/webidl/Request.webidl
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Loading

0 comments on commit 2b98952

Please sign in to comment.