mirror of
https://github.com/servo/servo.git
synced 2025-08-06 22:15:33 +01:00
Auto merge of #11244 - Ms2ger:catch-panics-workers, r=nox
Report panics in web worker threads. Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy --faster` does not report any errors - [ ] These changes fix #11234 (github issue number if applicable). Either: - [x] There are tests for these changes OR - [ ] These changes do not require tests because _____ Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/11244) <!-- Reviewable:end -->
This commit is contained in:
commit
bed6d45b35
7 changed files with 42 additions and 12 deletions
|
@ -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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue