From 888524ff1d9bcbb94975305d8a57162ff6a34c06 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andr=C3=A9=20Bargull?= <andre.bargull@gmail.com>
Date: Wed, 8 Jul 2015 19:13:06 +0200
Subject: [PATCH] Intl constructors are no longer able to initialize arbitrary
 objects as Intl objects. Update tests accordingly.

---
 test/intl402/10.1.1_1.js   | 37 ++++++++++++-------------------------
 test/intl402/10.1.2.1_4.js |  4 ++--
 test/intl402/11.1.1_1.js   | 37 ++++++++++++-------------------------
 test/intl402/11.1.2.1_4.js |  4 ++--
 test/intl402/12.1.1_1.js   | 37 ++++++++++++-------------------------
 test/intl402/12.1.2.1_4.js |  4 ++--
 6 files changed, 42 insertions(+), 81 deletions(-)

diff --git a/test/intl402/10.1.1_1.js b/test/intl402/10.1.1_1.js
index d0a608a369..42f4fe67b6 100644
--- a/test/intl402/10.1.1_1.js
+++ b/test/intl402/10.1.1_1.js
@@ -3,40 +3,27 @@
 
 /*---
 es5id: 10.1.1_1
-description: Tests that an object can't be re-initialized as a Collator.
+description: Tests that the this-value is ignored in Collator.
 author: Norbert Lindenberg
 includes: [testIntl.js]
 ---*/
 
 testWithIntlConstructors(function (Constructor) {
-    var obj, error;
-    
+    var obj, newObj;
+
     // variant 1: use constructor in a "new" expression
     obj = new Constructor();
-    try {
-        Intl.Collator.call(obj);
-    } catch (e) {
-        error = e;
-    }
-    if (error === undefined) {
-        $ERROR("Re-initializing object created with \"new\" as Collator was not rejected.");
-    } else if (error.name !== "TypeError") {
-        $ERROR("Re-initializing object created with \"new\" as Collator was rejected with wrong error " + error.name + ".");
+    newObj = Intl.Collator.call(obj);
+    if (obj === newObj) {
+      $ERROR("Collator object created with \"new\" was not ignored as this-value.");
     }
-    
+
     // variant 2: use constructor as a function
-    obj = Constructor.call({});
-    error = undefined;
-    try {
-        Intl.Collator.call(obj);
-    } catch (e) {
-        error = e;
+    obj = Constructor();
+    newObj = Intl.Collator.call(obj);
+    if (obj === newObj) {
+      $ERROR("Collator object created with constructor as function was not ignored as this-value.");
     }
-    if (error === undefined) {
-        $ERROR("Re-initializing object created with constructor as function as Collator was not rejected.");
-    } else if (error.name !== "TypeError") {
-        $ERROR("Re-initializing object created with constructor as function as Collator was rejected with wrong error " + error.name + ".");
-    }
-    
+
     return true;
 });
diff --git a/test/intl402/10.1.2.1_4.js b/test/intl402/10.1.2.1_4.js
index 9a1769434b..dc30d0a03e 100644
--- a/test/intl402/10.1.2.1_4.js
+++ b/test/intl402/10.1.2.1_4.js
@@ -4,8 +4,8 @@
 /*---
 es5id: 10.1.2.1_4
 description: >
-    Tests that for non-object values passed as this to Collator a
-    wrapper object will be initialized and returned.
+    Tests that non-object values passed as this to Collator are ignored
+    and a normal collator object will be initialized and returned.
 author: Norbert Lindenberg
 ---*/
 
diff --git a/test/intl402/11.1.1_1.js b/test/intl402/11.1.1_1.js
index e31ddb9e07..6e36af019b 100644
--- a/test/intl402/11.1.1_1.js
+++ b/test/intl402/11.1.1_1.js
@@ -3,40 +3,27 @@
 
 /*---
 es5id: 11.1.1_1
-description: Tests that an object can't be re-initialized as a NumberFormat.
+description: Tests that the this-value is ignored in NumberFormat.
 author: Norbert Lindenberg
 includes: [testIntl.js]
 ---*/
 
 testWithIntlConstructors(function (Constructor) {
-    var obj, error;
-    
+    var obj, newObj;
+
     // variant 1: use constructor in a "new" expression
     obj = new Constructor();
-    try {
-        Intl.NumberFormat.call(obj);
-    } catch (e) {
-        error = e;
-    }
-    if (error === undefined) {
-        $ERROR("Re-initializing object created with \"new\" as NumberFormat was not rejected.");
-    } else if (error.name !== "TypeError") {
-        $ERROR("Re-initializing object created with \"new\" as NumberFormat was rejected with wrong error " + error.name + ".");
+    newObj = Intl.NumberFormat.call(obj);
+    if (obj === newObj) {
+      $ERROR("NumberFormat object created with \"new\" was not ignored as this-value.");
     }
-    
+
     // variant 2: use constructor as a function
-    obj = Constructor.call({});
-    error = undefined;
-    try {
-        Intl.NumberFormat.call(obj);
-    } catch (e) {
-        error = e;
+    obj = Constructor();
+    newObj = Intl.NumberFormat.call(obj);
+    if (obj === newObj) {
+      $ERROR("NumberFormat object created with constructor as function was not ignored as this-value.");
     }
-    if (error === undefined) {
-        $ERROR("Re-initializing object created with constructor as function as NumberFormat was not rejected.");
-    } else if (error.name !== "TypeError") {
-        $ERROR("Re-initializing object created with constructor as function as NumberFormat was rejected with wrong error " + error.name + ".");
-    }
-    
+
     return true;
 });
diff --git a/test/intl402/11.1.2.1_4.js b/test/intl402/11.1.2.1_4.js
index e21140147e..3cff14d805 100644
--- a/test/intl402/11.1.2.1_4.js
+++ b/test/intl402/11.1.2.1_4.js
@@ -4,8 +4,8 @@
 /*---
 es5id: 11.1.2.1_4
 description: >
-    Tests that for non-object values passed as this to NumberFormat a
-    wrapper object will be initialized and returned.
+    Tests that non-object values passed as this to NumberFormat are ignored
+    and a normal number format object will be initialized and returned.
 author: Norbert Lindenberg
 ---*/
 
diff --git a/test/intl402/12.1.1_1.js b/test/intl402/12.1.1_1.js
index 2e01c2fb35..5a042454a2 100644
--- a/test/intl402/12.1.1_1.js
+++ b/test/intl402/12.1.1_1.js
@@ -3,40 +3,27 @@
 
 /*---
 es5id: 12.1.1_1
-description: Tests that an object can't be re-initialized as a DateTimeFormat.
+description: Tests that the this-value is ignored in DateTimeFormat.
 author: Norbert Lindenberg
 includes: [testIntl.js]
 ---*/
 
 testWithIntlConstructors(function (Constructor) {
-    var obj, error;
-    
+    var obj, newObj;
+
     // variant 1: use constructor in a "new" expression
     obj = new Constructor();
-    try {
-        Intl.DateTimeFormat.call(obj);
-    } catch (e) {
-        error = e;
-    }
-    if (error === undefined) {
-        $ERROR("Re-initializing object created with \"new\" as DateTimeFormat was not rejected.");
-    } else if (error.name !== "TypeError") {
-        $ERROR("Re-initializing object created with \"new\" as DateTimeFormat was rejected with wrong error " + error.name + ".");
+    newObj = Intl.DateTimeFormat.call(obj);
+    if (obj === newObj) {
+      $ERROR("DateTimeFormat object created with \"new\" was not ignored as this-value.");
     }
-    
+
     // variant 2: use constructor as a function
-    obj = Constructor.call({});
-    error = undefined;
-    try {
-        Intl.DateTimeFormat.call(obj);
-    } catch (e) {
-        error = e;
+    obj = Constructor();
+    newObj = Intl.DateTimeFormat.call(obj);
+    if (obj === newObj) {
+      $ERROR("DateTimeFormat object created with constructor as function was not ignored as this-value.");
     }
-    if (error === undefined) {
-        $ERROR("Re-initializing object created with constructor as function as DateTimeFormat was not rejected.");
-    } else if (error.name !== "TypeError") {
-        $ERROR("Re-initializing object created with constructor as function as DateTimeFormat was rejected with wrong error " + error.name + ".");
-    }
-    
+
     return true;
 });
diff --git a/test/intl402/12.1.2.1_4.js b/test/intl402/12.1.2.1_4.js
index 5806f89ac4..8ba9f33520 100644
--- a/test/intl402/12.1.2.1_4.js
+++ b/test/intl402/12.1.2.1_4.js
@@ -4,8 +4,8 @@
 /*---
 es5id: 12.1.2.1_4
 description: >
-    Tests that for non-object values passed as this to DateTimeFormat
-    a  wrapper object will be initialized and returned.
+    Tests that non-object values passed as this to DateTimeFormat are ignored
+    and a normal date-time format object will be initialized and returned.
 author: Norbert Lindenberg
 ---*/
 
-- 
GitLab