aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/script_thread.rs
diff options
context:
space:
mode:
authorMs2ger <ms2ger@gmail.com>2016-02-09 14:00:39 +0100
committerMs2ger <ms2ger@gmail.com>2016-02-11 13:08:11 +0100
commit152cec69eb20f52217aa1905255e4d439a7119b6 (patch)
tree80057589f009fb4138dfa431db2bf4ec62ec2772 /components/script/script_thread.rs
parent0b27807ad4229a07ba6e04aa59798af50da60c14 (diff)
downloadservo-152cec69eb20f52217aa1905255e4d439a7119b6.tar.gz
servo-152cec69eb20f52217aa1905255e4d439a7119b6.zip
Store a pointer to the browsing context in the Document.
Diffstat (limited to 'components/script/script_thread.rs')
-rw-r--r--components/script/script_thread.rs11
1 files changed, 7 insertions, 4 deletions
diff --git a/components/script/script_thread.rs b/components/script/script_thread.rs
index 83e60a50549..5907490dd05 100644
--- a/components/script/script_thread.rs
+++ b/components/script/script_thread.rs
@@ -32,6 +32,7 @@ use dom::bindings::js::{RootCollectionPtr, RootedReference};
use dom::bindings::refcounted::{LiveDOMReferences, Trusted, TrustedReference, trace_refcounted_objects};
use dom::bindings::trace::{JSTraceable, RootedVec, trace_traceables};
use dom::bindings::utils::{DOM_CALLBACKS, WRAP_CALLBACKS};
+use dom::browsingcontext::BrowsingContext;
use dom::document::{Document, DocumentProgressHandler, DocumentSource, FocusType, IsHTMLDocument};
use dom::element::Element;
use dom::event::{Event, EventBubbles, EventCancelable};
@@ -1792,6 +1793,10 @@ impl ScriptThread {
incomplete.parent_info,
incomplete.window_size);
+ let frame_element = frame_element.r().map(Castable::upcast);
+ let browsing_context = BrowsingContext::new(&window, frame_element);
+ window.init_browsing_context(&browsing_context);
+
let last_modified = metadata.headers.as_ref().and_then(|headers| {
headers.get().map(|&LastModified(HttpDate(ref tm))| dom_last_modified(tm))
});
@@ -1819,16 +1824,14 @@ impl ScriptThread {
};
let document = Document::new(window.r(),
+ Some(&browsing_context),
Some(final_url.clone()),
is_html_document,
content_type,
last_modified,
DocumentSource::FromParser,
loader);
-
- let frame_element = frame_element.r().map(Castable::upcast);
- window.init_browsing_context(document.r(), frame_element);
-
+ browsing_context.init(&document);
document.set_ready_state(DocumentReadyState::Loading);
// Create the root frame