-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
dart2js crashes when catching a JS string in strict mode #53105
Labels
area-web
Use area-web for Dart web related issues, including the DDC and dart2js compilers and JS interop.
web-dart2js
Comments
nex3
added a commit
to google/dart_cli_pkg
that referenced
this issue
Aug 3, 2023
This encapsulates a workaround for dart-lang/sdk#53105.
nex3
added a commit
to google/dart_cli_pkg
that referenced
this issue
Aug 7, 2023
This encapsulates a workaround for dart-lang/sdk#53105.
nex3
added a commit
to sass/dart-sass
that referenced
this issue
Aug 8, 2023
copybara-service bot
pushed a commit
that referenced
this issue
Aug 18, 2023
Avoid trying to add a property to a non-object exception value to cache the stack trace. In "use strict" mode this is an error. Otherwise the property is added to an ephemeral Object and then lost. The observable behaviour is unchanged - returning a fresh `_StackTrace` object each time. Bug: #53105 Change-Id: I406ff14db4ed24b71e0cfe95cd87783621a5b809 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/321622 Reviewed-by: Mayank Patke <fishythefish@google.com> Commit-Queue: Stephen Adams <sra@google.com>
Fixed via 9d15643 |
nex3
added a commit
to sass/dart-sass
that referenced
this issue
Aug 18, 2023
This was referenced Sep 12, 2023
This was referenced Oct 5, 2023
This was referenced Oct 14, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
area-web
Use area-web for Dart web related issues, including the DDC and dart2js compilers and JS interop.
web-dart2js
If dart2js-compiled code is run in strict mode (such as when it's loaded as an ECMAScript module as in the browser), and it tries to catch an exception from JavaScript that's just a string, it will crash with
TypeError: Cannot create property '$cachedTrace' on string
. This is because of the helper functiongetTraceFromException()
:Specifically,
exception.$cachedTrace =
is not valid in strict mode ifexception
is a JS value type. Here's a simple reproduction (you can imagine that the exception might come from a JS callback instead ofjsThrow()
):Compile this to JS, load it with
import
in a browser, and you'll seeTypeError: Cannot create property '$cachedTrace' on string 'oh no'
.The text was updated successfully, but these errors were encountered: