Bug 1368949. Stop automatically giving dictionary-typed members of dictionaries a default value of null. r=qdot

This commit is contained in:
Boris Zbarsky 2018-09-25 18:09:30 -04:00
Родитель 6e67dc6934
Коммит 17e28d0bbc
10 изменённых файлов: 83 добавлений и 41 удалений

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

@ -5969,12 +5969,13 @@ def getJSToNativeConversionInfo(type, descriptorProvider, failureCode=None,
return handleJSObjectType(type, isMember, failureCode, exceptionCode, sourceDescription)
if type.isDictionary():
# There are no nullable dictionary arguments or dictionary members
# There are no nullable dictionary-typed arguments or dictionary-typed
# dictionary members.
assert(not type.nullable() or isCallbackReturnValue or
(isMember and isMember != "Dictionary"))
# All optional dictionaries always have default values, so we
# should be able to assume not isOptional here.
assert not isOptional
# All optional dictionary-typed arguments always have default values,
# but dictionary-typed dictionary members can be optional.
assert not isOptional or isMember == "Dictionary"
# In the callback return value case we never have to worry
# about a default value; we always have a value.
assert not isCallbackReturnValue or defaultValue is None
@ -6055,7 +6056,8 @@ def getJSToNativeConversionInfo(type, descriptorProvider, failureCode=None,
declArgs = None
return JSToNativeConversionInfo(template, declType=declType,
declArgs=declArgs)
declArgs=declArgs,
dealWithOptional=isOptional)
if type.isVoid():
assert not isOptional

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

@ -4526,8 +4526,9 @@ class IDLArgument(IDLObjectWithIdentifier):
if ((self.type.isDictionary() or
self.type.isUnion() and self.type.unroll().hasDictionaryType()) and
self.optional and not self.defaultValue and not self.variadic):
# Default optional non-variadic dictionaries to null,
self.optional and not self.defaultValue and not self.variadic and
not self.dictionaryMember):
# Default optional non-variadic dictionary arguments to null,
# for simplicity, so the codegen doesn't have to special-case this.
self.defaultValue = IDLNullValue(self.location)
elif self.type.isAny():

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

@ -20,5 +20,7 @@ dictionary CSPReportProperties {
};
dictionary CSPReport {
CSPReportProperties csp-report;
// We always want to have a "csp-report" property, so just pre-initialize it
// to an empty dictionary..
CSPReportProperties csp-report = null;
};

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

@ -26,11 +26,13 @@ interface CredentialsContainer {
};
dictionary CredentialRequestOptions {
PublicKeyCredentialRequestOptions publicKey;
// FIXME: bug 1493860: should this "= null" be here?
PublicKeyCredentialRequestOptions publicKey = null;
AbortSignal signal;
};
dictionary CredentialCreationOptions {
PublicKeyCredentialCreationOptions publicKey;
// FIXME: bug 1493860: should this "= null" be here?
PublicKeyCredentialCreationOptions publicKey = null;
AbortSignal signal;
};

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

@ -2,6 +2,8 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*
* https://w3c.github.io/deviceorientation/
*/
[NoInterfaceObject]
@ -39,9 +41,12 @@ dictionary DeviceRotationRateInit {
};
dictionary DeviceMotionEventInit : EventInit {
DeviceAccelerationInit acceleration;
DeviceAccelerationInit accelerationIncludingGravity;
DeviceRotationRateInit rotationRate;
// FIXME: bug 1493860: should this "= null" be here?
DeviceAccelerationInit acceleration = null;
// FIXME: bug 1493860: should this "= null" be here?
DeviceAccelerationInit accelerationIncludingGravity = null;
// FIXME: bug 1493860: should this "= null" be here?
DeviceRotationRateInit rotationRate = null;
double? interval = null;
};

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

