Title: [209043] trunk/Source/_javascript_Core
Revision
209043
Author
[email protected]
Date
2016-11-28 15:56:06 -0800 (Mon, 28 Nov 2016)

Log Message

Fix exception scope verification failures in runtime/Intl* files.
https://bugs.webkit.org/show_bug.cgi?id=165014

Reviewed by Saam Barati.

* runtime/IntlCollatorConstructor.cpp:
(JSC::constructIntlCollator):
(JSC::IntlCollatorConstructorFuncSupportedLocalesOf):
* runtime/IntlCollatorPrototype.cpp:
(JSC::IntlCollatorPrototypeFuncResolvedOptions):
* runtime/IntlDateTimeFormatConstructor.cpp:
(JSC::constructIntlDateTimeFormat):
(JSC::IntlDateTimeFormatConstructorFuncSupportedLocalesOf):
* runtime/IntlDateTimeFormatPrototype.cpp:
(JSC::IntlDateTimeFormatFuncFormatDateTime):
(JSC::IntlDateTimeFormatPrototypeGetterFormat):
(JSC::IntlDateTimeFormatPrototypeFuncResolvedOptions):
* runtime/IntlNumberFormatConstructor.cpp:
(JSC::constructIntlNumberFormat):
(JSC::IntlNumberFormatConstructorFuncSupportedLocalesOf):
* runtime/IntlNumberFormatPrototype.cpp:
(JSC::IntlNumberFormatFuncFormatNumber):
(JSC::IntlNumberFormatPrototypeGetterFormat):
(JSC::IntlNumberFormatPrototypeFuncResolvedOptions):
* runtime/IntlObject.cpp:
(JSC::lookupSupportedLocales):
* runtime/IntlObjectInlines.h:
(JSC::constructIntlInstanceWithWorkaroundForLegacyIntlConstructor):

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (209042 => 209043)


--- trunk/Source/_javascript_Core/ChangeLog	2016-11-28 23:56:04 UTC (rev 209042)
+++ trunk/Source/_javascript_Core/ChangeLog	2016-11-28 23:56:06 UTC (rev 209043)
@@ -1,3 +1,34 @@
+2016-11-21  Mark Lam  <[email protected]>
+
+        Fix exception scope verification failures in runtime/Intl* files.
+        https://bugs.webkit.org/show_bug.cgi?id=165014
+
+        Reviewed by Saam Barati.
+
+        * runtime/IntlCollatorConstructor.cpp:
+        (JSC::constructIntlCollator):
+        (JSC::IntlCollatorConstructorFuncSupportedLocalesOf):
+        * runtime/IntlCollatorPrototype.cpp:
+        (JSC::IntlCollatorPrototypeFuncResolvedOptions):
+        * runtime/IntlDateTimeFormatConstructor.cpp:
+        (JSC::constructIntlDateTimeFormat):
+        (JSC::IntlDateTimeFormatConstructorFuncSupportedLocalesOf):
+        * runtime/IntlDateTimeFormatPrototype.cpp:
+        (JSC::IntlDateTimeFormatFuncFormatDateTime):
+        (JSC::IntlDateTimeFormatPrototypeGetterFormat):
+        (JSC::IntlDateTimeFormatPrototypeFuncResolvedOptions):
+        * runtime/IntlNumberFormatConstructor.cpp:
+        (JSC::constructIntlNumberFormat):
+        (JSC::IntlNumberFormatConstructorFuncSupportedLocalesOf):
+        * runtime/IntlNumberFormatPrototype.cpp:
+        (JSC::IntlNumberFormatFuncFormatNumber):
+        (JSC::IntlNumberFormatPrototypeGetterFormat):
+        (JSC::IntlNumberFormatPrototypeFuncResolvedOptions):
+        * runtime/IntlObject.cpp:
+        (JSC::lookupSupportedLocales):
+        * runtime/IntlObjectInlines.h:
+        (JSC::constructIntlInstanceWithWorkaroundForLegacyIntlConstructor):
+
 2016-11-28  Mark Lam  <[email protected]>
 
         Fix exception scope verification failures in IteratorOperations.h.

