summaryrefslogtreecommitdiffstats
path: root/dom/bindings
diff options
context:
space:
mode:
authorJustOff <Off.Just.Off@gmail.com>2019-03-13 18:49:40 +0200
committerJustOff <Off.Just.Off@gmail.com>2019-03-13 18:49:40 +0200
commitcfcba2402e625f94cf08acd3b6410d7513ba0b2e (patch)
tree35f394214359b7c2fb6bd766461ce4894d17eb1d /dom/bindings
parent5a10462a92197769cc7af04287c6315fa8961dcd (diff)
downloadUXP-cfcba2402e625f94cf08acd3b6410d7513ba0b2e.tar
UXP-cfcba2402e625f94cf08acd3b6410d7513ba0b2e.tar.gz
UXP-cfcba2402e625f94cf08acd3b6410d7513ba0b2e.tar.lz
UXP-cfcba2402e625f94cf08acd3b6410d7513ba0b2e.tar.xz
UXP-cfcba2402e625f94cf08acd3b6410d7513ba0b2e.zip
Fix up some minor issues with default value handling in codegen
Diffstat (limited to 'dom/bindings')
-rw-r--r--dom/bindings/Codegen.py14
1 files changed, 9 insertions, 5 deletions
diff --git a/dom/bindings/Codegen.py b/dom/bindings/Codegen.py
index fd811bb3a..378ecf737 100644
--- a/dom/bindings/Codegen.py
+++ b/dom/bindings/Codegen.py
@@ -4290,6 +4290,9 @@ class JSToNativeConversionInfo():
for whether we have a JS::Value. Only used when
defaultValue is not None or when True is passed for
checkForValue to instantiateJSToNativeConversion.
+ This expression may not be already-parenthesized, so if
+ you use it with && or || make sure to put parens
+ around it.
${passedToJSImpl} replaced by an expression that evaluates to a boolean
for whether this value is being passed to a JS-
implemented interface.
@@ -5146,7 +5149,7 @@ def getJSToNativeConversionInfo(type, descriptorProvider, failureCode=None,
if isinstance(defaultValue, IDLNullValue):
extraConditionForNull = "!(${haveValue}) || "
else:
- extraConditionForNull = "${haveValue} && "
+ extraConditionForNull = "(${haveValue}) && "
else:
extraConditionForNull = ""
templateBody = handleNull(templateBody, declLoc,
@@ -5690,7 +5693,7 @@ def getJSToNativeConversionInfo(type, descriptorProvider, failureCode=None,
haveCallable = "${val}.isObject() && " + haveCallable
if defaultValue is not None:
assert(isinstance(defaultValue, IDLNullValue))
- haveCallable = "${haveValue} && " + haveCallable
+ haveCallable = "(${haveValue}) && " + haveCallable
template = (
("if (%s) {\n" % haveCallable) +
conversion +
@@ -5702,7 +5705,7 @@ def getJSToNativeConversionInfo(type, descriptorProvider, failureCode=None,
haveObject = "${val}.isObject()"
if defaultValue is not None:
assert(isinstance(defaultValue, IDLNullValue))
- haveObject = "${haveValue} && " + haveObject
+ haveObject = "(${haveValue}) && " + haveObject
template = CGIfElseWrapper(haveObject,
CGGeneric(conversion),
CGGeneric("${declName} = nullptr;\n")).define()
@@ -5770,8 +5773,9 @@ def getJSToNativeConversionInfo(type, descriptorProvider, failureCode=None,
return handleJSObjectType(type, isMember, failureCode, exceptionCode, sourceDescription)
if type.isDictionary():
- # There are no nullable dictionaries
- assert not type.nullable() or isCallbackReturnValue
+ # There are no nullable dictionary arguments or 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