Report panics in web worker threads.

This commit is contained in:
Ms2ger 2016-05-17 18:07:12 +02:00
parent aa8c835d3b
commit 1ebe681d8d
7 changed files with 42 additions and 12 deletions

View file

@ -18,7 +18,7 @@ use ipc_channel::ipc::IpcSender;
use js::jsapi::{CurrentGlobalOrNull, GetGlobalForObjectCrossCompartment};
use js::jsapi::{JSContext, JSObject, JS_GetClass, MutableHandleValue};
use js::{JSCLASS_IS_DOMJSCLASS, JSCLASS_IS_GLOBAL};
use msg::constellation_msg::{ConstellationChan, PipelineId};
use msg::constellation_msg::{ConstellationChan, PanicMsg, PipelineId};
use net_traits::ResourceThread;
use profile_traits::mem;
use script_runtime::{CommonScriptMsg, ScriptChan, ScriptPort};
@ -263,6 +263,14 @@ impl<'a> GlobalRef<'a> {
GlobalRef::Worker(ref worker) => worker.reflector(),
}
}
/// Returns an `IpcSender` to report panics on.
pub fn panic_chan(&self) -> &IpcSender<PanicMsg> {
match *self {
GlobalRef::Window(ref window) => window.panic_chan(),
GlobalRef::Worker(ref worker) => worker.panic_chan(),
}
}
}
impl GlobalRoot {