Skip to content
This repository was archived by the owner on Feb 26, 2024. It is now read-only.
This repository was archived by the owner on Feb 26, 2024. It is now read-only.

Breaks Intl API in older versions of Chrome #391

@marclaval

Description

@marclaval

In an Android 4.4 emulator for example, when zone.js is loaded, executing new Intl.NumberFormat().format(36000) raises the following error: TypeError: Cannot redefine property: length

The reason behind it some V8 code which freezes an array of locales after initialising it:
https://github.com/v8/v8/blob/d93fd41aaa0982ae8c4226cce3f2629649ebe87a/src/js/i18n.js#L577
With the new Object.defineProperty from zone.js, it fails because it actually executes something like:
Object.defineProperty([], 'length', {value: 0, writable: false, configurable: true})
which fails in any version of Chrome.

Apparently, in recent version of Chrome, it seems that the list of locales is initialised only once, before zone.js is loaded. So there is no issue.

But in older version, the initialisation is done each time new Intl.NumberFormat() or Intl.DateFormat() are called, hence the problem.

The issue was reported in angular/angular#8188 and can also be seen when running Angular's Intl unit tests in these browsers.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions