Skip to content

Conversation

@juj
Copy link
Collaborator

@juj juj commented Nov 27, 2025

Avoid uses of ?. in locations that are not Babeled, to help Firefox 68.12.0esr pass browser tests.

// In EXPORT_ES6 mode we can just use 'import.meta.url'.
#if MIN_FIREFOX_VERSION < 74
// This modularize.js script is not Babeled, so manually adapt for old browsers.
var _scriptName = typeof globalThis !== 'undefined' && globalThis.document && globalThis.document.currentScript ? globalThis.document.currentScript.src : undefined;
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think its shorter to write typeof document != 'undefined' && document.currentScript ? ...

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good idea.

// When MODULARIZE this JS may be executed later,
// after document.currentScript is gone, so we save it.
// In EXPORT_ES6 mode we can just use 'import.meta.url'.
#if MIN_FIREFOX_VERSION < 74
Copy link
Collaborator

Choose a reason for hiding this comment

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

So we not support targeting older browsers that also don't support the ?. notation?

How about including LEGACY_VM_SUPPORT here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

So we not support targeting older browsers that also don't support the ?. notation?

Can you rephrase?

How about including LEGACY_VM_SUPPORT here?

Added.

@juj juj merged commit fe29a55 into emscripten-core:main Nov 27, 2025
33 of 34 checks passed
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.

2 participants