mirror of
https://github.com/servo/servo.git
synced 2025-06-12 10:24:43 +00:00
Handle exceptions from FindEnumStringIndex correctly.
The previous code would return success from the JSNative with a pending exception, potentially leading to assertion failures inside the JS engine later.
This commit is contained in:
parent
baa3845362
commit
d53841b016
1 changed files with 2 additions and 1 deletions
|
@ -739,13 +739,14 @@ def getJSToNativeConversionTemplate(type, descriptorProvider, failureCode=None,
|
|||
|
||||
template = (
|
||||
"match FindEnumStringIndex(cx, ${val}, %(values)s) {\n"
|
||||
" Err(_) => { %(handleInvalidEnumValueCode)s },\n"
|
||||
" Err(_) => { %(exceptionCode)s },\n"
|
||||
" Ok(None) => { %(handleInvalidEnumValueCode)s },\n"
|
||||
" Ok(Some(index)) => {\n"
|
||||
" //XXXjdm need some range checks up in here.\n"
|
||||
" ${declName} = cast::transmute(index);\n"
|
||||
" },\n"
|
||||
"}" % { "values" : enum + "Values::strings",
|
||||
"exceptionCode" : exceptionCode,
|
||||
"handleInvalidEnumValueCode" : handleInvalidEnumValueCode })
|
||||
|
||||
if defaultValue is not None:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue