mirror of
https://github.com/servo/servo.git
synced 2025-07-25 16:20:36 +01:00
Final steps
This commit is contained in:
parent
4143caaa57
commit
907322c666
7 changed files with 46 additions and 12 deletions
|
@ -536,6 +536,19 @@ fn run_server(sender: Sender<DevtoolsControlMsg>,
|
||||||
worker_id)) =>
|
worker_id)) =>
|
||||||
handle_console_message(actors.clone(), id, worker_id, console_message,
|
handle_console_message(actors.clone(), id, worker_id, console_message,
|
||||||
&actor_pipelines, &actor_workers),
|
&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(
|
DevtoolsControlMsg::FromChrome(ChromeToDevtoolsControlMsg::NetworkEvent(
|
||||||
request_id, network_event)) => {
|
request_id, network_event)) => {
|
||||||
// copy the accepted_connections vector
|
// copy the accepted_connections vector
|
||||||
|
|
|
@ -36,6 +36,7 @@ use std::net::TcpStream;
|
||||||
use time::Duration;
|
use time::Duration;
|
||||||
use time::Tm;
|
use time::Tm;
|
||||||
use url::Url;
|
use url::Url;
|
||||||
|
use util::mem::HeapSizeOf;
|
||||||
|
|
||||||
// Information would be attached to NewGlobal to be received and show in devtools.
|
// Information would be attached to NewGlobal to be received and show in devtools.
|
||||||
// Extend these fields if we need more information.
|
// Extend these fields if we need more information.
|
||||||
|
@ -45,6 +46,14 @@ pub struct DevtoolsPageInfo {
|
||||||
pub url: Url
|
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
|
/// Messages to instruct the devtools server to update its known actors/state
|
||||||
/// according to changes in the browser.
|
/// according to changes in the browser.
|
||||||
pub enum DevtoolsControlMsg {
|
pub enum DevtoolsControlMsg {
|
||||||
|
@ -78,6 +87,9 @@ pub enum ScriptToDevtoolsControlMsg {
|
||||||
/// An animation frame with the given timestamp was processed in a script thread.
|
/// An animation frame with the given timestamp was processed in a script thread.
|
||||||
/// The actor with the provided name should be notified.
|
/// The actor with the provided name should be notified.
|
||||||
FramerateTick(String, f64),
|
FramerateTick(String, f64),
|
||||||
|
|
||||||
|
/// Report a CSS parse error for the given pipeline
|
||||||
|
ReportCSSError(PipelineId, CSSError),
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Serialized JS return values
|
/// Serialized JS return values
|
||||||
|
|
|
@ -33,6 +33,7 @@ use canvas_traits::WebGLError;
|
||||||
use canvas_traits::{CanvasGradientStop, LinearGradientStyle, RadialGradientStyle};
|
use canvas_traits::{CanvasGradientStop, LinearGradientStyle, RadialGradientStyle};
|
||||||
use canvas_traits::{CompositionOrBlending, LineCapStyle, LineJoinStyle, RepetitionStyle};
|
use canvas_traits::{CompositionOrBlending, LineCapStyle, LineJoinStyle, RepetitionStyle};
|
||||||
use cssparser::RGBA;
|
use cssparser::RGBA;
|
||||||
|
use devtools_traits::CSSError;
|
||||||
use devtools_traits::WorkerId;
|
use devtools_traits::WorkerId;
|
||||||
use dom::bindings::js::{JS, Root};
|
use dom::bindings::js::{JS, Root};
|
||||||
use dom::bindings::refcounted::Trusted;
|
use dom::bindings::refcounted::Trusted;
|
||||||
|
@ -98,6 +99,8 @@ pub trait JSTraceable {
|
||||||
fn trace(&self, trc: *mut JSTracer);
|
fn trace(&self, trc: *mut JSTracer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
no_jsmanaged_fields!(CSSError);
|
||||||
|
|
||||||
no_jsmanaged_fields!(EncodingRef);
|
no_jsmanaged_fields!(EncodingRef);
|
||||||
|
|
||||||
no_jsmanaged_fields!(Reflector);
|
no_jsmanaged_fields!(Reflector);
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* 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/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
|
use devtools_traits::CSSError;
|
||||||
use document_loader::{DocumentLoader, LoadType};
|
use document_loader::{DocumentLoader, LoadType};
|
||||||
use dom::attr::{Attr, AttrValue};
|
use dom::attr::{Attr, AttrValue};
|
||||||
use dom::bindings::cell::DOMRefCell;
|
use dom::bindings::cell::DOMRefCell;
|
||||||
|
@ -88,7 +89,6 @@ use net_traits::ControlMsg::{GetCookiesForUrl, SetCookiesForUrl};
|
||||||
use net_traits::CookieSource::NonHTTP;
|
use net_traits::CookieSource::NonHTTP;
|
||||||
use net_traits::{AsyncResponseTarget, PendingAsyncLoad};
|
use net_traits::{AsyncResponseTarget, PendingAsyncLoad};
|
||||||
use num::ToPrimitive;
|
use num::ToPrimitive;
|
||||||
use script_thread::CSSError;
|
|
||||||
use script_thread::{MainThreadScriptMsg, Runnable};
|
use script_thread::{MainThreadScriptMsg, Runnable};
|
||||||
use script_traits::{ScriptMsg as ConstellationMsg, ScriptToCompositorMsg};
|
use script_traits::{ScriptMsg as ConstellationMsg, ScriptToCompositorMsg};
|
||||||
use script_traits::{TouchEventType, TouchId, UntrustedNodeAddress};
|
use script_traits::{TouchEventType, TouchId, UntrustedNodeAddress};
|
||||||
|
|
|
@ -1370,6 +1370,9 @@ impl Window {
|
||||||
|
|
||||||
WindowBinding::Wrap(runtime.cx(), win)
|
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 {
|
fn should_move_clip_rect(clip_rect: Rect<Au>, new_viewport: Rect<f32>) -> bool {
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
//! loop.
|
//! loop.
|
||||||
|
|
||||||
use devtools;
|
use devtools;
|
||||||
|
use devtools_traits::CSSError;
|
||||||
use devtools_traits::{DevtoolScriptControlMsg, DevtoolsPageInfo};
|
use devtools_traits::{DevtoolScriptControlMsg, DevtoolsPageInfo};
|
||||||
use devtools_traits::{ScriptToDevtoolsControlMsg, WorkerId};
|
use devtools_traits::{ScriptToDevtoolsControlMsg, WorkerId};
|
||||||
use document_loader::DocumentLoader;
|
use document_loader::DocumentLoader;
|
||||||
|
@ -702,14 +703,6 @@ pub unsafe extern "C" fn shadow_check_callback(_cx: *mut JSContext,
|
||||||
DOMProxyShadowsResult::ShadowCheckFailed
|
DOMProxyShadowsResult::ShadowCheckFailed
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(JSTraceable, HeapSizeOf)]
|
|
||||||
pub struct CSSError {
|
|
||||||
filename: String,
|
|
||||||
line: usize,
|
|
||||||
column: usize,
|
|
||||||
msg: String
|
|
||||||
}
|
|
||||||
|
|
||||||
impl ScriptThread {
|
impl ScriptThread {
|
||||||
pub fn page_fetch_complete(id: PipelineId, subpage: Option<SubpageId>, metadata: Metadata)
|
pub fn page_fetch_complete(id: PipelineId, subpage: Option<SubpageId>, metadata: Metadata)
|
||||||
-> Option<ParserRoot> {
|
-> Option<ParserRoot> {
|
||||||
|
@ -2180,7 +2173,7 @@ impl ScriptThread {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn handle_css_error_reporting(&self, pipeline_id: PipelineId, filename: String,
|
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 parent_page = self.root_page();
|
||||||
let page = match parent_page.find(pipeline_id) {
|
let page = match parent_page.find(pipeline_id) {
|
||||||
Some(page) => page,
|
Some(page) => page,
|
||||||
|
@ -2194,7 +2187,17 @@ impl ScriptThread {
|
||||||
column: column,
|
column: column,
|
||||||
msg: msg
|
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();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -144,7 +144,7 @@ pub enum ConstellationControlMsg {
|
||||||
parent: PipelineId
|
parent: PipelineId
|
||||||
},
|
},
|
||||||
/// Report an error from a CSS parser for the given pipeline
|
/// 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.
|
/// The type of input represented by a multi-touch event.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue