Bug 1342648 - Only define PluralRules constructor when calling addIntlExtras in test262 PluralRules tests. r=gandalf
authorAndré Bargull <andre.bargull@gmail.com>
Sat, 25 Feb 2017 01:59:42 -0800
changeset 374160 5a989a69ea61d7b945d8b454b49c5ae2ed545edb
parent 374159 9a9362c9fcd9cf626b6107b571a469a8e47d2cb4
child 374161 c355a0ffcb10bdc459e56dde715f4b2c3335c90c
push id10863
push userjlorenzo@mozilla.com
push dateMon, 06 Mar 2017 23:02:23 +0000
treeherdermozilla-aurora@0931190cd725 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgandalf
bugs1342648
milestone54.0a1
Bug 1342648 - Only define PluralRules constructor when calling addIntlExtras in test262 PluralRules tests. r=gandalf
js/src/tests/test262-intl-extras.js
js/src/tests/test262/intl402/PluralRules/shell.js
--- a/js/src/tests/test262-intl-extras.js
+++ b/js/src/tests/test262-intl-extras.js
@@ -1,7 +1,14 @@
 // This Source Code Form is subject to the terms of the Mozilla Public
 // License, v. 2.0. If a copy of the MPL was not distributed with this
 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 // Call the shell helper to add experimental features to the Intl object.
-if (typeof addIntlExtras === "function")
-    addIntlExtras(Intl);
+if (typeof addIntlExtras === "function") {
+    let intlExtras = {};
+    addIntlExtras(intlExtras);
+
+    Object.defineProperty(Intl, "PluralRules", {
+        value: intlExtras.PluralRules,
+        writable: true, enumerable: false, configurable: true
+    });
+}
--- a/js/src/tests/test262/intl402/PluralRules/shell.js
+++ b/js/src/tests/test262/intl402/PluralRules/shell.js
@@ -1,8 +1,15 @@
 // file: test262-intl-extras.js
 // This Source Code Form is subject to the terms of the Mozilla Public
 // License, v. 2.0. If a copy of the MPL was not distributed with this
 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 // Call the shell helper to add experimental features to the Intl object.
-if (typeof addIntlExtras === "function")
-    addIntlExtras(Intl);
+if (typeof addIntlExtras === "function") {
+    let intlExtras = {};
+    addIntlExtras(intlExtras);
+
+    Object.defineProperty(Intl, "PluralRules", {
+        value: intlExtras.PluralRules,
+        writable: true, enumerable: false, configurable: true
+    });
+}