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

globalThis.chrome?.runtime?.id causes Uncaught SyntaxError: Unexpected token . #420

Closed
erba2061 opened this issue Dec 2, 2022 · 4 comments

Comments

@erba2061
Copy link

erba2061 commented Dec 2, 2022

There still are substantial amount of users with Chromebooks that use old versions of Chrome (v76, v77 etc.). Optional chaining supported from v80.

globalThis.chrome?.runtime?.id causes Uncaught SyntaxError: Unexpected token .

This check was changed in version 0.10.0. Can we fix it to maintain compatability?
https://github.com/mozilla/webextension-polyfill/blob/0.10.0/src/browser-polyfill.js#L9

@erba2061 erba2061 changed the title Optional chaining not supported on Chrome < 80 globalThis.chrome?.runtime?.id causes Uncaught SyntaxError: Unexpected token . Dec 2, 2022
@Rob--W
Copy link
Member

Rob--W commented Mar 2, 2023

Is it feasible to use an older polyfill version? E.g. 0.9.0 - https://github.com/mozilla/webextension-polyfill/releases/tag/0.9.0 ?

If not, revert this change to get it to work again: c12424c

@Rob--W Rob--W closed this as completed Mar 2, 2023
@PoziWorld
Copy link
Contributor

Since this is a breaking change, it would seem that c12424c should have triggered a major version bump.
Alternatively, would the team consider transpiling it to ES5?

I develop extensions that are also used by users of Chrome v49 on Windows XP and Firefox v56/Waterfox.

I had to spend a few minutes figuring out why the extension was not working after a seemingly safe upgrade of webextension-polyfill to v0.10.0, and then look for an existing issue (this one) on GitHub.

@fregante
Copy link
Contributor

should have triggered a major version bump

0.x.0 can contain breaking changes: https://semver.org/#spec-item-4

That's why npm does not automatically update them: https://github.com/npm/node-semver#caret-ranges-123-025-004

Many authors treat a 0.x version as if the x were the major "breaking-change" indicator.

@PoziWorld
Copy link
Contributor

Good to know, thanks.

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

No branches or pull requests

4 participants