зеркало из https://github.com/mozilla/pluotsorbet.git
VM stops if RuntimeException is not handled in a thread.
An error is thrown in context.js: TypeError: caller is undefined
This commit is contained in:
Родитель
876c4512d6
Коммит
0c3cf74a2e
|
@ -41,7 +41,7 @@ casper.test.begin("unit tests", 5 + gfxTests.length, function(test) {
|
|||
.withFrame(0, function() {
|
||||
casper.waitForText("DONE", function() {
|
||||
var content = this.getPageContent();
|
||||
if (content.contains("DONE: 70965 pass, 0 fail, 180 known fail, 0 unknown pass")) {
|
||||
if (content.contains("DONE: 70966 pass, 0 fail, 180 known fail, 0 unknown pass")) {
|
||||
test.pass('main unit tests');
|
||||
} else {
|
||||
this.debugPage();
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
package java.lang;
|
||||
|
||||
import gnu.testlet.Testlet;
|
||||
import gnu.testlet.TestHarness;
|
||||
|
||||
public class TestThread implements Testlet {
|
||||
private boolean result = false;
|
||||
|
||||
class RuntimeExceptionThread extends Thread {
|
||||
public void run() {
|
||||
throw new RuntimeException("runtime exception");
|
||||
}
|
||||
}
|
||||
|
||||
public void test(TestHarness th) {
|
||||
try {
|
||||
Thread t = new RuntimeExceptionThread();
|
||||
t.start();
|
||||
t.join();
|
||||
result = true;
|
||||
} catch (InterruptedException e) {
|
||||
th.fail("unexpected InterruptedException");
|
||||
}
|
||||
|
||||
th.check(result);
|
||||
}
|
||||
}
|
||||
|
18
vm.js
18
vm.js
|
@ -103,10 +103,26 @@ VM.execute = function(ctx) {
|
|||
|
||||
return;
|
||||
}
|
||||
|
||||
if (ctx.frames.length == 1) {
|
||||
break;
|
||||
}
|
||||
|
||||
popFrame(0);
|
||||
} while (frame.methodInfo);
|
||||
|
||||
ctx.kill();
|
||||
throw new Error(buildExceptionLog(ex, stackTrace));
|
||||
|
||||
if (ctx.thread && ctx.thread.waiting && ctx.thread.waiting.length > 0) {
|
||||
console.error(buildExceptionLog(ex, stackTrace));
|
||||
|
||||
ctx.thread.waiting.forEach(function(waitingCtx, n) {
|
||||
ctx.thread.waiting[n] = null;
|
||||
waitingCtx.wakeup(ctx.thread);
|
||||
});
|
||||
} else {
|
||||
throw new Error(buildExceptionLog(ex, stackTrace));
|
||||
}
|
||||
}
|
||||
|
||||
function checkArrayAccess(refArray, idx) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче