Final steps

This commit is contained in:
GauriGNaik 2015-12-14 14:03:17 -05:00
parent 4143caaa57
commit 907322c666
7 changed files with 46 additions and 12 deletions

View file

@ -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

View file

@ -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

View file

@ -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);

View file

@ -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};

View file

@ -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 {

View file

@ -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();
}
}
}
}

View file

@ -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.