Add pipeline information to CSS error reporting.

This commit is contained in:
GauriGNaik 2015-12-04 19:19:21 -05:00 committed by Josh Matthews
parent 6032f8225b
commit fc81276c8e
27 changed files with 103 additions and 29 deletions

View file

@ -592,6 +592,14 @@ pub unsafe extern "C" fn shadow_check_callback(_cx: *mut JSContext,
DOMProxyShadowsResult::ShadowCheckFailed
}
#[derive(JSTraceable, HeapSizeOf)]
pub struct CSSError {
filename: String,
line: usize,
column: usize,
msg: String
}
impl ScriptTask {
pub fn page_fetch_complete(id: PipelineId, subpage: Option<SubpageId>, metadata: Metadata)
-> Option<ParserRoot> {
@ -1009,7 +1017,9 @@ impl ScriptTask {
ConstellationControlMsg::GetCurrentState(sender, pipeline_id) => {
let state = self.handle_get_current_state(pipeline_id);
sender.send(state).unwrap();
}
},
ConstellationControlMsg::ReportCSSError(pipeline_id, filename, line, column, msg) =>
self.handle_css_error_reporting(pipeline_id, filename, line, column, msg),
}
}
@ -2054,6 +2064,24 @@ impl ScriptTask {
// script runs?
self.notify_devtools(document.Title(), (*final_url).clone(), (id, None));
}
fn handle_css_error_reporting(&self, pipeline_id: PipelineId, filename: String,
line: usize, column: usize, msg: String) {
let parent_page = self.root_page();
let page = match parent_page.find(pipeline_id) {
Some(page) => page,
None => return,
};
let document = page.document();
let css_error = CSSError {
filename: filename,
line: line,
column: column,
msg: msg
};
document.report_css_error(css_error);
}
}
impl Drop for ScriptTask {