archives

« Bugzilla Issues Index

#4276 — Abrupt completions not handled for HasProperty?


This is almost certainly me not understanding the spec notation and conventions, but guidance appreciated...

In e.g. ToPropertyDescriptor, there are steps like

> If HasProperty(Obj, "enumerable") is true, then

HasProperty(O, P) is defined to return O.[[HasProperty]](P). Since O could e.g. be a proxy, this seems like it could return an abrupt completion.

If that happens, is the error implicitly rethrown, or is it ignored, or...? The "is true" phrasing seems a bit imprecise, whereas for rethrow I would expect something like

1. Let hasPropResult be HasProperty(Obj, "enumerable")
2. ReturnIfAbrupt(hasPropResult)
3. If hasPropResult is true, then...


(In reply to Domenic Denicola from comment #0)
> This is almost certainly me not understanding the spec notation and
> conventions, but guidance appreciated...

No, you're correct. ReturnIfAbrupt is missing after all HasProperty calls in ToPropertyDescriptor.


Hmm ok. I suspect it's a more widespread problem then. It'd be good to audit all "is true" and "is false" occurrences.


(In reply to Domenic Denicola from comment #2)
> Hmm ok. I suspect it's a more widespread problem then. It'd be good to audit
> all "is true" and "is false" occurrences.

I've found only two missing ReturnIfAbrupt calls. (It's unlikely to be a widespread problem, I've tried to be quite strict about missing ReturnIfAbrupt calls in the past, e.g. bug 1778 and several others. So I think we're safe. :-)


15.1.8 Runtime Semantics: GlobalDeclarationInstantiation (script, env)
- step 5.c: HasRestrictedGlobalProperty is fallible

18.2.1.2 Runtime Semantics: EvalDeclarationInstantiation( body, varEnv, lexEnv, strict)
- step 9.a.iv.1.a: CanDeclareGlobalFunction is fallible


fixed in rev39 publication draft