Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion native/quickjs
Submodule quickjs updated 66 files
+166 −0 .github/workflows/ci.yml
+24 −0 .gitignore
+27 −0 Changelog
+1 −1 LICENSE
+177 −57 Makefile
+2 −5 TODO
+1 −1 VERSION
+6 −0 compat/test-closefrom.c
+3 −3 cutils.c
+61 −11 cutils.h
+1 −1 doc/jsbignum.texi
+47 −22 doc/quickjs.texi
+1 −1 examples/fib.c
+1 −1 examples/pi_bigdecimal.js
+1 −1 examples/pi_bigfloat.js
+1 −1 examples/pi_bigint.js
+6 −6 examples/point.c
+27 −0 fuzz/README
+257 −0 fuzz/fuzz.dict
+62 −0 fuzz/fuzz_common.c
+22 −0 fuzz/fuzz_common.h
+93 −0 fuzz/fuzz_compile.c
+49 −0 fuzz/fuzz_eval.c
+59 −0 fuzz/fuzz_regexp.c
+24 −0 fuzz/generate_dict.js
+294 −285 libbf.c
+11 −11 libbf.h
+2 −3 libregexp-opcode.h
+231 −340 libregexp.c
+6 −43 libregexp.h
+1,379 −1,271 libunicode-table.h
+459 −105 libunicode.c
+80 −22 libunicode.h
+3 −4 list.h
+18 −24 qjs.c
+29 −30 qjsc.c
+38 −38 qjscalc.js
+9 −9 quickjs-atom.h
+321 −192 quickjs-libc.c
+3 −2 quickjs-libc.h
+15 −8 quickjs-opcode.h
+5,012 −3,331 quickjs.c
+57 −23 quickjs.h
+4 −4 release.sh
+138 −113 repl.js
+175 −66 run-test262.c
+34 −16 test262.conf
+8 −35 test262_errors.txt
+3 −0 test262o.conf
+3 −3 tests/bjson.c
+377 −120 tests/microbench.js
+17 −15 tests/test262.patch
+279 −0 tests/test_bigfloat.js
+1 −213 tests/test_bignum.js
+3 −3 tests/test_bjson.js
+217 −44 tests/test_builtin.js
+2 −2 tests/test_closure.js
+100 −19 tests/test_language.js
+25 −1 tests/test_loop.js
+2 −2 tests/test_op_overloading.js
+4 −4 tests/test_qjscalc.js
+44 −18 tests/test_std.js
+3 −2 tests/test_worker_module.js
+2 −2 unicode_download.sh
+341 −173 unicode_gen.c
+2 −0 unicode_gen_def.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public String getModuleStringCode(String moduleName) {
"assertAge(age);\n" +
"new Promise((resolve, reject) => { name = 'Updated'; }).catch((res) => { assertNameUpdated(res); });");

assertNull(ret);
assertEquals(ret.toString(), "[object Promise]");

context.destroy();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -454,183 +454,6 @@ public void testCreateNewJSArray() {
context.destroy();
}

@Test
public void testNotAFunction() {
QuickJSContext context = createContext();
try {
context.evaluate("var a = 1; a();");
} catch (QuickJSException e) {
assertTrue(e.toString().contains("'a' is not a function"));
}

context.destroy();
}

@Test
public void testNotAFunction2() {
QuickJSContext context = createContext();
try {
context.evaluate("function a() {\n" +
"\tvar b = {};\n" +
"\tb();\n" +
"}\n" +
"a();");
} catch (QuickJSException e) {
assertTrue(e.toString().contains("'b' is not a function"));
}


try {
context.evaluate("function a() {\n" +
"\tvar b = {}; var d = 1;\n" +
"\td();\n" +
"}\n" +
"a();");
} catch (QuickJSException e) {
assertTrue(e.toString().contains("'d' is not a function"));
}

try {
context.evaluate("function a() {\n" +
"\tvar b = {}; var d = 1; var c = 1;\n" +
"\tc();\n" +
"}\n" +
"a();");
} catch (QuickJSException e) {
assertTrue(e.toString().contains("'c' is not a function"));
}

try {
context.evaluate("function a() {\n" +
"\tvar b = {}; var d = 1; var c = 1;var d = [];\n" +
"\td();\n" +
"}\n" +
"a();");
} catch (QuickJSException e) {
assertTrue(e.toString().contains("'d' is not a function"));
}

try {
context.evaluate("function a() {\n" +
"\tvar b = {}; var d = 1; var c = 1;var d = []; var e = {};\n" +
"\te();\n" +
"}\n" +
"a();");
} catch (QuickJSException e) {
assertTrue(e.toString().contains("'e' is not a function"));
}

try {
context.evaluate("function a(aa) {\n" +
"\taa();\n" +
"}\n" +
"a();");
} catch (QuickJSException e) {
assertTrue(e.toString().contains("'aa' is not a function"));
}

try {
context.evaluate("function a(aa, bb) {\n" +
"\tbb();\n" +
"}\n" +
"a();");
} catch (QuickJSException e) {
assertTrue(e.toString().contains("'bb' is not a function"));
}

try {
context.evaluate("function a(aa, bb, cc) {\n" +
"\tcc();\n" +
"}\n" +
"a();");
} catch (QuickJSException e) {
assertTrue(e.toString().contains("'cc' is not a function"));
}

try {
context.evaluate("function a(aa, bb, cc, dd) {\n" +
"\tdd();\n" +
"}\n" +
"a();");
} catch (QuickJSException e) {
assertTrue(e.toString().contains("'dd' is not a function"));
}

try {
context.evaluate("function a(aa, bb, cc, dd, ee) {\n" +
"\tee();\n" +
"}\n" +
"a();");
} catch (QuickJSException e) {
assertTrue(e.toString().contains("'ee' is not a function"));
}

try {
context.evaluate("function test (){var a = {}; function test1 () {a(); } test1();} test();");
} catch (QuickJSException e) {
assertTrue(e.toString().contains("'a' is not a function"));
}

try {
context.evaluate("var a = {}; a.b();");
} catch (QuickJSException e) {
assertTrue(e.toString().contains("'b' is not a function"));
}

try {
context.evaluate("function test (){var a = {}; var b = 1;var c = 1; var d = 1; var e = 1; function test1 () {b = a; c = a; d = e; c = b;e(); } test1();} test();");
} catch (QuickJSException e) {
assertTrue(e.toString().contains("'e' is not a function"));
}

try {
context.evaluate("[1, 2].atIndex(0);");
} catch (QuickJSException e) {
assertTrue(e.toString().contains("'atIndex' is not a function"));
}

try {
context.evaluate("var C={index:function(e){\n" +
"\tfunction t(){\n" +
"\t \tvar e = {router: {}};\n" +
"\t\te.router.navigsateTo(\"1\")\n" +
"\t}\n" +
"\tfor(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)\n" +
"\tr[o-1]=arguments[o]\n" +
"\treturn t.apply(null,r);\n" +
"}};\n" +
"\n" +
"C.index();");
} catch (QuickJSException e) {
assertTrue(e.toString().contains("'navigsateTo' is not a function"));
}

try {
context.evaluate("'aa'.splice(0, 1)");
} catch (QuickJSException e) {
assertTrue(e.toString().contains("'aa.splice' is not a function"));
}

try {
context.evaluate("const assert = {}; const format22 = () => {};assert.match(format22(), 123);");
} catch (QuickJSException e) {
assertTrue(e.toString().contains("'assert.match' is not a function"));
}

context.destroy();
}

@Test
public void testNotAFunctionInPromise() {
QuickJSContext context = createContext();
try {
context.evaluate("new Promise({name: 'a'});");
} catch (QuickJSException e) {
assertTrue(e.toString().contains("'[object Object]' is not a function"));
}
context.destroy();
}

@Test
public void testStackOverflowWithStackSize() {
QuickJSContext context = createContext();
Expand Down
3 changes: 2 additions & 1 deletion wrapper-java/src/main/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,5 @@ add_library( # Sets the name of the library.


include_directories($ENV{JAVA_HOME}/include/)
include_directories($ENV{JAVA_HOME}/include/darwin)
include_directories($ENV{JAVA_HOME}/include/darwin)
include_directories($ENV{JAVA_HOME}/include/linux)