@ -10,8 +10,10 @@
*/
dictionary MediaConfiguration {
VideoConfiguration video;
AudioConfiguration audio;
// Bug 1493798: This should actually be optional and its members required.
VideoConfiguration video = null;
// Bug 1493798: This should actually be optional and its members required.
AudioConfiguration audio = null;
};
dictionary MediaDecodingConfiguration : MediaConfiguration {

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

@ -42,26 +42,41 @@ typedef (DOMString or sequence<DOMString> or ConstrainDOMStringParameters) Const
// function in MediaManager.cpp to make OverconstrainedError's constraint work!
dictionary MediaTrackConstraintSet {
ConstrainLong width;
ConstrainLong height;
ConstrainDouble frameRate;
ConstrainDOMString facingMode;
// FIXME: bug 1493860 or bug 1493798: should this "= null" be here?
ConstrainLong width = null;
// FIXME: bug 1493860 or bug 1493798: should this "= null" be here?
ConstrainLong height = null;
// FIXME: bug 1493860 or bug 1493798: should this "= null" be here?
ConstrainDouble frameRate = null;
// FIXME: bug 1493860 or bug 1493798: should this "= null" be here?
ConstrainDOMString facingMode = null;
DOMString mediaSource = "camera";
long long browserWindow;
boolean scrollWithPage;
ConstrainDOMString deviceId;
ConstrainLong viewportOffsetX;
ConstrainLong viewportOffsetY;
ConstrainLong viewportWidth;
ConstrainLong viewportHeight;
ConstrainBoolean echoCancellation;
ConstrainBoolean noiseSuppression;
ConstrainBoolean autoGainControl;
ConstrainLong channelCount;
// FIXME: bug 1493860 or bug 1493798: should this "= null" be here?
ConstrainDOMString deviceId = null;
// FIXME: bug 1493860 or bug 1493798: should this "= null" be here?
ConstrainLong viewportOffsetX = null;
// FIXME: bug 1493860 or bug 1493798: should this "= null" be here?
ConstrainLong viewportOffsetY = null;
// FIXME: bug 1493860 or bug 1493798: should this "= null" be here?
ConstrainLong viewportWidth = null;
// FIXME: bug 1493860 or bug 1493798: should this "= null" be here?
ConstrainLong viewportHeight = null;
// FIXME: bug 1493860 or bug 1493798: should this "= null" be here?
ConstrainBoolean echoCancellation = null;
// FIXME: bug 1493860 or bug 1493798: should this "= null" be here?
ConstrainBoolean noiseSuppression = null;
// FIXME: bug 1493860 or bug 1493798: should this "= null" be here?
ConstrainBoolean autoGainControl = null;
// FIXME: bug 1493860 or bug 1493798: should this "= null" be here?
ConstrainLong channelCount = null;
// Deprecated with warnings:
ConstrainBoolean mozNoiseSuppression;
ConstrainBoolean mozAutoGainControl;
// FIXME: bug 1493860 or bug 1493798: should this "= null" be here?
ConstrainBoolean mozNoiseSuppression = null;
// FIXME: bug 1493860 or bug 1493798: should this "= null" be here?
ConstrainBoolean mozAutoGainControl = null;
};
dictionary MediaTrackConstraints : MediaTrackConstraintSet {

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

@ -41,7 +41,8 @@ dictionary PaymentShippingOption {
dictionary PaymentDetailsModifier {
required DOMString supportedMethods;
PaymentItem total;
// FIXME: bug 1493860: should this "= null" be here?
PaymentItem total = null;
sequence<PaymentItem> additionalDisplayItems;
object data;
};
@ -72,8 +73,10 @@ dictionary AddressErrors {
};
dictionary PaymentValidationErrors {
PayerErrorFields payer;
AddressErrors shippingAddress;
// FIXME: bug 1493860: should this "= null" be here?
PayerErrorFields payer = null;
// FIXME: bug 1493860: should this "= null" be here?
AddressErrors shippingAddress = null;
DOMString error;
object paymentMethod;
};
@ -86,10 +89,13 @@ dictionary PayerErrorFields {
dictionary PaymentDetailsUpdate : PaymentDetailsBase {
DOMString error;
AddressErrors shippingAddressErrors;
PayerErrorFields payerErrors;
// FIXME: bug 1493860: should this "= null" be here?
AddressErrors shippingAddressErrors = null;
// FIXME: bug 1493860: should this "= null" be here?
PayerErrorFields payerErrors = null;
object paymentMethodErrors;
PaymentItem total;
// FIXME: bug 1493860: should this "= null" be here?
PaymentItem total = null;
};
enum PaymentShippingType {

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

@ -24,7 +24,10 @@ dictionary PushSubscriptionKeys
dictionary PushSubscriptionJSON
{
USVString endpoint;
PushSubscriptionKeys keys;
// FIXME: bug 1493860: should this "= null" be here? For that matter, this
// PushSubscriptionKeys thing is not even in the spec; "keys" is a record
// there.
PushSubscriptionKeys keys = null;
};
dictionary PushSubscriptionInit

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

@ -52,9 +52,11 @@ dictionary PublicKeyCredentialCreationOptions {
unsigned long timeout;
sequence<PublicKeyCredentialDescriptor> excludeCredentials = [];
AuthenticatorSelectionCriteria authenticatorSelection;
// FIXME: bug 1493860: should this "= null" be here?
AuthenticatorSelectionCriteria authenticatorSelection = null;
AttestationConveyancePreference attestation = "none";
AuthenticationExtensionsClientInputs extensions;
// FIXME: bug 1493860: should this "= null" be here?
AuthenticationExtensionsClientInputs extensions = null;
};
dictionary PublicKeyCredentialEntity {
@ -100,7 +102,8 @@ dictionary PublicKeyCredentialRequestOptions {
USVString rpId;
sequence<PublicKeyCredentialDescriptor> allowCredentials = [];
UserVerificationRequirement userVerification = "preferred";
AuthenticationExtensionsClientInputs extensions;
// FIXME: bug 1493860: should this "= null" be here?
AuthenticationExtensionsClientInputs extensions = null;
};
// TODO - Use partial dictionaries when bug 1436329 is fixed.
@ -125,7 +128,8 @@ dictionary CollectedClientData {
required DOMString origin;
required DOMString hashAlgorithm;
DOMString tokenBindingId;
AuthenticationExtensionsClientInputs clientExtensions;
// FIXME: bug 1493860: should this "= null" be here?
AuthenticationExtensionsClientInputs clientExtensions = null;
AuthenticationExtensionsAuthenticatorInputs authenticatorExtensions;
};