Changeset 209043 in webkit
- Timestamp:
- Nov 28, 2016 3:56:06 PM (7 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r209037 r209043 1 2016-11-21 Mark Lam <mark.lam@apple.com> 2 3 Fix exception scope verification failures in runtime/Intl* files. 4 https://bugs.webkit.org/show_bug.cgi?id=165014 5 6 Reviewed by Saam Barati. 7 8 * runtime/IntlCollatorConstructor.cpp: 9 (JSC::constructIntlCollator): 10 (JSC::IntlCollatorConstructorFuncSupportedLocalesOf): 11 * runtime/IntlCollatorPrototype.cpp: 12 (JSC::IntlCollatorPrototypeFuncResolvedOptions): 13 * runtime/IntlDateTimeFormatConstructor.cpp: 14 (JSC::constructIntlDateTimeFormat): 15 (JSC::IntlDateTimeFormatConstructorFuncSupportedLocalesOf): 16 * runtime/IntlDateTimeFormatPrototype.cpp: 17 (JSC::IntlDateTimeFormatFuncFormatDateTime): 18 (JSC::IntlDateTimeFormatPrototypeGetterFormat): 19 (JSC::IntlDateTimeFormatPrototypeFuncResolvedOptions): 20 * runtime/IntlNumberFormatConstructor.cpp: 21 (JSC::constructIntlNumberFormat): 22 (JSC::IntlNumberFormatConstructorFuncSupportedLocalesOf): 23 * runtime/IntlNumberFormatPrototype.cpp: 24 (JSC::IntlNumberFormatFuncFormatNumber): 25 (JSC::IntlNumberFormatPrototypeGetterFormat): 26 (JSC::IntlNumberFormatPrototypeFuncResolvedOptions): 27 * runtime/IntlObject.cpp: 28 (JSC::lookupSupportedLocales): 29 * runtime/IntlObjectInlines.h: 30 (JSC::constructIntlInstanceWithWorkaroundForLegacyIntlConstructor): 31 1 32 2016-11-28 Mark Lam <mark.lam@apple.com> 2 33 -
trunk/Source/JavaScriptCore/runtime/IntlCollatorConstructor.cpp
r206386 r209043 97 97 98 98 // 4. Return InitializeCollator(collator, locales, options). 99 scope.release(); 99 100 collator->initializeCollator(*state, state->argument(0), state->argument(1)); 100 101 return JSValue::encode(collator); … … 149 150 // 3. Return SupportedLocales(%Collator%.[[availableLocales]], requestedLocales, options). 150 151 JSGlobalObject* globalObject = state->callee()->globalObject(); 152 scope.release(); 151 153 return JSValue::encode(supportedLocales(*state, globalObject->intlCollatorAvailableLocales(), requestedLocales, state->argument(1))); 152 154 } -
trunk/Source/JavaScriptCore/runtime/IntlCollatorPrototype.cpp
r208767 r209043 146 146 return JSValue::encode(throwTypeError(state, scope, ASCIILiteral("Intl.Collator.prototype.resolvedOptions called on value that's not an object initialized as a Collator"))); 147 147 148 scope.release(); 148 149 return JSValue::encode(collator->resolvedOptions(*state)); 149 150 } -
trunk/Source/JavaScriptCore/runtime/IntlDateTimeFormatConstructor.cpp
r206386 r209043 97 97 98 98 // 4. Return InitializeDateTimeFormat(dateTimeFormat, locales, options). 99 scope.release(); 99 100 dateTimeFormat->initializeDateTimeFormat(*state, state->argument(0), state->argument(1)); 100 101 return JSValue::encode(dateTimeFormat); … … 150 151 151 152 // 3. Return SupportedLocales(availableLocales, requestedLocales, options). 153 scope.release(); 152 154 return JSValue::encode(supportedLocales(*state, availableLocales, requestedLocales, state->argument(1))); 153 155 } -
trunk/Source/JavaScriptCore/runtime/IntlDateTimeFormatPrototype.cpp
r206386 r209043 106 106 107 107 // 5. Return FormatDateTime(dtf, x). 108 scope.release(); 108 109 return JSValue::encode(format->format(*state, value)); 109 110 } … … 120 121 // FIXME: Workaround to provide compatibility with ECMA-402 1.0 call/apply patterns. 121 122 // https://bugs.webkit.org/show_bug.cgi?id=153679 122 if (!dtf) 123 dtf = jsDynamicCast<IntlDateTimeFormat*>(state->thisValue().get(state, vm.propertyNames->builtinNames().intlSubstituteValuePrivateName())); 123 if (!dtf) { 124 JSValue value = state->thisValue().get(state, vm.propertyNames->builtinNames().intlSubstituteValuePrivateName()); 125 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 126 dtf = jsDynamicCast<IntlDateTimeFormat*>(value); 127 } 124 128 125 129 // 2. ReturnIfAbrupt(dtf). … … 158 162 // FIXME: Workaround to provide compatibility with ECMA-402 1.0 call/apply patterns. 159 163 // https://bugs.webkit.org/show_bug.cgi?id=153679 160 if (!dateTimeFormat) 161 dateTimeFormat = jsDynamicCast<IntlDateTimeFormat*>(state->thisValue().get(state, vm.propertyNames->builtinNames().intlSubstituteValuePrivateName())); 164 if (!dateTimeFormat) { 165 JSValue value = state->thisValue().get(state, vm.propertyNames->builtinNames().intlSubstituteValuePrivateName()); 166 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 167 dateTimeFormat = jsDynamicCast<IntlDateTimeFormat*>(value); 168 } 162 169 163 170 if (!dateTimeFormat) 164 171 return JSValue::encode(throwTypeError(state, scope, ASCIILiteral("Intl.DateTimeFormat.prototype.resolvedOptions called on value that's not an object initialized as a DateTimeFormat"))); 165 172 173 scope.release(); 166 174 return JSValue::encode(dateTimeFormat->resolvedOptions(*state)); 167 175 } -
trunk/Source/JavaScriptCore/runtime/IntlNumberFormatConstructor.cpp
r206386 r209043 97 97 98 98 // 4. Return InitializeNumberFormat(numberFormat, locales, options). 99 scope.release(); 99 100 numberFormat->initializeNumberFormat(*state, state->argument(0), state->argument(1)); 100 101 return JSValue::encode(numberFormat); … … 150 151 151 152 // 3. Return SupportedLocales(availableLocales, requestedLocales, options). 153 scope.release(); 152 154 return JSValue::encode(supportedLocales(*state, availableLocales, requestedLocales, state->argument(1))); 153 155 } -
trunk/Source/JavaScriptCore/runtime/IntlNumberFormatPrototype.cpp
r206386 r209043 95 95 96 96 // 6. Return FormatNumber(nf, x). 97 scope.release(); 97 98 return JSValue::encode(numberFormat->formatNumber(*state, number)); 98 99 } … … 109 110 // FIXME: Workaround to provide compatibility with ECMA-402 1.0 call/apply patterns. 110 111 // https://bugs.webkit.org/show_bug.cgi?id=153679 111 if (!nf) 112 nf = jsDynamicCast<IntlNumberFormat*>(state->thisValue().get(state, vm.propertyNames->builtinNames().intlSubstituteValuePrivateName())); 112 if (!nf) { 113 JSValue value = state->thisValue().get(state, vm.propertyNames->builtinNames().intlSubstituteValuePrivateName()); 114 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 115 nf = jsDynamicCast<IntlNumberFormat*>(value); 116 } 113 117 114 118 if (!nf) … … 146 150 // FIXME: Workaround to provide compatibility with ECMA-402 1.0 call/apply patterns. 147 151 // https://bugs.webkit.org/show_bug.cgi?id=153679 148 if (!numberFormat) 149 numberFormat = jsDynamicCast<IntlNumberFormat*>(state->thisValue().get(state, vm.propertyNames->builtinNames().intlSubstituteValuePrivateName())); 152 if (!numberFormat) { 153 JSValue value = state->thisValue().get(state, vm.propertyNames->builtinNames().intlSubstituteValuePrivateName()); 154 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 155 numberFormat = jsDynamicCast<IntlNumberFormat*>(value); 156 } 150 157 151 158 if (!numberFormat) 152 159 return JSValue::encode(throwTypeError(state, scope, ASCIILiteral("Intl.NumberFormat.prototype.resolvedOptions called on value that's not an object initialized as a NumberFormat"))); 153 160 161 scope.release(); 154 162 return JSValue::encode(numberFormat->resolvedOptions(*state)); 155 163 } -
trunk/Source/JavaScriptCore/runtime/IntlObject.cpp
r206837 r209043 909 909 910 910 // f. If availableLocale is not undefined, then append locale to the end of subset. 911 if (!availableLocale.isNull()) 911 if (!availableLocale.isNull()) { 912 912 subset->push(&state, jsString(&state, locale)); 913 RETURN_IF_EXCEPTION(scope, nullptr); 914 } 913 915 914 916 // g. Increment k by 1. -
trunk/Source/JavaScriptCore/runtime/IntlObjectInlines.h
r206386 r209043 45 45 if (!jsDynamicCast<IntlInstance*>(thisValue)) { 46 46 JSValue prototype = callee->getDirect(vm, vm.propertyNames->prototype); 47 if (JSObject::defaultHasInstance(&state, thisValue, prototype)) { 47 bool hasInstance = JSObject::defaultHasInstance(&state, thisValue, prototype); 48 RETURN_IF_EXCEPTION(scope, JSValue()); 49 if (hasInstance) { 48 50 JSObject* thisObject = thisValue.toObject(&state); 49 51 RETURN_IF_EXCEPTION(scope, JSValue()); … … 56 58 } 57 59 } 58 60 scope.release(); 59 61 return factory(vm); 60 62 }
Note: See TracChangeset
for help on using the changeset viewer.