servo: Merge #10931 - Send the panic reason and backtrace in mozbrowsererror (from asajeffrey:send-panic-backtrace-to-mozbrowser); r=jdm
authorAlan Jeffrey <ajeffrey@mozilla.com>
Sat, 30 Apr 2016 07:30:38 -0700
changeset 338675 35ceae5a60882e6b168e5549257c76a0e80b7930
parent 338674 65db4f77c0a6852aaa6c3a6f1464cf9eeb778c49
child 338676 5fcdeedac844adcd2fa3185c3398baa497517b29
push id31307
push usergszorc@mozilla.com
push dateSat, 04 Feb 2017 00:59:06 +0000
treeherdermozilla-central@94079d43835f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjdm
servo: Merge #10931 - Send the panic reason and backtrace in mozbrowsererror (from asajeffrey:send-panic-backtrace-to-mozbrowser); r=jdm Closes #10334. Glues together PRs #10837 and #10824. Source-Repo: https://github.com/servo/servo Source-Revision: d9dc6dd03cf9b8b0982b54d83dd0cdded059c3b6
servo/components/compositing/constellation.rs
--- a/servo/components/compositing/constellation.rs
+++ b/servo/components/compositing/constellation.rs
@@ -869,17 +869,17 @@ impl<LTF: LayoutThreadFactory, STF: Scri
         debug!("Panic handler for pipeline {:?}: {}.", pipeline_id, reason);
 
         if let Some(pipeline_id) = pipeline_id {
 
             let parent_info = self.pipelines.get(&pipeline_id).and_then(|pipeline| pipeline.parent_info);
             let window_size = self.pipelines.get(&pipeline_id).and_then(|pipeline| pipeline.size);
 
             // Notify the browser chrome that the pipeline has failed
-            self.trigger_mozbrowsererror(pipeline_id);
+            self.trigger_mozbrowsererror(pipeline_id, reason, backtrace);
 
             self.close_pipeline(pipeline_id, ExitPipelineMode::Force);
 
             while let Some(pending_pipeline_id) = self.pending_frames.iter().find(|pending| {
                 pending.old_pipeline_id == Some(pipeline_id)
             }).map(|frame| frame.new_pipeline_id) {
                 warn!("removing pending frame change for failed pipeline");
                 self.close_pipeline(pending_pipeline_id, ExitPipelineMode::Force);
@@ -1962,31 +1962,30 @@ impl<LTF: LayoutThreadFactory, STF: Scri
                     }
                 }
             }
         }
     }
 
     // https://developer.mozilla.org/en-US/docs/Web/Events/mozbrowsererror
     // Note that this does not require the pipeline to be an immediate child of the root
-    // TODO: propagate more error information, e.g. a backtrace
-    fn trigger_mozbrowsererror(&self, pipeline_id: PipelineId) {
+    fn trigger_mozbrowsererror(&self, pipeline_id: PipelineId, reason: String, backtrace: String) {
         if !prefs::get_pref("dom.mozbrowser.enabled").as_boolean().unwrap_or(false) { return; }
 
         if let Some(pipeline) = self.pipelines.get(&pipeline_id) {
             if let Some(mut ancestor_info) = pipeline.parent_info {
                 if let Some(mut ancestor) = self.pipelines.get(&ancestor_info.0) {
                     while let Some(next_info) = ancestor.parent_info {
                         ancestor_info = next_info;
                         ancestor = match self.pipelines.get(&ancestor_info.0) {
                             Some(ancestor) => ancestor,
                             None => return warn!("Mozbrowsererror via closed pipeline {:?}.", ancestor_info.0),
                         };
                     }
-                    let event = MozBrowserEvent::Error(MozBrowserErrorType::Fatal, None, None);
+                    let event = MozBrowserEvent::Error(MozBrowserErrorType::Fatal, Some(reason), Some(backtrace));
                     ancestor.trigger_mozbrowser_event(ancestor_info.1, event);
                 }
             }
         }
     }
 
     fn focused_pipeline_in_tree(&self, frame_id: FrameId) -> bool {
         self.focus_pipeline_id.map_or(false, |pipeline_id| {