aboutsummaryrefslogtreecommitdiffstats
path: root/components/script
diff options
context:
space:
mode:
authorbors-servo <lbergstrom+bors@mozilla.com>2016-04-29 06:33:34 -0700
committerbors-servo <lbergstrom+bors@mozilla.com>2016-04-29 06:33:34 -0700
commit9770e3c1e37a29c4b01ebfc243db2c7be58ec006 (patch)
tree674b1c2ccf97b1913fe05f0d679c91a13e921355 /components/script
parent26be403e3c8351af638cce3a2a1ed4d3be8022df (diff)
parent897be5f6eefeaf0620460215b340e8a5b2c0fc95 (diff)
downloadservo-9770e3c1e37a29c4b01ebfc243db2c7be58ec006.tar.gz
servo-9770e3c1e37a29c4b01ebfc243db2c7be58ec006.zip
Auto merge of #10918 - Ms2ger:clones, r=SimonSapin
Avoid some clones. <!-- Reviewable:start --> This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/10918) <!-- Reviewable:end -->
Diffstat (limited to 'components/script')
-rw-r--r--components/script/document_loader.rs4
-rw-r--r--components/script/dom/bindings/global.rs6
-rw-r--r--components/script/dom/document.rs16
-rw-r--r--components/script/dom/htmlbodyelement.rs2
-rw-r--r--components/script/dom/htmliframeelement.rs8
-rw-r--r--components/script/dom/htmlinputelement.rs2
-rw-r--r--components/script/dom/htmllinkelement.rs4
-rw-r--r--components/script/dom/htmlstyleelement.rs2
-rw-r--r--components/script/dom/htmltextareaelement.rs2
-rw-r--r--components/script/dom/node.rs2
-rw-r--r--components/script/dom/servohtmlparser.rs4
-rw-r--r--components/script/dom/window.rs16
-rw-r--r--components/script/dom/worker.rs6
-rw-r--r--components/script/dom/workerglobalscope.rs12
-rw-r--r--components/script/script_thread.rs42
15 files changed, 56 insertions, 72 deletions
diff --git a/components/script/document_loader.rs b/components/script/document_loader.rs
index 5c835226a22..6032d91b440 100644
--- a/components/script/document_loader.rs
+++ b/components/script/document_loader.rs
@@ -146,8 +146,8 @@ impl DocumentLoader {
}
/// Mark an in-progress network request complete.
- pub fn finish_load(&mut self, load: LoadType) {
- let idx = self.blocking_loads.iter().position(|unfinished| *unfinished == load);
+ pub fn finish_load(&mut self, load: &LoadType) {
+ let idx = self.blocking_loads.iter().position(|unfinished| *unfinished == *load);
self.blocking_loads.remove(idx.expect(&format!("unknown completed load {:?}", load)));
}
diff --git a/components/script/dom/bindings/global.rs b/components/script/dom/bindings/global.rs
index e50f8ace9d0..17a2688a910 100644
--- a/components/script/dom/bindings/global.rs
+++ b/components/script/dom/bindings/global.rs
@@ -74,7 +74,7 @@ impl<'a> GlobalRef<'a> {
}
/// Get a `mem::ProfilerChan` to send messages to the memory profiler thread.
- pub fn mem_profiler_chan(&self) -> mem::ProfilerChan {
+ pub fn mem_profiler_chan(&self) -> &mem::ProfilerChan {
match *self {
GlobalRef::Window(window) => window.mem_profiler_chan(),
GlobalRef::Worker(worker) => worker.mem_profiler_chan(),
@@ -82,7 +82,7 @@ impl<'a> GlobalRef<'a> {
}
/// Get a `ConstellationChan` to send messages to the constellation channel when available.
- pub fn constellation_chan(&self) -> ConstellationChan<ConstellationMsg> {
+ pub fn constellation_chan(&self) -> &ConstellationChan<ConstellationMsg> {
match *self {
GlobalRef::Window(window) => window.constellation_chan(),
GlobalRef::Worker(worker) => worker.constellation_chan(),
@@ -90,7 +90,7 @@ impl<'a> GlobalRef<'a> {
}
/// Get the scheduler channel to request timer events.
- pub fn scheduler_chan(&self) -> IpcSender<TimerEventRequest> {
+ pub fn scheduler_chan(&self) -> &IpcSender<TimerEventRequest> {
match *self {
GlobalRef::Window(window) => window.scheduler_chan(),
GlobalRef::Worker(worker) => worker.scheduler_chan(),
diff --git a/components/script/dom/document.rs b/components/script/dom/document.rs
index 6e7f69636b5..191ea0a92fa 100644
--- a/components/script/dom/document.rs
+++ b/components/script/dom/document.rs
@@ -401,7 +401,7 @@ impl Document {
self.quirks_mode.set(mode);
if mode == Quirks {
- let LayoutChan(ref layout_chan) = self.window.layout_chan();
+ let LayoutChan(ref layout_chan) = *self.window.layout_chan();
layout_chan.send(Msg::SetQuirksMode).unwrap();
}
}
@@ -615,7 +615,7 @@ impl Document {
// Update the focus state for all elements in the focus chain.
// https://html.spec.whatwg.org/multipage/#focus-chain
if focus_type == FocusType::Element {
- let ConstellationChan(ref chan) = self.window.constellation_chan();
+ let ConstellationChan(ref chan) = *self.window.constellation_chan();
let event = ConstellationMsg::Focus(self.window.pipeline());
chan.send(event).unwrap();
}
@@ -1260,7 +1260,7 @@ impl Document {
pub fn trigger_mozbrowser_event(&self, event: MozBrowserEvent) {
if htmliframeelement::mozbrowser_enabled() {
if let Some((containing_pipeline_id, subpage_id)) = self.window.parent_info() {
- let ConstellationChan(ref chan) = self.window.constellation_chan();
+ let ConstellationChan(ref chan) = *self.window.constellation_chan();
let event = ConstellationMsg::MozBrowserEvent(containing_pipeline_id,
subpage_id,
event);
@@ -1277,7 +1277,7 @@ impl Document {
self.animation_frame_list.borrow_mut().insert(ident, callback);
// TODO: Should tick animation only when document is visible
- let ConstellationChan(ref chan) = self.window.constellation_chan();
+ let ConstellationChan(ref chan) = *self.window.constellation_chan();
let event = ConstellationMsg::ChangeRunningAnimationsState(self.window.pipeline(),
AnimationState::AnimationCallbacksPresent);
chan.send(event).unwrap();
@@ -1289,7 +1289,7 @@ impl Document {
pub fn cancel_animation_frame(&self, ident: u32) {
self.animation_frame_list.borrow_mut().remove(&ident);
if self.animation_frame_list.borrow().is_empty() {
- let ConstellationChan(ref chan) = self.window.constellation_chan();
+ let ConstellationChan(ref chan) = *self.window.constellation_chan();
let event = ConstellationMsg::ChangeRunningAnimationsState(self.window.pipeline(),
AnimationState::NoAnimationCallbacksPresent);
chan.send(event).unwrap();
@@ -1313,7 +1313,7 @@ impl Document {
// the next frame (which is the common case), we won't send a NoAnimationCallbacksPresent
// message quickly followed by an AnimationCallbacksPresent message.
if self.animation_frame_list.borrow().is_empty() {
- let ConstellationChan(ref chan) = self.window.constellation_chan();
+ let ConstellationChan(ref chan) = *self.window.constellation_chan();
let event = ConstellationMsg::ChangeRunningAnimationsState(self.window.pipeline(),
AnimationState::NoAnimationCallbacksPresent);
chan.send(event).unwrap();
@@ -1344,7 +1344,7 @@ impl Document {
// The parser might need the loader, so restrict the lifetime of the borrow.
{
let mut loader = self.loader.borrow_mut();
- loader.finish_load(load.clone());
+ loader.finish_load(&load);
}
if let LoadType::Script(_) = load {
@@ -1473,7 +1473,7 @@ impl Document {
pub fn notify_constellation_load(&self) {
let pipeline_id = self.window.pipeline();
- let ConstellationChan(ref chan) = self.window.constellation_chan();
+ let ConstellationChan(ref chan) = *self.window.constellation_chan();
let event = ConstellationMsg::DOMLoad(pipeline_id);
chan.send(event).unwrap();
diff --git a/components/script/dom/htmlbodyelement.rs b/components/script/dom/htmlbodyelement.rs
index ca133b88dbb..1c65a1f609f 100644
--- a/components/script/dom/htmlbodyelement.rs
+++ b/components/script/dom/htmlbodyelement.rs
@@ -154,7 +154,7 @@ impl VirtualMethods for HTMLBodyElement {
let window = window_from_node(self);
let document = window.Document();
document.set_reflow_timeout(time::precise_time_ns() + INITIAL_REFLOW_DELAY);
- let ConstellationChan(ref chan) = window.constellation_chan();
+ let ConstellationChan(ref chan) = *window.constellation_chan();
let event = ConstellationMsg::HeadParsed;
chan.send(event).unwrap();
}
diff --git a/components/script/dom/htmliframeelement.rs b/components/script/dom/htmliframeelement.rs
index ad172fabb99..0ccf72ef66a 100644
--- a/components/script/dom/htmliframeelement.rs
+++ b/components/script/dom/htmliframeelement.rs
@@ -124,7 +124,7 @@ impl HTMLIFrameElement {
let new_pipeline_id = self.pipeline_id.get().unwrap();
let private_iframe = self.privatebrowsing();
- let ConstellationChan(ref chan) = window.constellation_chan();
+ let ConstellationChan(ref chan) = *window.constellation_chan();
let load_info = IFrameLoadInfo {
url: url,
containing_pipeline_id: window.pipeline(),
@@ -144,7 +144,7 @@ impl HTMLIFrameElement {
pub fn process_the_iframe_attributes(&self) {
let url = match self.get_url() {
- Some(url) => url.clone(),
+ Some(url) => url,
None => Url::parse("about:blank").unwrap(),
};
@@ -371,7 +371,7 @@ pub fn Navigate(iframe: &HTMLIFrameElement, direction: NavigationDirection) -> E
let pipeline_info = Some((window.pipeline(),
iframe.subpage_id().unwrap()));
- let ConstellationChan(ref chan) = window.constellation_chan();
+ let ConstellationChan(ref chan) = *window.constellation_chan();
let msg = ConstellationMsg::Navigate(pipeline_info, direction);
chan.send(msg).unwrap();
}
@@ -575,7 +575,7 @@ impl VirtualMethods for HTMLIFrameElement {
//
// Since most of this cleanup doesn't happen on same-origin
// iframes, and since that would cause a deadlock, don't do it.
- let ConstellationChan(ref chan) = window.constellation_chan();
+ let ConstellationChan(ref chan) = *window.constellation_chan();
let same_origin = if let Some(self_url) = self.get_url() {
let win_url = window_from_node(self).get_url();
UrlHelper::SameOrigin(&self_url, &win_url)
diff --git a/components/script/dom/htmlinputelement.rs b/components/script/dom/htmlinputelement.rs
index 74845a1afb9..45282f49911 100644
--- a/components/script/dom/htmlinputelement.rs
+++ b/components/script/dom/htmlinputelement.rs
@@ -122,7 +122,7 @@ static DEFAULT_MAX_LENGTH: i32 = -1;
impl HTMLInputElement {
fn new_inherited(localName: Atom, prefix: Option<DOMString>, document: &Document) -> HTMLInputElement {
- let chan = document.window().constellation_chan();
+ let chan = document.window().constellation_chan().clone();
HTMLInputElement {
htmlelement:
HTMLElement::new_inherited_with_state(IN_ENABLED_STATE,
diff --git a/components/script/dom/htmllinkelement.rs b/components/script/dom/htmllinkelement.rs
index e2b2dc0edb0..023d8a36f58 100644
--- a/components/script/dom/htmllinkelement.rs
+++ b/components/script/dom/htmllinkelement.rs
@@ -242,7 +242,7 @@ impl HTMLLinkElement {
let document = document_from_node(self);
match document.base_url().join(href) {
Ok(url) => {
- let ConstellationChan(ref chan) = document.window().constellation_chan();
+ let ConstellationChan(ref chan) = *document.window().constellation_chan();
let event = ConstellationMsg::NewFavicon(url.clone());
chan.send(event).unwrap();
@@ -318,7 +318,7 @@ impl AsyncResponseListener for StylesheetContext {
let document = document.r();
let win = window_from_node(elem);
- let LayoutChan(ref layout_chan) = win.r().layout_chan();
+ let LayoutChan(ref layout_chan) = *win.layout_chan();
layout_chan.send(Msg::AddStylesheet(sheet.clone())).unwrap();
*elem.stylesheet.borrow_mut() = Some(sheet);
diff --git a/components/script/dom/htmlstyleelement.rs b/components/script/dom/htmlstyleelement.rs
index 067561d4181..e91b1a1e064 100644
--- a/components/script/dom/htmlstyleelement.rs
+++ b/components/script/dom/htmlstyleelement.rs
@@ -66,7 +66,7 @@ impl HTMLStyleElement {
sheet.set_media(Some(media));
let sheet = Arc::new(sheet);
- let LayoutChan(ref layout_chan) = win.layout_chan();
+ let LayoutChan(ref layout_chan) = *win.layout_chan();
layout_chan.send(Msg::AddStylesheet(sheet.clone())).unwrap();
*self.stylesheet.borrow_mut() = Some(sheet);
let doc = document_from_node(self);
diff --git a/components/script/dom/htmltextareaelement.rs b/components/script/dom/htmltextareaelement.rs
index 0f764f12e7d..5ae40aec7da 100644
--- a/components/script/dom/htmltextareaelement.rs
+++ b/components/script/dom/htmltextareaelement.rs
@@ -100,7 +100,7 @@ impl HTMLTextAreaElement {
fn new_inherited(localName: Atom,
prefix: Option<DOMString>,
document: &Document) -> HTMLTextAreaElement {
- let chan = document.window().constellation_chan();
+ let chan = document.window().constellation_chan().clone();
HTMLTextAreaElement {
htmlelement:
HTMLElement::new_inherited_with_state(IN_ENABLED_STATE,
diff --git a/components/script/dom/node.rs b/components/script/dom/node.rs
index 0f2209c00ea..f9111d7f7f1 100644
--- a/components/script/dom/node.rs
+++ b/components/script/dom/node.rs
@@ -195,7 +195,7 @@ impl OpaqueStyleAndLayoutData {
pub fn dispose(self, node: &Node) {
debug_assert!(thread_state::get().is_script());
let win = window_from_node(node);
- let LayoutChan(chan) = win.layout_chan();
+ let LayoutChan(ref chan) = *win.layout_chan();
node.style_and_layout_data.set(None);
chan.send(Msg::ReapStyleAndLayoutData(self)).unwrap();
}
diff --git a/components/script/dom/servohtmlparser.rs b/components/script/dom/servohtmlparser.rs
index 4436d286aff..993d3f0c28d 100644
--- a/components/script/dom/servohtmlparser.rs
+++ b/components/script/dom/servohtmlparser.rs
@@ -93,8 +93,8 @@ impl AsyncResponseListener for ParserContext {
Err(_) => None,
};
let content_type = metadata.clone().and_then(|meta| meta.content_type);
- let parser = match ScriptThread::page_fetch_complete(self.id.clone(),
- self.subpage.clone(),
+ let parser = match ScriptThread::page_fetch_complete(&self.id,
+ self.subpage.as_ref(),
metadata) {
Some(parser) => parser,
None => return,
diff --git a/components/script/dom/window.rs b/components/script/dom/window.rs
index 05115de0c58..94b6d2c7fb3 100644
--- a/components/script/dom/window.rs
+++ b/components/script/dom/window.rs
@@ -1234,24 +1234,24 @@ impl Window {
(*self.resource_thread).clone()
}
- pub fn mem_profiler_chan(&self) -> mem::ProfilerChan {
- self.mem_profiler_chan.clone()
+ pub fn mem_profiler_chan(&self) -> &mem::ProfilerChan {
+ &self.mem_profiler_chan
}
pub fn devtools_chan(&self) -> Option<IpcSender<ScriptToDevtoolsControlMsg>> {
self.devtools_chan.clone()
}
- pub fn layout_chan(&self) -> LayoutChan {
- self.layout_chan.clone()
+ pub fn layout_chan(&self) -> &LayoutChan {
+ &self.layout_chan
}
- pub fn constellation_chan(&self) -> ConstellationChan<ConstellationMsg> {
- self.constellation_chan.clone()
+ pub fn constellation_chan(&self) -> &ConstellationChan<ConstellationMsg> {
+ &self.constellation_chan
}
- pub fn scheduler_chan(&self) -> IpcSender<TimerEventRequest> {
- self.scheduler_chan.clone()
+ pub fn scheduler_chan(&self) -> &IpcSender<TimerEventRequest> {
+ &self.scheduler_chan
}
pub fn schedule_callback(&self, callback: OneshotTimerCallback, duration: MsDuration) -> OneshotTimerHandle {
diff --git a/components/script/dom/worker.rs b/components/script/dom/worker.rs
index 0e31181a222..2590cfba5e7 100644
--- a/components/script/dom/worker.rs
+++ b/components/script/dom/worker.rs
@@ -75,8 +75,8 @@ impl Worker {
};
let resource_thread = global.resource_thread();
- let constellation_chan = global.constellation_chan();
- let scheduler_chan = global.scheduler_chan();
+ let constellation_chan = global.constellation_chan().clone();
+ let scheduler_chan = global.scheduler_chan().clone();
let (sender, receiver) = channel();
let closing = Arc::new(AtomicBool::new(false));
@@ -103,7 +103,7 @@ impl Worker {
let init = WorkerGlobalScopeInit {
resource_thread: resource_thread,
- mem_profiler_chan: global.mem_profiler_chan(),
+ mem_profiler_chan: global.mem_profiler_chan().clone(),
to_devtools_sender: global.devtools_chan(),
from_devtools_sender: optional_sender,
constellation_chan: constellation_chan,
diff --git a/components/script/dom/workerglobalscope.rs b/components/script/dom/workerglobalscope.rs
index dc097cd602c..fbfd6a1a8bc 100644
--- a/components/script/dom/workerglobalscope.rs
+++ b/components/script/dom/workerglobalscope.rs
@@ -126,8 +126,8 @@ impl WorkerGlobalScope {
}
}
- pub fn mem_profiler_chan(&self) -> mem::ProfilerChan {
- self.mem_profiler_chan.clone()
+ pub fn mem_profiler_chan(&self) -> &mem::ProfilerChan {
+ &self.mem_profiler_chan
}
pub fn devtools_chan(&self) -> Option<IpcSender<ScriptToDevtoolsControlMsg>> {
@@ -142,12 +142,12 @@ impl WorkerGlobalScope {
&self.from_devtools_receiver
}
- pub fn constellation_chan(&self) -> ConstellationChan<ConstellationMsg> {
- self.constellation_chan.clone()
+ pub fn constellation_chan(&self) -> &ConstellationChan<ConstellationMsg> {
+ &self.constellation_chan
}
- pub fn scheduler_chan(&self) -> IpcSender<TimerEventRequest> {
- self.scheduler_chan.clone()
+ pub fn scheduler_chan(&self) -> &IpcSender<TimerEventRequest> {
+ &self.scheduler_chan
}
pub fn schedule_callback(&self, callback: OneshotTimerCallback, duration: MsDuration) -> OneshotTimerHandle {
diff --git a/components/script/script_thread.rs b/components/script/script_thread.rs
index c0753f897a7..107902b88ee 100644
--- a/components/script/script_thread.rs
+++ b/components/script/script_thread.rs
@@ -275,14 +275,6 @@ impl ScriptChan for SendableMainThreadScriptChan {
}
}
-impl SendableMainThreadScriptChan {
- /// Creates a new script chan.
- pub fn new() -> (Receiver<CommonScriptMsg>, Box<SendableMainThreadScriptChan>) {
- let (chan, port) = channel();
- (port, box SendableMainThreadScriptChan(chan))
- }
-}
-
/// Encapsulates internal communication of main thread messages within the script thread.
#[derive(JSTraceable)]
pub struct MainThreadScriptChan(pub Sender<MainThreadScriptMsg>);
@@ -297,11 +289,9 @@ impl ScriptChan for MainThreadScriptChan {
}
}
-impl MainThreadScriptChan {
- /// Creates a new script chan.
- pub fn new() -> (Receiver<MainThreadScriptMsg>, Box<MainThreadScriptChan>) {
- let (chan, port) = channel();
- (port, box MainThreadScriptChan(chan))
+impl OpaqueSender<CommonScriptMsg> for Sender<MainThreadScriptMsg> {
+ fn send(&self, msg: CommonScriptMsg) {
+ self.send(MainThreadScriptMsg::Common(msg)).unwrap()
}
}
@@ -453,15 +443,13 @@ impl ScriptThreadFactory for ScriptThread {
PipelineNamespace::install(state.pipeline_namespace_id);
let roots = RootCollection::new();
let _stack_roots_tls = StackRootTLS::new(&roots);
- let chan = MainThreadScriptChan(script_chan.clone());
- let channel_for_reporter = chan.clone();
let id = state.id;
let parent_info = state.parent_info;
let mem_profiler_chan = state.mem_profiler_chan.clone();
let window_size = state.window_size;
let script_thread = ScriptThread::new(state,
script_port,
- script_chan);
+ script_chan.clone());
SCRIPT_THREAD_ROOT.with(|root| {
*root.borrow_mut() = Some(&script_thread as *const _);
@@ -478,7 +466,7 @@ impl ScriptThreadFactory for ScriptThread {
script_thread.start();
let _ = script_thread.compositor.borrow_mut().send(ScriptToCompositorMsg::Exited);
let _ = script_thread.content_process_shutdown_chan.send(());
- }, reporter_name, channel_for_reporter, CommonScriptMsg::CollectReports);
+ }, reporter_name, script_chan, CommonScriptMsg::CollectReports);
// This must always be the very last operation performed before the thread completes
failsafe.neuter();
@@ -493,7 +481,7 @@ pub unsafe extern "C" fn shadow_check_callback(_cx: *mut JSContext,
}
impl ScriptThread {
- pub fn page_fetch_complete(id: PipelineId, subpage: Option<SubpageId>, metadata: Option<Metadata>)
+ pub fn page_fetch_complete(id: &PipelineId, subpage: Option<&SubpageId>, metadata: Option<Metadata>)
-> Option<ParserRoot> {
SCRIPT_THREAD_ROOT.with(|root| {
let script_thread = unsafe { &*root.borrow().unwrap() };
@@ -1122,8 +1110,7 @@ impl ScriptThread {
doc.mut_loader().inhibit_events();
// https://html.spec.whatwg.org/multipage/#the-end step 7
- let addr: Trusted<Document> = Trusted::new(doc);
- let handler = box DocumentProgressHandler::new(addr.clone());
+ let handler = box DocumentProgressHandler::new(Trusted::new(doc));
self.dom_manipulation_task_source.queue(DOMManipulationTask::DocumentProgress(handler)).unwrap();
let ConstellationChan(ref chan) = self.constellation_chan;
@@ -1285,10 +1272,10 @@ impl ScriptThread {
/// We have received notification that the response associated with a load has completed.
/// Kick off the document and frame tree creation process using the result.
- fn handle_page_fetch_complete(&self, id: PipelineId, subpage: Option<SubpageId>,
+ fn handle_page_fetch_complete(&self, id: &PipelineId, subpage: Option<&SubpageId>,
metadata: Option<Metadata>) -> Option<ParserRoot> {
let idx = self.incomplete_loads.borrow().iter().position(|load| {
- load.pipeline_id == id && load.parent_info.map(|info| info.1) == subpage
+ load.pipeline_id == *id && load.parent_info.as_ref().map(|info| &info.1) == subpage
});
// The matching in progress load structure may not exist if
// the pipeline exited before the page load completed.
@@ -1298,7 +1285,7 @@ impl ScriptThread {
metadata.map(|meta| self.load(meta, load))
}
None => {
- assert!(self.closed_pipelines.borrow().contains(&id));
+ assert!(self.closed_pipelines.borrow().contains(id));
None
}
}
@@ -1868,14 +1855,11 @@ impl ScriptThread {
let id = incomplete.pipeline_id.clone();
let subpage = incomplete.parent_info.clone().map(|p| p.1);
- let script_chan = self.chan.clone();
- let resource_thread = self.resource_thread.clone();
-
let context = Arc::new(Mutex::new(ParserContext::new(id, subpage, load_data.url.clone())));
let (action_sender, action_receiver) = ipc::channel().unwrap();
let listener = NetworkListener {
context: context,
- script_chan: script_chan.clone(),
+ script_chan: self.chan.clone(),
};
ROUTER.add_route(action_receiver.to_opaque(), box move |message| {
listener.notify(message.to().unwrap());
@@ -1888,7 +1872,7 @@ impl ScriptThread {
load_data.url = Url::parse("about:blank").unwrap();
}
- resource_thread.send(ControlMsg::Load(NetLoadData {
+ self.resource_thread.send(ControlMsg::Load(NetLoadData {
context: LoadContext::Browsing,
url: load_data.url,
method: load_data.method,
@@ -1982,7 +1966,7 @@ fn shut_down_layout(page_tree: &Rc<Page>) {
// processed this message.
let (response_chan, response_port) = channel();
let window = page.window();
- let LayoutChan(chan) = window.layout_chan();
+ let LayoutChan(chan) = window.layout_chan().clone();
if chan.send(layout_interface::Msg::PrepareToExit(response_chan)).is_ok() {
channels.push(chan);
response_port.recv().unwrap();