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

@ -42,7 +42,6 @@ extern crate selectors;
extern crate serde_json;
extern crate servo_url;
extern crate style;
extern crate style_traits;
extern crate util;
extern crate webrender_traits;
@ -80,7 +79,7 @@ use layout::webrender_helpers::{WebRenderDisplayListConverter, WebRenderFrameBui
use layout::wrapper::LayoutNodeLayoutData;
use layout::wrapper::drop_style_and_layout_data;
use layout_traits::LayoutThreadFactory;
use msg::constellation_msg::PipelineId;
use msg::constellation_msg::{FrameId, PipelineId};
use net_traits::image_cache_thread::{ImageCacheChan, ImageCacheResult, ImageCacheThread};
use net_traits::image_cache_thread::UsePlaceholder;
use parking_lot::RwLock;
@ -235,6 +234,7 @@ impl LayoutThreadFactory for LayoutThread {
/// Spawns a new layout thread.
fn create(id: PipelineId,
top_level_frame_id: Option<FrameId>,
url: ServoUrl,
is_iframe: bool,
chan: (Sender<Msg>, Receiver<Msg>),
@ -251,7 +251,11 @@ impl LayoutThreadFactory for LayoutThread {
thread::spawn_named(format!("LayoutThread {:?}", id),
move || {
thread_state::initialize(thread_state::LAYOUT);
PipelineId::install(id);
if let Some(top_level_frame_id) = top_level_frame_id {
FrameId::install(top_level_frame_id);
}
{ // Ensures layout thread is destroyed before we send shutdown message
let sender = chan.0;
let layout = LayoutThread::new(id,
@ -718,6 +722,7 @@ impl LayoutThread {
fn create_layout_thread(&self, info: NewLayoutThreadInfo) {
LayoutThread::create(info.id,
FrameId::installed(),
info.url.clone(),
info.is_parent,
info.layout_pair,