Skip to content

Deprecate EM_LOG_FUNC_PARAMS flag to emscripten_log/emscripten_get_callstack #19820

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

Merged
merged 1 commit into from
Jul 10, 2023

Conversation

sbc100
Copy link
Collaborator

@sbc100 sbc100 commented Jul 10, 2023

Supporting this flag requires using arguments.callee which is deprecated, and won't work if any of functions on the callstack are in strict mode (or are arrow function, which implies strict mode).

The effect of these flag seem to not actually be tested, even though it is used in test_emscripten_log.

@sbc100 sbc100 force-pushed the deprecate_log_func_params branch from 197e803 to f96dc74 Compare July 10, 2023 03:48
@sbc100 sbc100 requested review from kripken and dschuff July 10, 2023 15:57
@sbc100 sbc100 changed the title Deprecate EM_LOG_FUNC_PARAMS flag to emscripten_log/emscripten_get_… Deprecate EM_LOG_FUNC_PARAMS flag to emscripten_log/emscripten_get_callstack Jul 10, 2023
Copy link
Member

@dschuff dschuff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should probably have a changelog entry.

…callstack

Supporting this flag requires using `arguments.callee` which is
deprecated, and won't work if any of functions on the callstack are in
strict mode (or are arrow function, which implies strict mode).

Why any frame in the calling stack is in strict mode this call will
fail with:

```
TypeError: 'caller', 'callee', and 'arguments' properties may not be accessed on strict mode functions or the arguments objects for calls to them
    at traverseStack (emscripten_log.js:941:30)
```

This effects of these flag seem to not actually be tested, even though
it is used in `test_emscripten_log`.
@sbc100 sbc100 force-pushed the deprecate_log_func_params branch from f96dc74 to fd02f94 Compare July 10, 2023 21:15
@sbc100
Copy link
Collaborator Author

sbc100 commented Jul 10, 2023

Done

@sbc100 sbc100 enabled auto-merge (squash) July 10, 2023 21:46
@sbc100 sbc100 disabled auto-merge July 10, 2023 22:14
@sbc100 sbc100 merged commit 81c887b into main Jul 10, 2023
@sbc100 sbc100 deleted the deprecate_log_func_params branch July 10, 2023 22:14
@kripken
Copy link
Member

kripken commented Jul 10, 2023

Side note, I don't think arrow functions imply strict mode. They do have different behavior of this which is maybe more like strict mode, but that's all AFAIK? I see nothing on MDN otherwise.

@sbc100
Copy link
Collaborator Author

sbc100 commented Jul 10, 2023

Side note, I don't think arrow functions imply strict mode. They do have different behavior of this which is maybe more like strict mode, but that's all AFAIK? I see nothing on MDN otherwise.

Ah yes you are right. But its not just this: Arrow functions don't have their own bindings to this, arguments, or super

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants