diff options
author | Martin Schröder <mschroeder@github.x-home.org> | 2015-03-06 23:40:09 +0100 |
---|---|---|
committer | Martin Schröder <mschroeder@github.x-home.org> | 2015-03-16 17:53:19 +0100 |
commit | 5c8b617715ff8add13adc731909106994bd1bbb5 (patch) | |
tree | 47ad6fecf2329583c99dd8e148c39fe8e8ad9073 /components/script/script_task.rs | |
parent | f30faeadd09b7ef553df9d270abeb3c242c4ce3a (diff) | |
download | servo-5c8b617715ff8add13adc731909106994bd1bbb5.tar.gz servo-5c8b617715ff8add13adc731909106994bd1bbb5.zip |
Refactored optional argument "last_modified" for Document
Fixes #4981
Diffstat (limited to 'components/script/script_task.rs')
-rw-r--r-- | components/script/script_task.rs | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/components/script/script_task.rs b/components/script/script_task.rs index 95b5a22369a..3041098e78c 100644 --- a/components/script/script_task.rs +++ b/components/script/script_task.rs @@ -66,6 +66,7 @@ use net::storage_task::StorageTask; use string_cache::Atom; use util::geometry::to_frac_px; use util::smallvec::SmallVec; +use util::str::DOMString; use util::task::{spawn_named, spawn_named_with_send_on_failure}; use util::task_state; @@ -979,19 +980,19 @@ impl ScriptTask { incomplete.subpage_id.map(|s| s.1), incomplete.window_size).root(); - let document = Document::new(window.r(), Some(final_url.clone()), - IsHTMLDocument::HTMLDocument, None, + let last_modified: Option<DOMString> = response.metadata.headers.as_ref().and_then(|headers| { + headers.get().map(|&LastModified(ref tm)| dom_last_modified(tm)) + }); + + let document = Document::new(window.r(), + Some(final_url.clone()), + IsHTMLDocument::HTMLDocument, + None, + last_modified, DocumentSource::FromParser).root(); window.r().init_browser_context(document.r(), frame_element.r()); - let last_modified = response.metadata.headers.as_ref().and_then(|headers| { - headers.get().map(|&LastModified(ref tm)| tm.clone()) - }); - if let Some(tm) = last_modified { - document.r().set_last_modified(dom_last_modified(&tm)); - } - // Create the root frame page.set_frame(Some(Frame { document: JS::from_rooted(document.r()), |