From 17d6d6b336e48ab53ae1efa546df7c7b045152da Mon Sep 17 00:00:00 2001 From: Yoshiya Hinosawa Date: Sun, 26 Aug 2018 16:57:16 +0900 Subject: refactor: add and use libdeno.setGlobalErrorHandler instead of window.onerror --- js/globals.ts | 26 -------------------------- 1 file changed, 26 deletions(-) (limited to 'js/globals.ts') diff --git a/js/globals.ts b/js/globals.ts index 80e00ea15..0364aaf98 100644 --- a/js/globals.ts +++ b/js/globals.ts @@ -1,7 +1,6 @@ // Copyright 2018 the Deno authors. All rights reserved. MIT license. import { Console } from "./console"; -import { exit } from "./os"; import * as timers from "./timers"; import { TextDecoder, TextEncoder } from "./text_encoding"; import * as fetch_ from "./fetch"; @@ -12,13 +11,6 @@ declare global { interface Window { console: Console; define: Readonly; - onerror?: ( - message: string, - source: string, - lineno: number, - colno: number, - error: Error - ) => void; } const clearTimeout: typeof timers.clearTimer; @@ -43,30 +35,12 @@ window.window = window; window.libdeno = null; -// import "./url"; - window.setTimeout = timers.setTimeout; window.setInterval = timers.setInterval; window.clearTimeout = timers.clearTimer; window.clearInterval = timers.clearTimer; window.console = new Console(libdeno.print); -// Uncaught exceptions are sent to window.onerror by the privileged binding. -window.onerror = ( - message: string, - source: string, - lineno: number, - colno: number, - error: Error -) => { - // TODO Currently there is a bug in v8_source_maps.ts that causes a - // segfault if it is used within window.onerror. To workaround we - // uninstall the Error.prepareStackTrace handler. Users will get unmapped - // stack traces on uncaught exceptions until this issue is fixed. - //Error.prepareStackTrace = null; - console.log(error.stack); - exit(1); -}; window.TextEncoder = TextEncoder; window.TextDecoder = TextDecoder; -- cgit v1.2.3