From 48f6e168d44d01ddcd01861a1eedf5487065a9b6 Mon Sep 17 00:00:00 2001 From: Simon Sapin Date: Thu, 19 Jul 2018 16:32:47 +0200 Subject: [PATCH] Fix a webdriver timeout during server start up When sending a webdriver load URL command soon enough after starting Servo, that command could time out with a logged warning: ``` constellation: Webdriver load for closed browsing context (0,2). ``` When `closed` in this case really meant not opened yet. --- components/constellation/constellation.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/components/constellation/constellation.rs b/components/constellation/constellation.rs index c2b14985f3a..e577307cd1b 100644 --- a/components/constellation/constellation.rs +++ b/components/constellation/constellation.rs @@ -931,7 +931,12 @@ impl Constellation FromCompositorMsg::GetFocusTopLevelBrowsingContext(resp_chan) => { let focus_browsing_context = self.focus_pipeline_id .and_then(|pipeline_id| self.pipelines.get(&pipeline_id)) - .map(|pipeline| pipeline.top_level_browsing_context_id); + .map(|pipeline| pipeline.top_level_browsing_context_id) + .filter(|&top_level_browsing_context_id| { + let browsing_context_id = + BrowsingContextId::from(top_level_browsing_context_id); + self.browsing_contexts.contains_key(&browsing_context_id) + }); let _ = resp_chan.send(focus_browsing_context); } FromCompositorMsg::KeyEvent(ch, key, state, modifiers) => {