diff --git a/Source/WebDriver/ChangeLog b/Source/WebDriver/ChangeLog index 99fbcdf709d1..43a734f9a643 100644 --- a/Source/WebDriver/ChangeLog +++ b/Source/WebDriver/ChangeLog @@ -1,3 +1,18 @@ +2017-11-21 Carlos Garcia Campos + + 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 [WPE] Add initial support for WebDriver diff --git a/Source/WebDriver/Session.cpp b/Source/WebDriver/Session.cpp index 4413f7f0f1d0..8378858844e3 100644 --- a/Source/WebDriver/Session.cpp +++ b/Source/WebDriver/Session.cpp @@ -822,7 +822,7 @@ void Session::computeElementLayout(const String& elementID, OptionSet 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 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) {