Skip to content
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

decoding percent-encoding source string in Error.stack to follow browser behaviour #757

Closed
Hajime-san opened this issue May 28, 2024 · 0 comments · Fixed by #759
Closed

Comments

@Hajime-san
Copy link
Contributor

context

context in denoland/deno#23200 (comment) the section of handle runtime behaviour
and denoland/deno#23200 (comment)

overview

spec

It seems that there is no specification for Error.stack today, and it is implementation-defined behaviour by browser engines.

example to reproduce

Here is an example code to show stack trace, and runs it on modern browsers.

  • index.html
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <script type="module" src="./🍋.js"></script>
</head>
<body>
</body>
</html>
  • 🍋.js
throw new Error('🍋')

browser result

Google Chrome(122.0.6261.112)

🍋.js:2 Uncaught Error: 🍋
    at 🍋.js:2:7
(anonymous) @ 🍋.js:2

I think that the stack trace implementation is located as follows.

Firefox(117.0)

Uncaught Error: 🍋
    <anonymous> http://localhost:8080/🍋.js:1

Safari(17.3.1)

Error: 🍋
module code - 🍋.js:2

non-browser result

Node.js(20.12.0)

% node 🍋.mjs         
file:///path/to/%F0%9F%8D%8B.mjs:1
throw new Error('🍋')
      ^

Error: 🍋
    at file:///path/to/%F0%9F%8D%8B.mjs:1:7
    at ModuleJob.run (node:internal/modules/esm/module_job:218:25)
    at async ModuleLoader.import (node:internal/modules/esm/loader:329:24)
    at async loadESM (node:internal/process/esm_loader:28:7)
    at async handleMainPromise (node:internal/modules/run_main:113:12)

related issues

denoland/deno#18983

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 a pull request may close this issue.

1 participant