Modified: trunk/Source/_javascript_Core/jsc.cpp (203956 => 203957)
--- trunk/Source/_javascript_Core/jsc.cpp 2016-07-31 23:36:20 UTC (rev 203956)
+++ trunk/Source/_javascript_Core/jsc.cpp 2016-08-01 00:37:14 UTC (rev 203957)
@@ -2039,22 +2039,28 @@
static bool checkUncaughtException(VM& vm, GlobalObject* globalObject, JSValue exception, const String& expectedExceptionName)
{
+ vm.clearException();
if (!exception) {
printf("Expected uncaught exception with name '%s' but none was thrown\n", expectedExceptionName.utf8().data());
return false;
}
- JSValue exceptionName = exception.get(globalObject->globalExec(), vm.propertyNames->name);
+ ExecState* exec = globalObject->globalExec();
+ JSValue exceptionClass = globalObject->get(exec, Identifier::fromString(exec, expectedExceptionName));
+ if (!exceptionClass.isObject() || vm.exception()) {
+ printf("Expected uncaught exception with name '%s' but given exception class is not defined\n", expectedExceptionName.utf8().data());
+ return false;
+ }
- if (JSString* exceptionNameStr = jsDynamicCast<JSString*>(exceptionName)) {
- const String& name = exceptionNameStr->value(globalObject->globalExec());
- if (name == expectedExceptionName)
- return true;
- printf("Expected uncaught exception with name '%s' but got one with name '%s'\n", expectedExceptionName.utf8().data(), name.utf8().data());
- dumpException(globalObject, exception);
+ bool isInstanceOfExpectedException = jsCast<JSObject*>(exceptionClass)->hasInstance(exec, exception);
+ if (vm.exception()) {
+ printf("Expected uncaught exception with name '%s' but given exception class fails performing hasInstance\n", expectedExceptionName.utf8().data());
return false;
}
- printf("Expected uncaught exception with name '%s' but exception value did not have a name property\n", expectedExceptionName.utf8().data());
+ if (isInstanceOfExpectedException)
+ return true;
+
+ printf("Expected uncaught exception with name '%s' but exception value is not instance of this exception class\n", expectedExceptionName.utf8().data());
dumpException(globalObject, exception);
return false;
}
Modified: trunk/Source/_javascript_Core/runtime/JSObject.h (203956 => 203957)
--- trunk/Source/_javascript_Core/runtime/JSObject.h 2016-07-31 23:36:20 UTC (rev 203956)
+++ trunk/Source/_javascript_Core/runtime/JSObject.h 2016-08-01 00:37:14 UTC (rev 203957)
@@ -529,7 +529,7 @@
JSValue ordinaryToPrimitive(ExecState*, PreferredPrimitiveType) const;
JS_EXPORT_PRIVATE bool hasInstance(ExecState*, JSValue value, JSValue hasInstanceValue);
- bool hasInstance(ExecState*, JSValue);
+ JS_EXPORT_PRIVATE bool hasInstance(ExecState*, JSValue);
static bool defaultHasInstance(ExecState*, JSValue, JSValue prototypeProperty);
JS_EXPORT_PRIVATE static void getOwnPropertyNames(JSObject*, ExecState*, PropertyNameArray&, EnumerationMode);
Modified: trunk/Source/_javascript_Core/tests/test262.yaml (203956 => 203957)
--- trunk/Source/_javascript_Core/tests/test262.yaml 2016-07-31 23:36:20 UTC (rev 203956)
+++ trunk/Source/_javascript_Core/tests/test262.yaml 2016-08-01 00:37:14 UTC (rev 203957)
@@ -896,17 +896,17 @@
- path: test262/test/annexB/language/comments/multi-line-html-close.js
cmd: runTest262 :fail, "Test262Error", ["../../../../harness/assert.js", "../../../../harness/sta.js"], [:strict]
- path: test262/test/annexB/language/comments/single-line-html-close-asi.js
- cmd: runTest262 :fail, "Test262Error", ["../../../../harness/assert.js", "../../../../harness/sta.js"], []
+ cmd: runTest262 :normal, "Test262Error", ["../../../../harness/assert.js", "../../../../harness/sta.js"], []
- path: test262/test/annexB/language/comments/single-line-html-close-asi.js
- cmd: runTest262 :fail, "Test262Error", ["../../../../harness/assert.js", "../../../../harness/sta.js"], [:strict]
+ cmd: runTest262 :normal, "Test262Error", ["../../../../harness/assert.js", "../../../../harness/sta.js"], [:strict]
- path: test262/test/annexB/language/comments/single-line-html-close.js
- cmd: runTest262 :fail, "Test262Error", ["../../../../harness/assert.js", "../../../../harness/sta.js"], []
+ cmd: runTest262 :normal, "Test262Error", ["../../../../harness/assert.js", "../../../../harness/sta.js"], []
- path: test262/test/annexB/language/comments/single-line-html-close.js
- cmd: runTest262 :fail, "Test262Error", ["../../../../harness/assert.js", "../../../../harness/sta.js"], [:strict]
+ cmd: runTest262 :normal, "Test262Error", ["../../../../harness/assert.js", "../../../../harness/sta.js"], [:strict]
- path: test262/test/annexB/language/comments/single-line-html-open.js
- cmd: runTest262 :fail, "Test262Error", ["../../../../harness/assert.js", "../../../../harness/sta.js"], []
+ cmd: runTest262 :normal, "Test262Error", ["../../../../harness/assert.js", "../../../../harness/sta.js"], []
- path: test262/test/annexB/language/comments/single-line-html-open.js
- cmd: runTest262 :fail, "Test262Error", ["../../../../harness/assert.js", "../../../../harness/sta.js"], [:strict]
+ cmd: runTest262 :normal, "Test262Error", ["../../../../harness/assert.js", "../../../../harness/sta.js"], [:strict]
- path: test262/test/annexB/language/eval-code/direct/func-block-decl-eval-func-block-scoping.js
cmd: runTest262 :normal, "NoException", ["../../../../../harness/assert.js", "../../../../../harness/sta.js"], []
- path: test262/test/annexB/language/eval-code/direct/func-block-decl-eval-func-exsting-block-fn-no-init.js
@@ -70882,7 +70882,7 @@
- path: test262/test/language/module-code/eval-export-dflt-expr-cls-named.js
cmd: runTest262 :normal, "NoException", ["../../../harness/assert.js", "../../../harness/sta.js"], [:module]
- path: test262/test/language/module-code/eval-export-dflt-expr-err-eval.js
- cmd: runTest262 :fail, "Test262Error", ["../../../harness/assert.js", "../../../harness/sta.js"], [:module]
+ cmd: runTest262 :normal, "Test262Error", ["../../../harness/assert.js", "../../../harness/sta.js"], [:module]
- path: test262/test/language/module-code/eval-export-dflt-expr-err-get-value.js
cmd: runTest262 :normal, "ReferenceError", ["../../../harness/assert.js", "../../../harness/sta.js"], [:module]
- path: test262/test/language/module-code/eval-export-dflt-expr-fn-anon.js
@@ -70960,7 +70960,7 @@
- path: test262/test/language/module-code/eval-rqstd-order.js
cmd: runTest262 :normal, "NoException", ["../../../harness/assert.js", "../../../harness/sta.js", "../../../harness/fnGlobalObject.js"], [:module]
- path: test262/test/language/module-code/eval-self-abrupt.js
- cmd: runTest262 :fail, "Test262Error", ["../../../harness/assert.js", "../../../harness/sta.js"], [:module]
+ cmd: runTest262 :normal, "Test262Error", ["../../../harness/assert.js", "../../../harness/sta.js"], [:module]
- path: test262/test/language/module-code/eval-self-once.js
cmd: runTest262 :normal, "NoException", ["../../../harness/assert.js", "../../../harness/sta.js", "../../../harness/fnGlobalObject.js"], [:module]
- path: test262/test/language/module-code/eval-this.js