Title: [287543] trunk
Revision
287543
Author
[email protected]
Date
2022-01-03 08:31:18 -0800 (Mon, 03 Jan 2022)

Log Message

[JSC] Fix length of Intl.NumberFormat.formatRange and Intl.PluralRules.selectRange
https://bugs.webkit.org/show_bug.cgi?id=234806

Reviewed by Alexey Shvayka.

JSTests:

* stress/intl-numberformat-format-range-v3.js:
(nf.formatRange.nf.formatRangeToParts.methods.forEach):
* stress/intl-pluralrules-selectrange.js:

Source/_javascript_Core:

These length's numbers are wrong. This patch fixes them.

* runtime/IntlNumberFormatPrototype.cpp:
(JSC::IntlNumberFormatPrototype::finishCreation):
* runtime/IntlPluralRulesPrototype.cpp:
(JSC::IntlPluralRulesPrototype::finishCreation):

Modified Paths

Diff

Modified: trunk/JSTests/ChangeLog (287542 => 287543)


--- trunk/JSTests/ChangeLog	2022-01-03 16:26:00 UTC (rev 287542)
+++ trunk/JSTests/ChangeLog	2022-01-03 16:31:18 UTC (rev 287543)
@@ -1,5 +1,16 @@
 2022-01-03  Yusuke Suzuki  <[email protected]>
 
+        [JSC] Fix length of Intl.NumberFormat.formatRange and Intl.PluralRules.selectRange
+        https://bugs.webkit.org/show_bug.cgi?id=234806
+
+        Reviewed by Alexey Shvayka.
+
+        * stress/intl-numberformat-format-range-v3.js:
+        (nf.formatRange.nf.formatRangeToParts.methods.forEach):
+        * stress/intl-pluralrules-selectrange.js:
+
+2022-01-03  Yusuke Suzuki  <[email protected]>
+
         [JSC] Update test262
         https://bugs.webkit.org/show_bug.cgi?id=234807
 

Modified: trunk/JSTests/stress/intl-numberformat-format-range-v3.js (287542 => 287543)


--- trunk/JSTests/stress/intl-numberformat-format-range-v3.js	2022-01-03 16:26:00 UTC (rev 287542)
+++ trunk/JSTests/stress/intl-numberformat-format-range-v3.js	2022-01-03 16:31:18 UTC (rev 287543)
@@ -63,6 +63,7 @@
         // Assert if called without nf
         let f = nf[method];
         shouldThrow(() => { f(1, 23) }, TypeError);
+        shouldBe(f.length, 2);
 
         // Assert normal call success
         shouldNotThrow(() => nf[method](1, 23));

Modified: trunk/JSTests/stress/intl-pluralrules-selectrange.js (287542 => 287543)


--- trunk/JSTests/stress/intl-pluralrules-selectrange.js	2022-01-03 16:26:00 UTC (rev 287542)
+++ trunk/JSTests/stress/intl-pluralrules-selectrange.js	2022-01-03 16:31:18 UTC (rev 287543)
@@ -32,5 +32,6 @@
 
 if (Intl.PluralRules.prototype.selectRange) {
     const pl = new Intl.PluralRules("sl");
+    shouldBe(pl.selectRange.length, 2);
     shouldBe("few", pl.selectRange(102, 201));
 }

Modified: trunk/JSTests/test262/expectations.yaml (287542 => 287543)


--- trunk/JSTests/test262/expectations.yaml	2022-01-03 16:26:00 UTC (rev 287542)
+++ trunk/JSTests/test262/expectations.yaml	2022-01-03 16:31:18 UTC (rev 287543)
@@ -1386,12 +1386,33 @@
 test/intl402/NumberFormat/prototype/format/value-decimal-string.js:
   default: 'Test262Error: Expected SameValue(«1», «1.0000000000000001») to be true'
   strict mode: 'Test262Error: Expected SameValue(«1», «1.0000000000000001») to be true'
+test/intl402/NumberFormat/prototype/formatRange/builtin.js:
+  default: 'Test262Error: The [[Class]] internal property of a built-in function must be "Function". Expected SameValue(«[object Undefined]», «[object Function]») to be true'
+  strict mode: 'Test262Error: The [[Class]] internal property of a built-in function must be "Function". Expected SameValue(«[object Undefined]», «[object Function]») to be true'
+test/intl402/NumberFormat/prototype/formatRange/en-US.js:
+  default: "TypeError: nf.formatRange is not a function. (In 'nf.formatRange(3, 5)', 'nf.formatRange' is undefined)"
+  strict mode: "TypeError: nf.formatRange is not a function. (In 'nf.formatRange(3, 5)', 'nf.formatRange' is undefined)"
+test/intl402/NumberFormat/prototype/formatRange/invoked-as-func.js:
+  default: 'Test262Error: Expected SameValue(«undefined», «function») to be true'
+  strict mode: 'Test262Error: Expected SameValue(«undefined», «function») to be true'
 test/intl402/NumberFormat/prototype/formatRange/length.js:
-  default: 'Test262Error: descriptor value should be 2'
-  strict mode: 'Test262Error: descriptor value should be 2'
+  default: "TypeError: undefined is not an object (evaluating 'Object.getOwnPropertyDescriptor(obj, name)')"
+  strict mode: "TypeError: undefined is not an object (evaluating 'Object.getOwnPropertyDescriptor(obj, name)')"
+test/intl402/NumberFormat/prototype/formatRange/name.js:
+  default: "TypeError: undefined is not an object (evaluating 'Object.getOwnPropertyDescriptor(obj, name)')"
+  strict mode: "TypeError: undefined is not an object (evaluating 'Object.getOwnPropertyDescriptor(obj, name)')"
+test/intl402/NumberFormat/prototype/formatRange/nan-arguments-throws.js:
+  default: 'Test262Error: Expected a RangeError but got a TypeError'
+  strict mode: 'Test262Error: Expected a RangeError but got a TypeError'
+test/intl402/NumberFormat/prototype/formatRange/prop-desc.js:
+  default: 'Test262Error: `typeof Intl.NumberFormat.prototype.formatRange` is `function` Expected SameValue(«undefined», «function») to be true'
+  strict mode: 'Test262Error: `typeof Intl.NumberFormat.prototype.formatRange` is `function` Expected SameValue(«undefined», «function») to be true'
 test/intl402/NumberFormat/prototype/formatRange/pt-PT.js:
-  default: 'Test262Error: Expected SameValue(«3 - 5 €», «3 - 5 €») to be true'
-  strict mode: 'Test262Error: Expected SameValue(«3 - 5 €», «3 - 5 €») to be true'
+  default: "TypeError: nf.formatRange is not a function. (In 'nf.formatRange(3, 5)', 'nf.formatRange' is undefined)"
+  strict mode: "TypeError: nf.formatRange is not a function. (In 'nf.formatRange(3, 5)', 'nf.formatRange' is undefined)"
+test/intl402/NumberFormat/prototype/formatRange/x-greater-than-y-throws.js:
+  default: 'Test262Error: Expected a RangeError but got a TypeError'
+  strict mode: 'Test262Error: Expected a RangeError but got a TypeError'
 test/intl402/NumberFormat/prototype/formatRangeToParts/builtin.js:
   default: 'Test262Error: The [[Class]] internal property of a built-in function must be "Function". Expected SameValue(«[object Undefined]», «[object Function]») to be true'
   strict mode: 'Test262Error: The [[Class]] internal property of a built-in function must be "Function". Expected SameValue(«[object Undefined]», «[object Function]») to be true'
@@ -1447,17 +1468,26 @@
   default: 'Test262Error: -0.0001 (negative): length Expected SameValue(«2», «1») to be true'
   strict mode: 'Test262Error: -0.0001 (negative): length Expected SameValue(«2», «1») to be true'
 test/intl402/PluralRules/prototype/selectRange/default-en-us.js:
-  default: 'Test262Error: Expected SameValue(«other», «few») to be true'
-  strict mode: 'Test262Error: Expected SameValue(«other», «few») to be true'
+  default: "TypeError: pr.selectRange is not a function. (In 'pr.selectRange(102, 201)', 'pr.selectRange' is undefined)"
+  strict mode: "TypeError: pr.selectRange is not a function. (In 'pr.selectRange(102, 201)', 'pr.selectRange' is undefined)"
+test/intl402/PluralRules/prototype/selectRange/invoked-as-func.js:
+  default: 'Test262Error: Expected SameValue(«undefined», «function») to be true'
+  strict mode: 'Test262Error: Expected SameValue(«undefined», «function») to be true'
 test/intl402/PluralRules/prototype/selectRange/length.js:
-  default: 'Test262Error: descriptor value should be 2'
-  strict mode: 'Test262Error: descriptor value should be 2'
+  default: "TypeError: undefined is not an object (evaluating 'Object.getOwnPropertyDescriptor(obj, name)')"
+  strict mode: "TypeError: undefined is not an object (evaluating 'Object.getOwnPropertyDescriptor(obj, name)')"
+test/intl402/PluralRules/prototype/selectRange/name.js:
+  default: "TypeError: undefined is not an object (evaluating 'Object.getOwnPropertyDescriptor(obj, name)')"
+  strict mode: "TypeError: undefined is not an object (evaluating 'Object.getOwnPropertyDescriptor(obj, name)')"
 test/intl402/PluralRules/prototype/selectRange/nan-arguments-throws.js:
