Skip to content

Commit

Permalink
Merge r225082 - WebDriver: crash in Session::computeElementLayout whe…
Browse files Browse the repository at this point in the history
…n 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):
  • Loading branch information
carlosgcampos committed Dec 18, 2017
1 parent 2e9f508 commit ee17892
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
15 changes: 15 additions & 0 deletions Source/WebDriver/ChangeLog
@@ -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
Expand Down
4 changes: 2 additions & 2 deletions Source/WebDriver/Session.cpp
Expand Up @@ -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"));
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit ee17892

Please sign in to comment.