aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--components/devtools/lib.rs13
-rw-r--r--components/devtools_traits/lib.rs12
-rw-r--r--components/script/dom/bindings/trace.rs3
-rw-r--r--components/script/dom/document.rs2
-rw-r--r--components/script/dom/window.rs3
-rw-r--r--components/script/script_thread.rs23
-rw-r--r--components/script_traits/lib.rs2
7 files changed, 46 insertions, 12 deletions
diff --git a/components/devtools/lib.rs b/components/devtools/lib.rs
index 5fd7191b586..2db915203bf 100644
--- a/components/devtools/lib.rs
+++ b/components/devtools/lib.rs
@@ -536,6 +536,19 @@ fn run_server(sender: Sender<DevtoolsControlMsg>,
worker_id)) =>
handle_console_message(actors.clone(), id, worker_id, console_message,
&actor_pipelines, &actor_workers),
+ DevtoolsControlMsg::FromScript(ScriptToDevtoolsControlMsg::ReportCSSError(
+ id,
+ css_error)) => {
+ let console_message = ConsoleMessage {
+ message: css_error.msg,
+ logLevel: LogLevel::Warn,
+ filename: css_error.filename,
+ lineNumber: css_error.line,
+ columnNumber: css_error.column,
+ };
+ handle_console_message(actors.clone(), id, None, console_message,
+ &actor_pipelines, &actor_workers)
+ },
DevtoolsControlMsg::FromChrome(ChromeToDevtoolsControlMsg::NetworkEvent(
request_id, network_event)) => {
// copy the accepted_connections vector
diff --git a/components/devtools_traits/lib.rs b/components/devtools_traits/lib.rs
index 59cb1d27cba..81644badc44 100644
--- a/components/devtools_traits/lib.rs
+++ b/components/devtools_traits/lib.rs
@@ -36,6 +36,7 @@ use std::net::TcpStream;
use time::Duration;
use time::Tm;
use url::Url;
+use util::mem::HeapSizeOf;
// Information would be attached to NewGlobal to be received and show in devtools.
// Extend these fields if we need more information.
@@ -45,6 +46,14 @@ pub struct DevtoolsPageInfo {
pub url: Url
}
+#[derive(Deserialize, HeapSizeOf, Serialize, Clone)]
+pub struct CSSError {
+ pub filename: String,
+ pub line: u32,
+ pub column: u32,
+ pub msg: String
+}
+
/// Messages to instruct the devtools server to update its known actors/state
/// according to changes in the browser.
pub enum DevtoolsControlMsg {
@@ -78,6 +87,9 @@ pub enum ScriptToDevtoolsControlMsg {
/// An animation frame with the given timestamp was processed in a script thread.
/// The actor with the provided name should be notified.
FramerateTick(String, f64),
+
+ /// Report a CSS parse error for the given pipeline
+ ReportCSSError(PipelineId, CSSError),
}
/// Serialized JS return values
diff --git a/components/script/dom/bindings/trace.rs b/components/script/dom/bindings/trace.rs
index aec55e62134..31dcc99daaa 100644
--- a/components/script/dom/bindings/trace.rs
+++ b/components/script/dom/bindings/trace.rs
@@ -33,6 +33,7 @@ use canvas_traits::WebGLError;
use canvas_traits::{CanvasGradientStop, LinearGradientStyle, RadialGradientStyle};
use canvas_traits::{CompositionOrBlending, LineCapStyle, LineJoinStyle, RepetitionStyle};
use cssparser::RGBA;
+use devtools_traits::CSSError;
use devtools_traits::WorkerId;
use dom::bindings::js::{JS, Root};
use dom::bindings::refcounted::Trusted;
@@ -98,6 +99,8 @@ pub trait JSTraceable {
fn trace(&self, trc: *mut JSTracer);
}
+no_jsmanaged_fields!(CSSError);
+
no_jsmanaged_fields!(EncodingRef);
no_jsmanaged_fields!(Reflector);
diff --git a/components/script/dom/document.rs b/components/script/dom/document.rs
index c4edaa7736c..bfc6e8b5ff2 100644
--- a/components/script/dom/document.rs
+++ b/components/script/dom/document.rs
@@ -2,6 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+use devtools_traits::CSSError;
use document_loader::{DocumentLoader, LoadType};
use dom::attr::{Attr, AttrValue};
use dom::bindings::cell::DOMRefCell;
@@ -88,7 +89,6 @@ use net_traits::ControlMsg::{GetCookiesForUrl, SetCookiesForUrl};
use net_traits::CookieSource::NonHTTP;
use net_traits::{AsyncResponseTarget, PendingAsyncLoad};
use num::ToPrimitive;
-use script_thread::CSSError;
use script_thread::{MainThreadScriptMsg, Runnable};
use script_traits::{ScriptMsg as ConstellationMsg, ScriptToCompositorMsg};
use script_traits::{TouchEventType, TouchId, UntrustedNodeAddress};
diff --git a/components/script/dom/window.rs b/components/script/dom/window.rs
index 8406583ed63..579f860bc5a 100644
--- a/components/script/dom/window.rs
+++ b/components/script/dom/window.rs
@@ -1370,6 +1370,9 @@ impl Window {
WindowBinding::Wrap(runtime.cx(), win)
}
+ pub fn live_devtools_updates(&self) -> bool {
+ return self.devtools_wants_updates.get();
+ }
}
fn should_move_clip_rect(clip_rect: Rect<Au>, new_viewport: Rect<f32>) -> bool {
diff --git a/components/script/script_thread.rs b/components/script/script_thread.rs
index f0ed7ac22d6..e1e14af9311 100644
--- a/components/script/script_thread.rs
+++ b/components/script/script_thread.rs
@@ -18,6 +18,7 @@
//! loop.
use devtools;
+use devtools_traits::CSSError;
use devtools_traits::{DevtoolScriptControlMsg, DevtoolsPageInfo};
use devtools_traits::{ScriptToDevtoolsControlMsg, WorkerId};
use document_loader::DocumentLoader;
@@ -702,14 +703,6 @@ 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 ScriptThread {
pub fn page_fetch_complete(id: PipelineId, subpage: Option<SubpageId>, metadata: Metadata)
-> Option<ParserRoot> {
@@ -2180,7 +2173,7 @@ impl ScriptThread {
}
fn handle_css_error_reporting(&self, pipeline_id: PipelineId, filename: String,
- line: usize, column: usize, msg: String) {
+ line: u32, column: u32, msg: String) {
let parent_page = self.root_page();
let page = match parent_page.find(pipeline_id) {
Some(page) => page,
@@ -2194,7 +2187,17 @@ impl ScriptThread {
column: column,
msg: msg
};
- document.report_css_error(css_error);
+
+ document.report_css_error(css_error.clone());
+ let window = page.window();
+
+ if window.live_devtools_updates() {
+ if let Some(ref chan) = self.devtools_chan {
+ chan.send(ScriptToDevtoolsControlMsg::ReportCSSError(
+ pipeline_id,
+ css_error)).unwrap();
+ }
+ }
}
}
diff --git a/components/script_traits/lib.rs b/components/script_traits/lib.rs
index a8905de4821..c87ac5304c3 100644
--- a/components/script_traits/lib.rs
+++ b/components/script_traits/lib.rs
@@ -144,7 +144,7 @@ pub enum ConstellationControlMsg {
parent: PipelineId
},
/// Report an error from a CSS parser for the given pipeline
- ReportCSSError(PipelineId, String, usize, usize, String),
+ ReportCSSError(PipelineId, String, u32, u32, String),
}
/// The type of input represented by a multi-touch event.