Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow multiple sequential webdriver sessions #11306

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

@@ -70,6 +70,7 @@ pub fn start_server(port: u16, constellation_chan: Sender<ConstellationMsg>) {
});
}

#[derive(Clone, PartialEq)]
struct WebDriverSession {
id: Uuid,
frame_id: Option<FrameId>
@@ -253,7 +254,7 @@ impl Handler {
fn session(&self) -> WebDriverResult<&WebDriverSession> {
match self.session {
Some(ref x) => Ok(x),
None => Err(WebDriverError::new(ErrorStatus::SessionNotCreated,
None => Err(WebDriverError::new(ErrorStatus::InvalidSessionId,
"Session not created"))
}
}
@@ -264,7 +265,7 @@ impl Handler {
x.frame_id = frame_id;
Ok(())
},
None => Err(WebDriverError::new(ErrorStatus::SessionNotCreated,
None => Err(WebDriverError::new(ErrorStatus::InvalidSessionId,
"Session not created"))
}
}
@@ -282,17 +283,19 @@ impl Handler {
NewSessionResponse::new(
session.id.to_string(),
Json::Object(capabilities))));
try!(self.handle_get(&GetParameters { url: String::from("about:blank") }));
self.session = Some(session);
rv
} else {
Err(WebDriverError::new(ErrorStatus::UnknownError,
Err(WebDriverError::new(ErrorStatus::SessionNotCreated,
"Session already created"))
}
}

fn handle_delete_session(&mut self) -> WebDriverResult<WebDriverResponse> {
try!(self.handle_get(&GetParameters { url: String::from("about:blank") }));
self.session = None;
Ok(WebDriverResponse::Void)
Ok(WebDriverResponse::DeleteSession)
}

#[inline]
@@ -757,6 +760,7 @@ impl WebDriverHandler<ServoExtensionRoute> for Handler {
match msg.command {
WebDriverCommand::NewSession => {},
_ => {
// TODO: check that the session id is the same as the current session
try!(self.session());
}
}
@@ -806,8 +810,6 @@ impl WebDriverHandler<ServoExtensionRoute> for Handler {
}

fn delete_session(&mut self, _session: &Option<Session>) {
// Servo doesn't support multiple sessions, so we exit on session deletion
let _ = self.constellation_chan.send(ConstellationMsg::Exit);
self.session = None;
// We don't do any post-processing after a session is deleted
}
}
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.