diff options
Diffstat (limited to 'components/script/script_task.rs')
-rw-r--r-- | components/script/script_task.rs | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/components/script/script_task.rs b/components/script/script_task.rs index c4efab48169..3c54259fc3e 100644 --- a/components/script/script_task.rs +++ b/components/script/script_task.rs @@ -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 { |