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

[Next 9.5.4] Symbol.prototype.description polyfill raises TypeError #17825

Closed
uasi opened this issue Oct 12, 2020 · 6 comments · Fixed by #18423
Closed

[Next 9.5.4] Symbol.prototype.description polyfill raises TypeError #17825

uasi opened this issue Oct 12, 2020 · 6 comments · Fixed by #18423
Milestone

Comments

@uasi
Copy link

uasi commented Oct 12, 2020

Bug report

Describe the bug

The Symbol.prototype.description polyfill raises TypeError in Safari 11 or any other browser that does not support Symbol.prototype.description natively.

To Reproduce

  1. Open a web page that runs on Next.js 9.5.4 or 9.5.5 (https://nextjs.org is handy, or you can set up a starter app locally: npx create-next-app nextjs-blog --use-npm --example "https://github.com/vercel/next-learn-starter/tree/a24ee6c823/learn-starter" && cd nextjs-blog && npm install [email protected] && npm run dev)
  2. Open developer tools
  3. Enter Symbol.iterator.description in the console
  4. TypeError: Cannot convert a symbol to a string is raised

Expected behavior

Symbol.iterator.description === 'Symbol.iterator'

Screenshots

Screenshot 2020-10-13 2 56 59

System information

  • OS: iOS 11.4
  • Browser: Mobile Safari 11
  • Version of Next.js: 9.5.4-9.5.5
  • Version of Node.js: 12.10.0

Additional context

if (!('description' in Symbol.prototype)) {
Object.defineProperty(Symbol.prototype, 'description', {
get: function get() {
return /\((.+)\)/.exec(this)[1]
},
})
}

/\((.+)\)/.exec(this)[1] will not work on any browser as RegExp.prototype.exec is spec'd to convert the argument to a string with the abstract operation ToString and ToString(symbol) throws a TypeError exception. See https://tc39.es/ecma262/#sec-regexp.prototype.exec and https://tc39.es/ecma262/#sec-tostring .

@prettyboyweiwei
Copy link

+1
"next": "^9.5" => "next": "9.5.3"

@jaydenseric
Copy link
Contributor

Thanks to Sentry we're noticing a GTM script is crashing in production in Safari v11 due to this.

@artze
Copy link

artze commented Oct 27, 2020

I'm noticing a similar issue on my end with Next 9.5.4.

When I run Symbol.iterator.description like OP suggested, it errored on Chrome 61 - Chrome 65 (did not test 66 onwards). It was observed to be working without issues for Chrome 60, 59 and 58 (did not test versions older than this).

EDIT: Found that downgrading to Next 9.5.0 works

@Timer
Copy link
Member

Timer commented Oct 28, 2020

Could someone please send a PR fixing this?

@developit
Copy link
Contributor

#18423

@kodiakhq kodiakhq bot closed this as completed in #18423 Oct 29, 2020
kodiakhq bot pushed a commit that referenced this issue Oct 29, 2020
Firefox 61:
<img width="513" alt="Screen Shot 2020-10-28 at 5 28 30 PM" src="https://user-images.githubusercontent.com/105127/97498751-1a51be00-1943-11eb-977a-832123363cef.png">

Chrome 61:
<img width="548" alt="Screen Shot 2020-10-28 at 5 26 55 PM" src="https://user-images.githubusercontent.com/105127/97498755-1c1b8180-1943-11eb-8423-bc4e044a1b00.png">

Safari 11:
<img width="477" alt="Screen Shot 2020-10-28 at 5 23 06 PM" src="https://user-images.githubusercontent.com/105127/97498761-1d4cae80-1943-11eb-9de2-e6b26644110a.png">

Fixes #17825
@balazsorban44
Copy link
Member

This issue has been automatically locked due to no recent activity. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@vercel vercel locked as resolved and limited conversation to collaborators Jan 29, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants