Fix exception scope verification failures in runtime/Intl* files.
[WebKit-https.git] / Source / JavaScriptCore / runtime / IntlObjectInlines.h
index 1cf54b1d2880462da72639747454f4ed393dd4a0..eb0e859764d182863f0fc0ab53e953c444bcfd60 100644 (file)
@@ -44,20 +44,20 @@ JSValue constructIntlInstanceWithWorkaroundForLegacyIntlConstructor(ExecState& s
 
     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);
-            if (UNLIKELY(scope.exception()))
-                return jsUndefined();
+            RETURN_IF_EXCEPTION(scope, JSValue());
 
             IntlInstance* instance = factory(vm);
-            if (UNLIKELY(scope.exception()))
-                return jsUndefined();
+            RETURN_IF_EXCEPTION(scope, JSValue());
 
             thisObject->putDirect(vm, vm.propertyNames->builtinNames().intlSubstituteValuePrivateName(), instance);
             return thisObject;
         }
     }
-
+    scope.release();
     return factory(vm);
 }