Skip to content
Permalink
Browse files
WebDriver: crash in Session::computeElementLayout when called without…
… a current browsing context

https://bugs.webkit.org/show_bug.cgi?id=179917

Reviewed by Darin Adler.

In the case of computeElementLayout message, the frameHandle parameter is not optional, but we still need to
provide a valid value (empty string means the default frame) when m_currentBrowsingContext is std::nullopt. The
same applies to selectOptionElement.

* Session.cpp:
(WebDriver::Session::computeElementLayout):
(WebDriver::Session::selectOptionElement):

Canonical link: https://commits.webkit.org/195950@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@225082 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
carlosgcampos committed Nov 21, 2017
1 parent 022e4b5 commit b16d5f6af4810fdf004953652b04001b31188e78
Showing with 17 additions and 2 deletions.
  1. +15 −0 Source/WebDriver/ChangeLog
  2. +2 −2 Source/WebDriver/Session.cpp
@@ -1,3 +1,18 @@
2017-11-21 Carlos Garcia Campos <cgarcia@igalia.com>

WebDriver: crash in Session::computeElementLayout when called without a current browsing context
https://bugs.webkit.org/show_bug.cgi?id=179917

Reviewed by Darin Adler.

In the case of computeElementLayout message, the frameHandle parameter is not optional, but we still need to
provide a valid value (empty string means the default frame) when m_currentBrowsingContext is std::nullopt. The
same applies to selectOptionElement.

* Session.cpp:
(WebDriver::Session::computeElementLayout):
(WebDriver::Session::selectOptionElement):

2017-11-15 Carlos Garcia Campos <cgarcia@igalia.com>

[WPE] Add initial support for WebDriver
@@ -822,7 +822,7 @@ void Session::computeElementLayout(const String& elementID, OptionSet<ElementLay

RefPtr<InspectorObject> parameters = InspectorObject::create();
parameters->setString(ASCIILiteral("browsingContextHandle"), m_toplevelBrowsingContext.value());
parameters->setString(ASCIILiteral("frameHandle"), m_currentBrowsingContext.value());
parameters->setString(ASCIILiteral("frameHandle"), m_currentBrowsingContext.value_or(emptyString()));
parameters->setString(ASCIILiteral("nodeHandle"), elementID);
parameters->setBoolean(ASCIILiteral("scrollIntoViewIfNeeded"), options.contains(ElementLayoutOption::ScrollIntoViewIfNeeded));
parameters->setString(ASCIILiteral("coordinateSystem"), options.contains(ElementLayoutOption::UseViewportCoordinates) ? ASCIILiteral("LayoutViewport") : ASCIILiteral("Page"));
@@ -1280,7 +1280,7 @@ void Session::selectOptionElement(const String& elementID, Function<void (Comman
{
RefPtr<InspectorObject> parameters = InspectorObject::create();
parameters->setString(ASCIILiteral("browsingContextHandle"), m_toplevelBrowsingContext.value());
parameters->setString(ASCIILiteral("frameHandle"), m_currentBrowsingContext.value());
parameters->setString(ASCIILiteral("frameHandle"), m_currentBrowsingContext.value_or(emptyString()));
parameters->setString(ASCIILiteral("nodeHandle"), elementID);
m_host->sendCommandToBackend(ASCIILiteral("selectOptionElement"), WTFMove(parameters), [this, protectedThis = makeRef(*this), completionHandler = WTFMove(completionHandler)](SessionHost::CommandResponse&& response) {
if (response.isError) {

0 comments on commit b16d5f6

Please sign in to comment.