Auto merge of #14173 - asajeffrey:script-thread-stores-top-level-frame-id, r=paulrouget

Report panics using the top-level frame id rather than the pipeline id

<!-- Please describe your changes on the following line: -->

At the moment, we report panics from script and layout using the root pipeline id. Once we are sharing more script threads, there won't be a root pipeline id any more. The plan is only to share script threads in the same tab, so there will be a top-level frame id that all the pipelines have in common. This PR reports panics using that top-level frame id.

This mostly makes a difference to the browser API: rather than targeting a `mozbrowsererror` event at the root iframe of the script thread that panicked, it targets it at the containing mozbrowser iframe.

---
<!-- 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` does not report any errors
- [X] These changes do not require tests because we don't test crash reporting

<!-- 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="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/14173)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2016-11-21 15:51:59 -06:00 committed by GitHub
commit bbc821607a
9 changed files with 203 additions and 195 deletions

View file

@ -26,7 +26,7 @@ use js::jsapi::{HandleValue, JS_SetInterruptCallback};
use js::jsapi::{JSAutoCompartment, JSContext};
use js::jsval::UndefinedValue;
use js::rust::Runtime;
use msg::constellation_msg::PipelineId;
use msg::constellation_msg::FrameId;
use net_traits::{IpcSend, load_whole_resource};
use net_traits::request::{CredentialsMode, Destination, RequestInit, Type as RequestType};
use rand::random;
@ -158,9 +158,14 @@ impl DedicatedWorkerGlobalScope {
closing: Arc<AtomicBool>) {
let serialized_worker_url = worker_url.to_string();
let name = format!("WebWorker for {}", serialized_worker_url);
let top_level_frame_id = FrameId::installed();
spawn_named(name, move || {
thread_state::initialize(thread_state::SCRIPT | thread_state::IN_WORKER);
PipelineId::install(init.pipeline_id);
if let Some(top_level_frame_id) = top_level_frame_id {
FrameId::install(top_level_frame_id);
}
let roots = RootCollection::new();
let _stack_roots_tls = StackRootTLS::new(&roots);