-  default: 'Test262Error: NaN/Number Expected a RangeError to be thrown but no exception was thrown at all'
-  strict mode: 'Test262Error: NaN/Number Expected a RangeError to be thrown but no exception was thrown at all'
-test/intl402/PluralRules/prototype/selectRange/undefined-arguments-throws.js:
-  default: 'Test262Error: Expected a TypeError to be thrown but no exception was thrown at all'
-  strict mode: 'Test262Error: Expected a TypeError to be thrown but no exception was thrown at all'
+  default: 'Test262Error: NaN/Number Expected a RangeError but got a TypeError'
+  strict mode: 'Test262Error: NaN/Number Expected a RangeError but got a TypeError'
+test/intl402/PluralRules/prototype/selectRange/prop-desc.js:
+  default: 'Test262Error: `typeof Intl.PluralRules.prototype.selectRange` is `function` Expected SameValue(«undefined», «function») to be true'
+  strict mode: 'Test262Error: `typeof Intl.PluralRules.prototype.selectRange` is `function` Expected SameValue(«undefined», «function») to be true'
+test/intl402/PluralRules/prototype/selectRange/x-greater-than-y-throws.js:
+  default: 'Test262Error: Expected a RangeError but got a TypeError'
+  strict mode: 'Test262Error: Expected a RangeError but got a TypeError'
 test/intl402/Temporal/PlainTime/prototype/toLocaleString/locales-undefined.js:
   default: 'TypeError: Temporal.PlainTime.prototype.valueOf must not be called. To compare PlainTime values, use Temporal.PlainTime.compare'
   strict mode: 'TypeError: Temporal.PlainTime.prototype.valueOf must not be called. To compare PlainTime values, use Temporal.PlainTime.compare'

Modified: trunk/Source/_javascript_Core/ChangeLog (287542 => 287543)


--- trunk/Source/_javascript_Core/ChangeLog	2022-01-03 16:26:00 UTC (rev 287542)
+++ trunk/Source/_javascript_Core/ChangeLog	2022-01-03 16:31:18 UTC (rev 287543)
@@ -1,3 +1,17 @@
+2022-01-03  Yusuke Suzuki  <[email protected]>
+
+        [JSC] Fix length of Intl.NumberFormat.formatRange and Intl.PluralRules.selectRange
+        https://bugs.webkit.org/show_bug.cgi?id=234806
+
+        Reviewed by Alexey Shvayka.
+
+        These length's numbers are wrong. This patch fixes them.
+
+        * runtime/IntlNumberFormatPrototype.cpp:
+        (JSC::IntlNumberFormatPrototype::finishCreation):
+        * runtime/IntlPluralRulesPrototype.cpp:
+        (JSC::IntlPluralRulesPrototype::finishCreation):
+
 2022-01-02  Yusuke Suzuki  <[email protected]>
 
         [JSC] Use emitPutProperty / emitGetPropertyValue consistently to handle private names in edge cases

Modified: trunk/Source/_javascript_Core/runtime/IntlNumberFormatPrototype.cpp (287542 => 287543)


--- trunk/Source/_javascript_Core/runtime/IntlNumberFormatPrototype.cpp	2022-01-03 16:26:00 UTC (rev 287542)
+++ trunk/Source/_javascript_Core/runtime/IntlNumberFormatPrototype.cpp	2022-01-03 16:31:18 UTC (rev 287543)
@@ -87,7 +87,7 @@
     JSC_TO_STRING_TAG_WITHOUT_TRANSITION();
     UNUSED_PARAM(globalObject);
 #if HAVE(ICU_U_NUMBER_RANGE_FORMATTER)
-    JSC_NATIVE_FUNCTION_WITHOUT_TRANSITION("formatRange", intlNumberFormatPrototypeFuncFormatRange, static_cast<unsigned>(PropertyAttribute::DontEnum), 1);
+    JSC_NATIVE_FUNCTION_WITHOUT_TRANSITION("formatRange", intlNumberFormatPrototypeFuncFormatRange, static_cast<unsigned>(PropertyAttribute::DontEnum), 2);
 #endif
 #if HAVE(ICU_U_NUMBER_RANGE_FORMATTER_FORMAT_RANGE_TO_PARTS)
     JSC_NATIVE_FUNCTION_WITHOUT_TRANSITION("formatRangeToParts", intlNumberFormatPrototypeFuncFormatRangeToParts, static_cast<unsigned>(PropertyAttribute::DontEnum), 2);

Modified: trunk/Source/_javascript_Core/runtime/IntlPluralRulesPrototype.cpp (287542 => 287543)


--- trunk/Source/_javascript_Core/runtime/IntlPluralRulesPrototype.cpp	2022-01-03 16:26:00 UTC (rev 287542)
+++ trunk/Source/_javascript_Core/runtime/IntlPluralRulesPrototype.cpp	2022-01-03 16:31:18 UTC (rev 287543)
@@ -77,7 +77,7 @@
     JSC_TO_STRING_TAG_WITHOUT_TRANSITION();
     UNUSED_PARAM(globalObject);
 #if HAVE(ICU_U_NUMBER_RANGE_FORMATTER)
-    JSC_NATIVE_FUNCTION_WITHOUT_TRANSITION(vm.propertyNames->selectRange, intlPluralRulesPrototypeFuncSelectRange, static_cast<unsigned>(PropertyAttribute::DontEnum), 0);
+    JSC_NATIVE_FUNCTION_WITHOUT_TRANSITION(vm.propertyNames->selectRange, intlPluralRulesPrototypeFuncSelectRange, static_cast<unsigned>(PropertyAttribute::DontEnum), 2);
 #endif
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to