Skip to content

Commit

Permalink
fix: check exception after executePendingJobLoop in evaluate
Browse files Browse the repository at this point in the history
  • Loading branch information
HarlonWang committed Mar 31, 2023
1 parent ef2b3c0 commit 792f347
Showing 1 changed file with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1054,16 +1054,15 @@ public void testReturnJSCallback() {

@Test
public void testPromiseCrash() {
thrown.expect(QuickJSException.class);
thrown.expectMessage("我来自Exception的值");
QuickJSContext jsContext = createContext();
JSObject pofeng = jsContext.createNewJSObject();
JSObject gol = jsContext.getGlobalObject();
gol.setProperty("pofeng", pofeng);
pofeng.setProperty("getSystemInfo", new JSCallFunction() {
@Override
public Object call(Object... args) {
((JSFunction) ((JSObject) args[0]).getJSObject("success")).call("我来自Exception的值");
return "我来自Java的值";
}
pofeng.setProperty("getSystemInfo", args -> {
((JSFunction) ((JSObject) args[0]).getJSObject("success")).call("我来自Exception的值");
return "我来自Java的值";
});

String js = "new Promise((resolve, reject) => {\n" +
Expand Down

0 comments on commit 792f347

Please sign in to comment.