Modified: trunk/Source/_javascript_Core/runtime/IntlCollatorConstructor.cpp (209042 => 209043)


--- trunk/Source/_javascript_Core/runtime/IntlCollatorConstructor.cpp	2016-11-28 23:56:04 UTC (rev 209042)
+++ trunk/Source/_javascript_Core/runtime/IntlCollatorConstructor.cpp	2016-11-28 23:56:06 UTC (rev 209043)
@@ -96,6 +96,7 @@
     ASSERT(collator);
 
     // 4. Return InitializeCollator(collator, locales, options).
+    scope.release();
     collator->initializeCollator(*state, state->argument(0), state->argument(1));
     return JSValue::encode(collator);
 }
@@ -148,6 +149,7 @@
 
     // 3. Return SupportedLocales(%Collator%.[[availableLocales]], requestedLocales, options).
     JSGlobalObject* globalObject = state->callee()->globalObject();
+    scope.release();
     return JSValue::encode(supportedLocales(*state, globalObject->intlCollatorAvailableLocales(), requestedLocales, state->argument(1)));
 }
 

Modified: trunk/Source/_javascript_Core/runtime/IntlCollatorPrototype.cpp (209042 => 209043)


--- trunk/Source/_javascript_Core/runtime/IntlCollatorPrototype.cpp	2016-11-28 23:56:04 UTC (rev 209042)
+++ trunk/Source/_javascript_Core/runtime/IntlCollatorPrototype.cpp	2016-11-28 23:56:06 UTC (rev 209043)
@@ -145,6 +145,7 @@
     if (!collator)
         return JSValue::encode(throwTypeError(state, scope, ASCIILiteral("Intl.Collator.prototype.resolvedOptions called on value that's not an object initialized as a Collator")));
 
+    scope.release();
     return JSValue::encode(collator->resolvedOptions(*state));
 }
 

Modified: trunk/Source/_javascript_Core/runtime/IntlDateTimeFormatConstructor.cpp (209042 => 209043)


--- trunk/Source/_javascript_Core/runtime/IntlDateTimeFormatConstructor.cpp	2016-11-28 23:56:04 UTC (rev 209042)
+++ trunk/Source/_javascript_Core/runtime/IntlDateTimeFormatConstructor.cpp	2016-11-28 23:56:06 UTC (rev 209043)
@@ -96,6 +96,7 @@
     ASSERT(dateTimeFormat);
 
     // 4. Return InitializeDateTimeFormat(dateTimeFormat, locales, options).
+    scope.release();
     dateTimeFormat->initializeDateTimeFormat(*state, state->argument(0), state->argument(1));
     return JSValue::encode(dateTimeFormat);
 }
@@ -149,6 +150,7 @@
     RETURN_IF_EXCEPTION(scope, encodedJSValue());
 
     // 3. Return SupportedLocales(availableLocales, requestedLocales, options).
+    scope.release();
     return JSValue::encode(supportedLocales(*state, availableLocales, requestedLocales, state->argument(1)));
 }
 

Modified: trunk/Source/_javascript_Core/runtime/IntlDateTimeFormatPrototype.cpp (209042 => 209043)


--- trunk/Source/_javascript_Core/runtime/IntlDateTimeFormatPrototype.cpp	2016-11-28 23:56:04 UTC (rev 209042)
+++ trunk/Source/_javascript_Core/runtime/IntlDateTimeFormatPrototype.cpp	2016-11-28 23:56:06 UTC (rev 209043)
@@ -105,6 +105,7 @@
     }
 
     // 5. Return FormatDateTime(dtf, x).
+    scope.release();
     return JSValue::encode(format->format(*state, value));
 }
 
@@ -119,8 +120,11 @@
 
     // FIXME: Workaround to provide compatibility with ECMA-402 1.0 call/apply patterns.
     // https://bugs.webkit.org/show_bug.cgi?id=153679
-    if (!dtf)
-        dtf = jsDynamicCast<IntlDateTimeFormat*>(state->thisValue().get(state, vm.propertyNames->builtinNames().intlSubstituteValuePrivateName()));
+    if (!dtf) {
+        JSValue value = state->thisValue().get(state, vm.propertyNames->builtinNames().intlSubstituteValuePrivateName());
+        RETURN_IF_EXCEPTION(scope, encodedJSValue());
+        dtf = jsDynamicCast<IntlDateTimeFormat*>(value);
+    }
 
     // 2. ReturnIfAbrupt(dtf).
     if (!dtf)
@@ -157,12 +161,16 @@
 
     // FIXME: Workaround to provide compatibility with ECMA-402 1.0 call/apply patterns.
     // https://bugs.webkit.org/show_bug.cgi?id=153679
-    if (!dateTimeFormat)
-        dateTimeFormat = jsDynamicCast<IntlDateTimeFormat*>(state->thisValue().get(state, vm.propertyNames->builtinNames().intlSubstituteValuePrivateName()));
+    if (!dateTimeFormat) {
+        JSValue value = state->thisValue().get(state, vm.propertyNames->builtinNames().intlSubstituteValuePrivateName());
+        RETURN_IF_EXCEPTION(scope, encodedJSValue());
+        dateTimeFormat = jsDynamicCast<IntlDateTimeFormat*>(value);
+    }
 
     if (!dateTimeFormat)
         return JSValue::encode(throwTypeError(state, scope, ASCIILiteral("Intl.DateTimeFormat.prototype.resolvedOptions called on value that's not an object initialized as a DateTimeFormat")));
 
+    scope.release();
     return JSValue::encode(dateTimeFormat->resolvedOptions(*state));
 }
 

Modified: trunk/Source/_javascript_Core/runtime/IntlNumberFormatConstructor.cpp (209042 => 209043)


--- trunk/Source/_javascript_Core/runtime/IntlNumberFormatConstructor.cpp	2016-11-28 23:56:04 UTC (rev 209042)
+++ trunk/Source/_javascript_Core/runtime/IntlNumberFormatConstructor.cpp	2016-11-28 23:56:06 UTC (rev 209043)
@@ -96,6 +96,7 @@
     ASSERT(numberFormat);
 
     // 4. Return InitializeNumberFormat(numberFormat, locales, options).
+    scope.release();
     numberFormat->initializeNumberFormat(*state, state->argument(0), state->argument(1));
     return JSValue::encode(numberFormat);
 }
@@ -149,6 +150,7 @@
     RETURN_IF_EXCEPTION(scope, encodedJSValue());
 
     // 3. Return SupportedLocales(availableLocales, requestedLocales, options).
+    scope.release();
     return JSValue::encode(supportedLocales(*state, availableLocales, requestedLocales, state->argument(1)));
 }
 

Modified: trunk/Source/_javascript_Core/runtime/IntlNumberFormatPrototype.cpp (209042 => 209043)


--- trunk/Source/_javascript_Core/runtime/IntlNumberFormatPrototype.cpp	2016-11-28 23:56:04 UTC (rev 209042)
+++ trunk/Source/_javascript_Core/runtime/IntlNumberFormatPrototype.cpp	2016-11-28 23:56:06 UTC (rev 209043)
@@ -94,6 +94,7 @@
     RETURN_IF_EXCEPTION(scope, encodedJSValue());
 
     // 6. Return FormatNumber(nf, x).
+    scope.release();
     return JSValue::encode(numberFormat->formatNumber(*state, number));
 }
 
@@ -108,8 +109,11 @@
 
     // FIXME: Workaround to provide compatibility with ECMA-402 1.0 call/apply patterns.
     // https://bugs.webkit.org/show_bug.cgi?id=153679
-    if (!nf)
-        nf = jsDynamicCast<IntlNumberFormat*>(state->thisValue().get(state, vm.propertyNames->builtinNames().intlSubstituteValuePrivateName()));
+    if (!nf) {
+        JSValue value = state->thisValue().get(state, vm.propertyNames->builtinNames().intlSubstituteValuePrivateName());
+        RETURN_IF_EXCEPTION(scope, encodedJSValue());
+        nf = jsDynamicCast<IntlNumberFormat*>(value);
+    }
 
     if (!nf)
         return JSValue::encode(throwTypeError(state, scope, ASCIILiteral("Intl.NumberFormat.prototype.format called on value that's not an object initialized as a NumberFormat")));
@@ -145,12 +149,16 @@
 
     // FIXME: Workaround to provide compatibility with ECMA-402 1.0 call/apply patterns.
     // https://bugs.webkit.org/show_bug.cgi?id=153679
-    if (!numberFormat)
-        numberFormat = jsDynamicCast<IntlNumberFormat*>(state->thisValue().get(state, vm.propertyNames->builtinNames().intlSubstituteValuePrivateName()));
+    if (!numberFormat) {
+        JSValue value = state->thisValue().get(state, vm.propertyNames->builtinNames().intlSubstituteValuePrivateName());
+        RETURN_IF_EXCEPTION(scope, encodedJSValue());
+        numberFormat = jsDynamicCast<IntlNumberFormat*>(value);
+    }
 
     if (!numberFormat)
         return JSValue::encode(throwTypeError(state, scope, ASCIILiteral("Intl.NumberFormat.prototype.resolvedOptions called on value that's not an object initialized as a NumberFormat")));
 
+    scope.release();
     return JSValue::encode(numberFormat->resolvedOptions(*state));
 }
 

Modified: trunk/Source/_javascript_Core/runtime/IntlObject.cpp (209042 => 209043)


--- trunk/Source/_javascript_Core/runtime/IntlObject.cpp	2016-11-28 23:56:04 UTC (rev 209042)
+++ trunk/Source/_javascript_Core/runtime/IntlObject.cpp	2016-11-28 23:56:06 UTC (rev 209043)
@@ -908,8 +908,10 @@
         String availableLocale = bestAvailableLocale(availableLocales, noExtensionsLocale);
 
         // f. If availableLocale is not undefined, then append locale to the end of subset.
-        if (!availableLocale.isNull())
+        if (!availableLocale.isNull()) {
             subset->push(&state, jsString(&state, locale));
+            RETURN_IF_EXCEPTION(scope, nullptr);
+        }
 
         // g. Increment k by 1.
     }

Modified: trunk/Source/_javascript_Core/runtime/IntlObjectInlines.h (209042 => 209043)


--- trunk/Source/_javascript_Core/runtime/IntlObjectInlines.h	2016-11-28 23:56:04 UTC (rev 209042)
+++ trunk/Source/_javascript_Core/runtime/IntlObjectInlines.h	2016-11-28 23:56:06 UTC (rev 209043)
@@ -44,7 +44,9 @@
 
     if (!jsDynamicCast<IntlInstance*>(thisValue)) {
         JSValue prototype = callee->getDirect(vm, vm.propertyNames->prototype);
-        if (JSObject::defaultHasInstance(&state, thisValue, prototype)) {
+        bool hasInstance = JSObject::defaultHasInstance(&state, thisValue, prototype);
+        RETURN_IF_EXCEPTION(scope, JSValue());
+        if (hasInstance) {
             JSObject* thisObject = thisValue.toObject(&state);
             RETURN_IF_EXCEPTION(scope, JSValue());
 
@@ -55,7 +57,7 @@
             return thisObject;
         }
     }
-
+    scope.release();
     return factory(vm);
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to