Add ServoUrl as a parameter to report_error(...) of ParseErrorReporter

passes test-tidy
removed match and used map

added new test test_report_error_passing_correct_url(...) and modified old unit tests

removed the option for servourl and tidied up

removed the duplicate test.

made a few more changes after @cbrewster suggestions.

changed _url to url in few places

fixed the indenting
This commit is contained in:
avinash 2017-02-27 15:49:48 +05:30 committed by Connor Brewster
parent c62973b77b
commit f48f0567cf
7 changed files with 36 additions and 19 deletions

View file

@ -7,6 +7,7 @@ use ipc_channel::ipc::IpcSender;
use log;
use msg::constellation_msg::PipelineId;
use script_traits::ConstellationControlMsg;
use servo_url::ServoUrl;
use std::sync::{Mutex, Arc};
use style::error_reporting::ParseErrorReporter;
@ -21,11 +22,13 @@ pub struct CSSErrorReporter {
}
impl ParseErrorReporter for CSSErrorReporter {
fn report_error(&self, input: &mut Parser, position: SourcePosition, message: &str) {
let location = input.source_location(position);
if log_enabled!(log::LogLevel::Info) {
info!("{}:{} {}", location.line, location.column, message)
}
fn report_error(&self, input: &mut Parser, position: SourcePosition, message: &str,
url: &ServoUrl) {
let location = input.source_location(position);
if log_enabled!(log::LogLevel::Info) {
info!("Url:\t{}\n{}:{} {}", url.as_str(), location.line, location.column, message)
}
//TODO: report a real filename
let _ = self.script_chan.lock().unwrap().send(
ConstellationControlMsg::ReportCSSError(self.pipelineid,