aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/script_task.rs
diff options
context:
space:
mode:
authorbors-servo <lbergstrom+bors@mozilla.com>2015-12-14 21:51:41 +0530
committerbors-servo <lbergstrom+bors@mozilla.com>2015-12-14 21:51:41 +0530
commitd11f96e27074b0130760a02d39d2da4e003c820e (patch)
tree8a221f4f7316cd41fd147bc4369b1bc9259ce387 /components/script/script_task.rs
parent6032f8225b765dd5a0645118d7b43fa5913f9431 (diff)
parentfc81276c8ef755a7b5c5b21ce5a58c4824efdd90 (diff)
downloadservo-d11f96e27074b0130760a02d39d2da4e003c820e.tar.gz
servo-d11f96e27074b0130760a02d39d2da4e003c820e.zip
Auto merge of #8971 - jdm:expose-css-errors-1, r=jdm
Add pipeline information to CSS error reporting. Rebase of #8838. <!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/8971) <!-- Reviewable:end -->
Diffstat (limited to 'components/script/script_task.rs')
-rw-r--r--components/script/script_task.rs30
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 {