diff options
author | Ryan Dahl <ry@tinyclouds.org> | 2018-12-06 23:05:36 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-12-06 23:05:36 -0500 |
commit | c113df1bb8a0c7d0c560ad32c0291c918c7da7b4 (patch) | |
tree | 0d15de448be602c22aecb2ec65ac7667c437a209 /libdeno/libdeno_test.js | |
parent | 568ac0c9026b6f4012e2511a026bb5eb31a06020 (diff) |
Process source maps in Rust instead of JS (#1280)
- Improves speed and binary size significantly.
- Makes deno_last_exception() output a JSON structure.
- Isolate::execute and Isolate::event_loop now return
structured, mapped JSError objects on errors.
- Removes libdeno functions:
libdeno.setGlobalErrorHandler()
libdeno.setPromiseRejectHandler()
libdeno.setPromiseErrorExaminer()
In collaboration with Ryan Dahl.
Diffstat (limited to 'libdeno/libdeno_test.js')
-rw-r--r-- | libdeno/libdeno_test.js | 48 |
1 files changed, 4 insertions, 44 deletions
diff --git a/libdeno/libdeno_test.js b/libdeno/libdeno_test.js index c9eaaa0ca..bb36b02d9 100644 --- a/libdeno/libdeno_test.js +++ b/libdeno/libdeno_test.js @@ -99,23 +99,9 @@ global.SnapshotBug = () => { }; global.GlobalErrorHandling = () => { - libdeno.setGlobalErrorHandler((message, source, line, col, error) => { - libdeno.print(`line ${line} col ${col}`, true); - assert("ReferenceError: notdefined is not defined" === message); - assert(source === "helloworld.js"); - assert(line === 3); - assert(col === 1); - assert(error instanceof Error); - libdeno.send(new Uint8Array([42])); - }); eval("\n\n notdefined()\n//# sourceURL=helloworld.js"); }; -global.DoubleGlobalErrorHandlingFails = () => { - libdeno.setGlobalErrorHandler((message, source, line, col, error) => {}); - libdeno.setGlobalErrorHandler((message, source, line, col, error) => {}); -}; - // Allocate this buf at the top level to avoid GC. const dataBuf = new Uint8Array([3, 4]); @@ -134,33 +120,7 @@ global.DataBuf = () => { b[1] = 8; }; -global.PromiseRejectCatchHandling = () => { - let count = 0; - let promiseRef = null; - // When we have an error, libdeno sends something - function assertOrSend(cond) { - if (!cond) { - libdeno.send(new Uint8Array([42])); - } - } - libdeno.setPromiseErrorExaminer(() => { - assertOrSend(count === 2); - }); - libdeno.setPromiseRejectHandler((error, event, promise) => { - count++; - if (event === "RejectWithNoHandler") { - assertOrSend(error instanceof Error); - assertOrSend(error.message === "message"); - assertOrSend(count === 1); - promiseRef = promise; - } else if (event === "HandlerAddedAfterReject") { - assertOrSend(count === 2); - assertOrSend(promiseRef === promise); - } - // Should never reach 3! - assertOrSend(count !== 3); - }); - +global.CheckPromiseErrors = () => { async function fn() { throw new Error("message"); } @@ -169,10 +129,10 @@ global.PromiseRejectCatchHandling = () => { try { await fn(); } catch (e) { - assertOrSend(count === 2); + libdeno.send(new Uint8Array([42])); } })(); -} +}; global.Shared = () => { const ab = libdeno.shared; @@ -185,4 +145,4 @@ global.Shared = () => { ui8[0] = 42; ui8[1] = 43; ui8[2] = 44; -} +}; |