Removed some sources of panic from script thread and devtools, using Option values instead to indicate when a pipeline context is missing where appropriate. Additionally, removed erroneous method get_browsing_context.

This commit is contained in:
David Raifaizen 2016-07-25 20:34:47 -04:00
parent 4b78b9adab
commit 2475dc1d21
7 changed files with 89 additions and 54 deletions

View file

@ -290,7 +290,7 @@ impl Actor for WalkerActor {
"documentElement" => {
let (tx, rx) = ipc::channel().unwrap();
self.script_chan.send(GetDocumentElement(self.pipeline, tx)).unwrap();
let doc_elem_info = rx.recv().unwrap();
let doc_elem_info = try!(rx.recv().unwrap().ok_or(()));
let node = doc_elem_info.encode(registry, true, self.script_chan.clone(), self.pipeline);
let msg = DocumentElementReply {
@ -316,7 +316,7 @@ impl Actor for WalkerActor {
registry.actor_to_script(target.to_owned()),
tx))
.unwrap();
let children = rx.recv().unwrap();
let children = try!(rx.recv().unwrap().ok_or(()));
let msg = ChildrenReply {
hasFirst: true,
@ -490,7 +490,7 @@ impl Actor for PageStyleActor {
borderTopWidth, borderRightWidth, borderBottomWidth, borderLeftWidth,
paddingTop, paddingRight, paddingBottom, paddingLeft,
width, height,
} = rx.recv().unwrap();
} = try!(rx.recv().unwrap().ok_or(()));
let auto_margins = msg.get("autoMargins")
.and_then(&Value::as_boolean).unwrap_or(false);
@ -564,7 +564,7 @@ impl Actor for InspectorActor {
let (tx, rx) = ipc::channel().unwrap();
self.script_chan.send(GetRootNode(self.pipeline, tx)).unwrap();
let root_info = rx.recv().unwrap();
let root_info = try!(rx.recv().unwrap().ok_or(()));
let node = root_info.encode(registry, false, self.script_chan.clone(), self.pipeline);