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

Date locale functions fail if Map is overridden #3189

Closed
lpd-au opened this issue Jun 20, 2017 · 3 comments
Closed

Date locale functions fail if Map is overridden #3189

lpd-au opened this issue Jun 20, 2017 · 3 comments
Assignees
Labels
Projects
Milestone

Comments

@lpd-au
Copy link

lpd-au commented Jun 20, 2017

https://stackoverflow.com/a/44637643/646551

Steps to reproduce

Run the following code using ch.exe:

// var earlyDateString = new Date().toLocaleString();
Map = {};
var dateString = new Date().toLocaleString();

Expected result

dateString contains something like "‎20‎/‎06‎/‎2017‎ ‎5‎:‎46‎:‎36‎ ‎PM"

Actual result

TypeError: Intl is not available.
   at Global code (e:\my downloads\cc_windows_1_5_2\bin\x64_release\test.js:3:1)

Workaround

Uncomment the first line so Intl is initialised before Map is overridden.

Other browsers

Google Chrome: Not affected
Mozilla Firefox: Not affected

@curtisman curtisman added this to the 1.6 milestone Jun 20, 2017
@curtisman
Copy link
Contributor

Probably regression from #2358

@dilijev dilijev added the Bug label Jun 20, 2017
@dilijev
Copy link
Contributor

dilijev commented Jun 20, 2017

Yep, looks like tainting affected the maps being used in the caches which caused Intl to fail to initialize. The fix is probably to expose a platform.Map and use new platform.Map() instead of new Map().

@dilijev dilijev assigned dilijev and unassigned kunalspathak Jun 20, 2017
@dilijev
Copy link
Contributor

dilijev commented Jun 20, 2017

I have a fix. Will post the PR momentarily.

chakrabot pushed a commit that referenced this issue Jun 20, 2017
…nd Object.defineProperty.

Merge pull request #3196 from dilijev:intl-tainting

* Expose and use platform.Map
* Use ObjectDefineProperty instead of Object.defineProperty

Fixes #3189
chakrabot pushed a commit that referenced this issue Jun 20, 2017
…ting of Map and Object.defineProperty.

Merge pull request #3196 from dilijev:intl-tainting

* Expose and use platform.Map
* Use ObjectDefineProperty instead of Object.defineProperty

Fixes #3189
@dilijev dilijev added this to Done in Intl Sep 6, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
No open projects
Intl
Done
Development

No branches or pull requests

4 participants