diff options
author | bors-servo <metajack+bors@gmail.com> | 2015-05-26 10:34:03 -0500 |
---|---|---|
committer | bors-servo <metajack+bors@gmail.com> | 2015-05-26 10:34:03 -0500 |
commit | 8759d42559bc5c10f8d90903f33f75bddf44d9fe (patch) | |
tree | 808d6b11c7d2de44f31a888932c206bcedf26081 /components/script/devtools.rs | |
parent | 7d0409b8421e1b0c055507acc7d784cac890f47e (diff) | |
parent | b5f74eb54cc4bb4cccc2f7cad8a358078eb591b6 (diff) | |
download | servo-8759d42559bc5c10f8d90903f33f75bddf44d9fe.tar.gz servo-8759d42559bc5c10f8d90903f33f75bddf44d9fe.zip |
Auto merge of #6168 - tamird:get-cached-messages, r=jdm
Rebase of #4175, closes #4175. r? @jdm
<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/6168)
<!-- Reviewable:end -->
Diffstat (limited to 'components/script/devtools.rs')
-rw-r--r-- | components/script/devtools.rs | 41 |
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, |