Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Catching JS error in worker scope from evaluating JS in devtools panics #26324

Open
jdm opened this issue Apr 26, 2020 · 2 comments
Open

Catching JS error in worker scope from evaluating JS in devtools panics #26324

jdm opened this issue Apr 26, 2020 · 2 comments

Comments

@jdm
Copy link
Member

@jdm jdm commented Apr 26, 2020

called `Option::unwrap()` on a `None` value (thread WebWorker for http://localhost:8000/w.js, at components/script/dom/dedicatedworkerglobalscope.rs:502)
stack backtrace:
   0: backtrace::backtrace::libunwind::trace
             at /Users/joshmatthews/.cargo/git/checkouts/backtrace-rs-96ebaf1bcb788384/91a0aa4/src/backtrace/libunwind.rs:86
      backtrace::backtrace::trace_unsynchronized
             at /Users/joshmatthews/.cargo/git/checkouts/backtrace-rs-96ebaf1bcb788384/91a0aa4/src/backtrace/mod.rs:66
   1: <servo::backtrace::Print as core::fmt::Debug>::fmt
             at ports/glutin/backtrace.rs:49
   2: core::fmt::write
             at src/libcore/fmt/mod.rs:1069
   3: std::io::Write::write_fmt
             at /rustc/42abbd8878d3b67238f3611b0587c704ba94f39c/src/libstd/io/mod.rs:1504
   4: servo::backtrace::print
             at ports/glutin/backtrace.rs:17
   5: servo::main::{{closure}}
             at ports/glutin/main2.rs:150
   6: std::panicking::rust_panic_with_hook
             at src/libstd/panicking.rs:515
   7: rust_begin_unwind
             at src/libstd/panicking.rs:419
   8: std::panicking::begin_panic
   9: std::panicking::begin_panic
  10: core::option::Option<T>::unwrap
             at /rustc/42abbd8878d3b67238f3611b0587c704ba94f39c/src/libcore/macros/mod.rs:34
  11: script::dom::dedicatedworkerglobalscope::DedicatedWorkerGlobalScope::forward_error_to_worker_object
             at components/script/dom/dedicatedworkerglobalscope.rs:502
  12: script::dom::globalscope::GlobalScope::report_an_error
             at components/script/dom/globalscope.rs:2020
  13: script::dom::bindings::error::report_pending_exception
             at components/script/dom/bindings/error.rs:290
  14: script::dom::globalscope::GlobalScope::evaluate_script_on_global_with_result::{{closure}}
             at components/script/dom/globalscope.rs:2176
  15: profile_traits::time::profile
             at /Users/joshmatthews/src/servo-master/components/profile_traits/time.rs:147
  16: script::dom::globalscope::GlobalScope::evaluate_script_on_global_with_result
             at components/script/dom/globalscope.rs:2150
  17: script::dom::globalscope::GlobalScope::evaluate_js_on_global_with_result
             at components/script/dom/globalscope.rs:2129
  18: script::devtools::handle_evaluate_js
             at components/script/devtools.rs:37
  19: script::dom::dedicatedworkerglobalscope::DedicatedWorkerGlobalScope::handle_mixed_message
             at components/script/dom/dedicatedworkerglobalscope.rs:481
  20: <script::dom::dedicatedworkerglobalscope::DedicatedWorkerGlobalScope as script::dom::abstractworkerglobalscope::WorkerEventLoopMethods>::handle_event
             at components/script/dom/dedicatedworkerglobalscope.rs:195
  21: script::dom::abstractworkerglobalscope::run_worker_event_loop
             at components/script/dom/abstractworkerglobalscope.rs:139
  22: script::dom::dedicatedworkerglobalscope::DedicatedWorkerGlobalScope::run_worker_scope::{{closure}}::{{closure}}
             at components/script/dom/dedicatedworkerglobalscope.rs:418
  23: profile_traits::mem::ProfilerChan::run_with_memory_reporting
             at /Users/joshmatthews/src/servo-master/components/profile_traits/mem.rs:88
  24: script::dom::dedicatedworkerglobalscope::DedicatedWorkerGlobalScope::run_worker_scope::{{closure}}
             at components/script/dom/dedicatedworkerglobalscope.rs:407
  25: std::sys_common::backtrace::__rust_begin_short_backtrace
             at /rustc/42abbd8878d3b67238f3611b0587c704ba94f39c/src/libstd/sys_common/backtrace.rs:130
  26: std::thread::Builder::spawn_unchecked::{{closure}}::{{closure}}
             at /rustc/42abbd8878d3b67238f3611b0587c704ba94f39c/src/libstd/thread/mod.rs:475
  27: <std::panic::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once
             at /rustc/42abbd8878d3b67238f3611b0587c704ba94f39c/src/libstd/panic.rs:318
  28: std::panicking::try::do_call
             at /rustc/42abbd8878d3b67238f3611b0587c704ba94f39c/src/libstd/panicking.rs:331
  29: __rust_try
  30: std::panicking::try
             at /rustc/42abbd8878d3b67238f3611b0587c704ba94f39c/src/libstd/panicking.rs:274
  31: std::panic::catch_unwind
             at /rustc/42abbd8878d3b67238f3611b0587c704ba94f39c/src/libstd/panic.rs:394
  32: std::thread::Builder::spawn_unchecked::{{closure}}
             at /rustc/42abbd8878d3b67238f3611b0587c704ba94f39c/src/libstd/thread/mod.rs:474
  33: core::ops::function::FnOnce::call_once{{vtable.shim}}
             at /rustc/42abbd8878d3b67238f3611b0587c704ba94f39c/src/libcore/ops/function.rs:232
  34: <alloc::boxed::Box<F> as core::ops::function::FnOnce<A>>::call_once
             at /rustc/42abbd8878d3b67238f3611b0587c704ba94f39c/src/liballoc/boxed.rs:1008
  35: <alloc::boxed::Box<F> as core::ops::function::FnOnce<A>>::call_once
             at /rustc/42abbd8878d3b67238f3611b0587c704ba94f39c/src/liballoc/boxed.rs:1008
      std::sys::unix::thread::Thread::new::thread_start
             at src/libstd/sys/unix/thread.rs:87
  36: <unknown>
@jdm
Copy link
Member Author

@jdm jdm commented Apr 26, 2020

The devtools messages don't have the AutoWorkerReset that messages from the script thread do, which is the cause of this panic.

@jdm jdm changed the title Evaluating JS in worker scope from devtools panics Catching JS error in worker scope from evaluating JS in devtools panics Apr 26, 2020
@jdm
Copy link
Member Author

@jdm jdm commented Apr 26, 2020

This happens when I evaluate console.log("hi") in the console, but not "hi".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant
You can’t perform that action at this time.