-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Editorial: Can-call-user-code annotation #2548
Conversation
A false positive is https://ci.tc39.es/preview/tc39/ecma262/sha/a5ba1ae3a48e8cffb1e6051bc97dceace591af20/#sec-createregexpstringiterator. iow, technically if you called that AO with a user-provided regex, the annotations are correct; but it's only ever called with a spec-fiction-regex, so they're not. there's probably a similar case with async iteration. |
2821943
to
aa792d5
Compare
As a concrete example of a place the analysis fails for abstract closures, Another thing is Other than the The various Reflect methods call the MOP methods of their argument and do not mark that as calling user code. For example, Similarly, IsExtensible calls |
So by my reading GeneratorYield() can also never return abrupt completions, yeah? |
From the perspective of the consumer of ("Return" is kind of a funny word here, because of the execution context stack manipulation - the "Return" in |
Ah, of course, when it "returns" upon abnormal resumption. |
aa792d5
to
979f09f
Compare
The Abstract Closure stuff won't be correct in the preview until tc39/ecmarkup#382 is merged and bumped here. |
Done. |
Below lists are not comprehensive. False negatives:
False positives:
Other issues:
|
My preference is to add the Edit: Actually, I think I misunderstood your suggestion for special casing. You're not talking about just marking a surrounding AO that has it as a root, but actually rendering the UC for the phrase "the result of evaluating |Foo|". That sounds right and does deserve ecmarkup handling, there are a hundreds of occurrences. But still it does the extra pass that I'm not thrilled about... |
Right.
Ehh... you can just stick We could do it properly, probably in ecmarkdown, but that's... more work. |
Done
Done in tc39/ecmarkup#385
Done in tc39/ecmarkup#385
Done
I opted to leave these to be automatically fixed later when they get a
Done
Done
Done
Done in tc39/ecmarkup#385
Done in tc39/ecmarkup#385 |
Few more things:
Didn't spot anything else wrong in some random spot-checks, except for the aforementioned DefinePropertyOrThrow issues (plus CreateMappedArgumentsObject step 19.b.ii.3, which should really be a |
I'll make a separate PR that changes these to "of" instead. |
Note that 9a55c12 depends on tc39/ecmarkup#388. |
You missed Edit: pushed a commit fixing. |
30516d4
to
8af652d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Found a few false positives in the internal methods for various exotic objects.
-
In the internal methods for Arguments exotic objects, none of the things which operate on [[ParameterMap]] (usually spelled
_map_
) can invoke user code, since [[ParameterMap]] is an entirely spec-fictional object. Nor can the OrdinaryDelete call in the [[Delete]] section, since a user can't trap that call. (The Get and Set calls on the arguments object itself can still invoke user code, since a user can add getters/setters to the arguments object.) -
In the
[[Delete]]
semantics for Integer-Indexed exotic objects, the call to OrdinaryDelete can't call user code, because the only step in OrdinaryDelete which calls user code is the invocation of[[GetOwnProperty]]
, and we know the[[GetOwnProperty]]
semantics for Integer-Indexed exotic objects doesn't call user code. (In fact it also doesn't throw, so I think the? OrdinaryDelete
here could become! OrdinaryDelete
.) -
None of the internal methods of module namespace exotic objects can invoke use code.
Otherwise LGTM. I'm sure there's remaining false positives and potentially false negatives, but I didn't see any except for those already mentioned when spot-checking stuff.
A surprisingly small diff, in the end, and would be smaller still if ecmarkup understood concrete and/or internal methods.
I feel like this is also one of those things better fixed by correct prefixes of Also interested in @michaelficarra's thoughts whether we should be more eager with manual suppressions for cases that could be getting fixed via
This is just a 1 liner so I've changed this to a
I'd also like these to be automatically fixed by switching to |
Fine with me.
Well, in a couple cases cases ( And in a couple cases the operation can actually throw - calls to |
Good point, done. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM otherwise. Only missing suppressions I saw while reviewing the rendering will be suppressed by !
in the future. All the manual suppressions and annotations in this PR look correct. I didn't check for missing suppressions/annotations. I also didn't check whether the suppressions/annotations were necessary; I assume ecmarkup would complain for any it could determine through propagation.
That's not currently implemented, but I've added it to the backlog for the linter. Since there wouldn't be any difference in the rendered output, I don't think landing that check needs to block this PR. (I don't think there are currently any redundant ones, though.) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Still some known false positives but that's fine.
@ljharb When you merge this, please squash. There's no value in keeping the separate commits for this. |
Co-authored-by: Shu-yu Guo <[email protected]> Co-authored-by: Kevin Gibbons <[email protected]>
0fc1e8b
to
4cba6f7
Compare
I may be blind, but is this supposed to be visible in the output? I cannot seem to find any differences in the live spec, although if I inspect element I do see various |
@domenic Hit |
(PR tc39#2548 unfolded many invocations of Yield, but didn't change the accompanying Note-steps.)
(PR tc39#2548 unfolded many invocations of Yield, but didn't change the accompanying Note-steps.)
(PR tc39#2548 unfolded many invocations of Yield, but didn't change the accompanying Note-steps.)
This PR adds an annotation to call sites of AOs and SDOs that can call user code, possibly transitively.
Ecmarkup starts with a set of "roots" that can call user code, and propagates the effect to all reachable AO and SDO invocations.
For spec authors:
<emu-meta effects="user-code">root cause</emu-meta>
.<emu-meta suppress-effects="user-code">suppressed</emu-meta>
.1. [fence-effects="user-code"] Step
, which fences any child step effects from propagating.