mirror of
https://github.com/servo/servo.git
synced 2025-08-05 05:30:08 +01:00
Auto merge of #10312 - servo:ScriptPort, r=Ms2ger
Report errors from ScriptPort trait methods. <!-- 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/10312) <!-- Reviewable:end -->
This commit is contained in:
commit
6056b16a77
3 changed files with 21 additions and 18 deletions
|
@ -94,10 +94,11 @@ impl ScriptChan for WorkerThreadWorkerChan {
|
|||
}
|
||||
|
||||
impl ScriptPort for Receiver<(TrustedWorkerAddress, WorkerScriptMsg)> {
|
||||
fn recv(&self) -> CommonScriptMsg {
|
||||
match self.recv().unwrap().1 {
|
||||
WorkerScriptMsg::Common(script_msg) => script_msg,
|
||||
WorkerScriptMsg::DOMMessage(_) => panic!("unexpected worker event message!"),
|
||||
fn recv(&self) -> Result<CommonScriptMsg, ()> {
|
||||
match self.recv().map(|(_, msg)| msg) {
|
||||
Ok(WorkerScriptMsg::Common(script_msg)) => Ok(script_msg),
|
||||
Ok(WorkerScriptMsg::DOMMessage(_)) => panic!("unexpected worker event message!"),
|
||||
Err(_) => Err(()),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1337,7 +1337,7 @@ impl XMLHttpRequest {
|
|||
|
||||
if let Some(script_port) = script_port {
|
||||
loop {
|
||||
global.process_event(script_port.recv());
|
||||
global.process_event(script_port.recv().unwrap());
|
||||
let context = context.lock().unwrap();
|
||||
let sync_status = context.sync_status.borrow();
|
||||
if let Some(ref status) = *sync_status {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue