aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/devtools.rs
diff options
context:
space:
mode:
authorTamir Duberstein <tamird@gmail.com>2015-05-23 15:27:37 -0400
committerTamir Duberstein <tamird@gmail.com>2015-05-26 10:04:31 -0400
commitb5f74eb54cc4bb4cccc2f7cad8a358078eb591b6 (patch)
tree611fdea2ce7a6a195701a02900625f07f25ea46e /components/script/devtools.rs
parentbe6c251e4c01be61400786e25442f6df36f135f6 (diff)
downloadservo-b5f74eb54cc4bb4cccc2f7cad8a358078eb591b6.tar.gz
servo-b5f74eb54cc4bb4cccc2f7cad8a358078eb591b6.zip
Implemented `GetCachedMessages`
Diffstat (limited to 'components/script/devtools.rs')
-rw-r--r--components/script/devtools.rs41
1 files changed, 41 insertions, 0 deletions
diff --git a/components/script/devtools.rs b/components/script/devtools.rs
index cd093616207..f14e19999a5 100644
--- a/components/script/devtools.rs
+++ b/components/script/devtools.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::{CachedConsoleMessage, CachedConsoleMessageTypes, PAGE_ERROR, CONSOLE_API};
use devtools_traits::{EvaluateJSReply, NodeInfo, Modification, TimelineMarker, TimelineMarkerType};
use dom::bindings::conversions::FromJSValConvertible;
use dom::bindings::conversions::StringificationBehavior;
@@ -96,6 +97,46 @@ pub fn handle_get_layout(page: &Rc<Page>, pipeline: PipelineId, node_id: String,
reply.send((width, height)).unwrap();
}
+pub fn handle_get_cached_messages(_pipeline_id: PipelineId,
+ message_types: CachedConsoleMessageTypes,
+ reply: Sender<Vec<CachedConsoleMessage>>) {
+ //TODO: check the messageTypes against a global Cache for console messages and page exceptions
+ let mut messages = Vec::new();
+ if message_types.contains(PAGE_ERROR) {
+ //TODO: do for real
+ messages.push(CachedConsoleMessage::ConsoleAPI {
+ __type__: "consoleAPICall".to_owned(),
+ level: "error".to_owned(),
+ filename: "http://localhost/~mihai/mozilla/test.html".to_owned(),
+ lineNumber: 0,
+ functionName: String::new(),
+ timeStamp: 0,
+ private: false,
+ arguments: Vec::new(),
+ })
+ }
+ if message_types.contains(CONSOLE_API) {
+ //TODO: make script error reporter pass all reported errors
+ // to devtools and cache them for returning here.
+ messages.push(CachedConsoleMessage::PageError {
+ __type__: "pageError".to_owned(),
+ errorMessage: "page error test".to_owned(),
+ sourceName: String::new(),
+ lineText: String::new(),
+ lineNumber: 0,
+ columnNumber: 0,
+ category: String::new(),
+ timeStamp: 0,
+ error: false,
+ warning: false,
+ exception: false,
+ strict: false,
+ private: false,
+ })
+ }
+ reply.send(messages).unwrap();
+}
+
pub fn handle_modify_attribute(page: &Rc<Page>,
pipeline: PipelineId,
node_id: String,