diff options
author | Ms2ger <ms2ger@gmail.com> | 2014-10-02 15:30:22 +0200 |
---|---|---|
committer | Ms2ger <ms2ger@gmail.com> | 2014-10-02 15:31:26 +0200 |
commit | 7508ca94b353835976cab686d3667cf80066a3fc (patch) | |
tree | b837581bea19662f0a8488a8147e984667776946 /components/script/page.rs | |
parent | 5d335fd52460d3ce2776f0df186ebf21eb35abd5 (diff) | |
download | servo-7508ca94b353835976cab686d3667cf80066a3fc.tar.gz servo-7508ca94b353835976cab686d3667cf80066a3fc.zip |
Remove the fragment_node field from Page (fixes #3543).
Since Page isn't reflected, it cannot be rooted, and pointers to JS-managed
objects inside it are not guaranteed to be traced. This may cause the pointer
to become dangling.
Diffstat (limited to 'components/script/page.rs')
-rw-r--r-- | components/script/page.rs | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/components/script/page.rs b/components/script/page.rs index f3d54a421ae..f2e46c165ab 100644 --- a/components/script/page.rs +++ b/components/script/page.rs @@ -4,8 +4,7 @@ use dom::bindings::codegen::Bindings::DocumentBinding::DocumentMethods; use dom::bindings::codegen::InheritTypes::NodeCast; -use dom::bindings::js::{MutNullableJS, JS, JSRef, Temporary}; -use dom::bindings::js::OptionalRootable; +use dom::bindings::js::{JS, JSRef, Temporary, OptionalRootable}; use dom::bindings::trace::{Traceable, Untraceable}; use dom::bindings::utils::GlobalStaticData; use dom::document::{Document, DocumentHelpers}; @@ -29,14 +28,12 @@ use servo_net::resource_task::ResourceTask; use servo_util::str::DOMString; use std::cell::{Cell, RefCell, Ref, RefMut}; use std::comm::{channel, Receiver, Empty, Disconnected}; -use std::default::Default; use std::mem::replace; use std::rc::Rc; use url::Url; /// Encapsulates a handle to a frame and its associated layout information. #[jstraceable] -#[allow(unrooted_must_root)] // FIXME(#3543) should be must_root. pub struct Page { /// Pipeline id associated with this page. pub id: PipelineId, @@ -79,7 +76,7 @@ pub struct Page { pub resize_event: Untraceable<Cell<Option<WindowSizeData>>>, /// Pending scroll to fragment event, if any - pub fragment_node: MutNullableJS<Element>, + pub fragment_name: RefCell<Option<String>>, /// Associated resource task for use by DOM objects like XMLHttpRequest pub resource_task: Untraceable<ResourceTask>, @@ -153,7 +150,7 @@ impl Page { url: Untraceable::new(RefCell::new(None)), next_subpage_id: Traceable::new(Cell::new(SubpageId(0))), resize_event: Untraceable::new(Cell::new(None)), - fragment_node: Default::default(), + fragment_name: RefCell::new(None), last_reflow_id: Traceable::new(Cell::new(0)), resource_task: Untraceable::new(resource_task), constellation_chan: Untraceable::new(constellation_chan), |