mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
This reverts commit 580062228b
.
This commit is contained in:
parent
c3fd27c225
commit
8e5f28839c
13 changed files with 123 additions and 161 deletions
|
@ -9,7 +9,7 @@
|
|||
use std::net::TcpStream;
|
||||
use std::time::{SystemTime, UNIX_EPOCH};
|
||||
|
||||
use chrono::{DateTime, Local};
|
||||
use chrono::{Local, LocalResult, TimeZone};
|
||||
use devtools_traits::{HttpRequest as DevtoolsHttpRequest, HttpResponse as DevtoolsHttpResponse};
|
||||
use headers::{ContentType, Cookie, HeaderMapExt};
|
||||
use http::{header, HeaderMap, Method, StatusCode};
|
||||
|
@ -371,13 +371,23 @@ impl NetworkEventActor {
|
|||
pub fn event_actor(&self) -> EventActor {
|
||||
// TODO: Send the correct values for startedDateTime, isXHR, private
|
||||
|
||||
let date_time: DateTime<Local> = self.request.startedDateTime.clone().into();
|
||||
let started_datetime_rfc3339 = match Local.timestamp_millis_opt(
|
||||
self.request
|
||||
.startedDateTime
|
||||
.duration_since(UNIX_EPOCH)
|
||||
.unwrap_or_default()
|
||||
.as_millis() as i64,
|
||||
) {
|
||||
LocalResult::None => "".to_owned(),
|
||||
LocalResult::Single(dateTime) => format!("{}", dateTime.to_rfc3339()),
|
||||
LocalResult::Ambiguous(dateTime, _) => format!("{}", dateTime.to_rfc3339()),
|
||||
};
|
||||
|
||||
EventActor {
|
||||
actor: self.name(),
|
||||
url: self.request.url.clone(),
|
||||
method: format!("{}", self.request.method),
|
||||
startedDateTime: date_time.to_rfc3339(),
|
||||
startedDateTime: started_datetime_rfc3339,
|
||||
timeStamp: self.request.timeStamp,
|
||||
isXHR: self.is_xhr,
|
||||
private: false,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue