зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1723838 - Tweak error reported from WebExtensions GenerateWebIDLBindings.py on unexpected type for optional parameters. r=willdurand
Differential Revision: https://phabricator.services.mozilla.com/D167591
This commit is contained in:
Родитель
2424d282f5
Коммит
368a6de598
|
@ -690,9 +690,10 @@ class WebIDLHelpers:
|
|||
# in this method.
|
||||
continue
|
||||
|
||||
api_path = api_fun.api_path_string
|
||||
pname = param["name"]
|
||||
ptype = cls.webidl_type_from_mapping(
|
||||
param,
|
||||
"%s method parameter %s" % (api_fun.api_path_string, param["name"]),
|
||||
param, f"{api_path} method parameter {pname}"
|
||||
)
|
||||
|
||||
if (
|
||||
|
@ -702,12 +703,12 @@ class WebIDLHelpers:
|
|||
):
|
||||
if ptype != "Function":
|
||||
raise TypeError(
|
||||
"unexpected optional type. "
|
||||
"Only Function is expected to be marked as optional"
|
||||
f"unexpected optional type: '{ptype}'. "
|
||||
f"Only Function is expected to be marked as optional: '{api_path}' parameter '{pname}'"
|
||||
)
|
||||
ptype = "optional %s" % ptype
|
||||
ptype = f"optional {ptype}"
|
||||
|
||||
params.append("%s %s" % (ptype, param["name"]))
|
||||
params.append(f"{ptype} {pname}")
|
||||
|
||||
if api_fun.is_async(schema_group):
|
||||
# Add the chrome-compatible callback as an additional optional parameter
|
||||
|
@ -718,7 +719,7 @@ class WebIDLHelpers:
|
|||
# of the schema data for the callback parameter and throws if the expected
|
||||
# parameter is missing).
|
||||
params.append(
|
||||
"optional Function %s" % api_fun.get_async_callback_name(schema_group)
|
||||
f"optional Function {api_fun.get_async_callback_name(schema_group)}"
|
||||
)
|
||||
|
||||
return params
|
||||
|
|
Загрузка…
Ссылка в новой задаче