mirror of
https://github.com/servo/servo.git
synced 2025-07-22 23:03:42 +01:00
Auto merge of #9603 - Ms2ger:document-bc, r=jdm
Store a pointer to the browsing context in the Document. <!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.svg" height="40" alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/9603) <!-- Reviewable:end -->
This commit is contained in:
commit
ee158cc65f
10 changed files with 53 additions and 23 deletions
|
@ -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};
|
||||
|
@ -1795,6 +1796,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))
|
||||
});
|
||||
|
@ -1822,16 +1827,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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue