Changeset 219833 in webkit
- Timestamp:
- Jul 24, 2017 12:16:55 PM (7 years ago)
- Location:
- trunk/Source/WebDriver
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebDriver/ChangeLog
r219794 r219833 1 2017-07-24 Carlos Garcia Campos <cgarcia@igalia.com> 2 3 WebDriver: rename m_browsingContext as m_currentBrowsingContext in Session 4 https://bugs.webkit.org/show_bug.cgi?id=174783 5 6 Reviewed by Brian Burg. 7 8 We have m_toplevelBrowsingContext and m_browsingContext, which is confusing. m_browsingContext is actually the 9 current browsing context, and the spec also refers to it as the current browsing context, so better use 10 m_currentBrowsingContext. 11 12 * Session.cpp: 13 (WebDriver::Session::switchToTopLevelBrowsingContext): 14 (WebDriver::Session::switchToBrowsingContext): 15 (WebDriver::Session::switchToFrame): 16 (WebDriver::Session::switchToParentFrame): 17 (WebDriver::Session::computeElementLayout): 18 (WebDriver::Session::findElements): 19 (WebDriver::Session::isElementSelected): 20 (WebDriver::Session::getElementText): 21 (WebDriver::Session::getElementTagName): 22 (WebDriver::Session::isElementEnabled): 23 (WebDriver::Session::isElementDisplayed): 24 (WebDriver::Session::getElementAttribute): 25 (WebDriver::Session::waitForNavigationToComplete): 26 (WebDriver::Session::elementClear): 27 (WebDriver::Session::elementSendKeys): 28 (WebDriver::Session::elementSubmit): 29 (WebDriver::Session::executeScript): 30 * Session.h: 31 1 32 2017-07-20 Carlos Garcia Campos <cgarcia@igalia.com> 2 33 -
trunk/Source/WebDriver/Session.cpp
r219794 r219833 91 91 { 92 92 m_toplevelBrowsingContext = toplevelBrowsingContext; 93 m_ browsingContext = std::nullopt;93 m_currentBrowsingContext = std::nullopt; 94 94 } 95 95 … … 98 98 // Automation sends empty strings for main frame. 99 99 if (!browsingContext || browsingContext.value().isEmpty()) 100 m_ browsingContext = std::nullopt;100 m_currentBrowsingContext = std::nullopt; 101 101 else 102 m_ browsingContext = browsingContext;102 m_currentBrowsingContext = browsingContext; 103 103 } 104 104 … … 371 371 RefPtr<InspectorObject> parameters = InspectorObject::create(); 372 372 parameters->setString(ASCIILiteral("browsingContextHandle"), m_toplevelBrowsingContext.value()); 373 if (m_ browsingContext)374 parameters->setString(ASCIILiteral("frameHandle"), m_ browsingContext.value());373 if (m_currentBrowsingContext) 374 parameters->setString(ASCIILiteral("frameHandle"), m_currentBrowsingContext.value()); 375 375 376 376 int frameIndex; … … 417 417 } 418 418 419 if (!m_ browsingContext) {420 completionHandler(CommandResult::success()); 421 return; 422 } 423 424 RefPtr<InspectorObject> parameters = InspectorObject::create(); 425 parameters->setString(ASCIILiteral("browsingContextHandle"), m_toplevelBrowsingContext.value()); 426 parameters->setString(ASCIILiteral("frameHandle"), m_ browsingContext.value());419 if (!m_currentBrowsingContext) { 420 completionHandler(CommandResult::success()); 421 return; 422 } 423 424 RefPtr<InspectorObject> parameters = InspectorObject::create(); 425 parameters->setString(ASCIILiteral("browsingContextHandle"), m_toplevelBrowsingContext.value()); 426 parameters->setString(ASCIILiteral("frameHandle"), m_currentBrowsingContext.value()); 427 427 m_host->sendCommandToBackend(ASCIILiteral("resolveParentFrameHandle"), WTFMove(parameters), [this, protectedThis = makeRef(*this), completionHandler = WTFMove(completionHandler)](SessionHost::CommandResponse&& response) { 428 428 if (response.isError || !response.responseObject) { … … 587 587 RefPtr<InspectorObject> parameters = InspectorObject::create(); 588 588 parameters->setString(ASCIILiteral("browsingContextHandle"), m_toplevelBrowsingContext.value()); 589 parameters->setString(ASCIILiteral("frameHandle"), m_ browsingContext.value());589 parameters->setString(ASCIILiteral("frameHandle"), m_currentBrowsingContext.value()); 590 590 parameters->setString(ASCIILiteral("nodeHandle"), elementID); 591 591 parameters->setBoolean(ASCIILiteral("scrollIntoViewIfNeeded"), options.contains(ElementLayoutOption::ScrollIntoViewIfNeeded)); … … 654 654 RefPtr<InspectorObject> parameters = InspectorObject::create(); 655 655 parameters->setString(ASCIILiteral("browsingContextHandle"), m_toplevelBrowsingContext.value()); 656 if (m_ browsingContext)657 parameters->setString(ASCIILiteral("frameHandle"), m_ browsingContext.value());656 if (m_currentBrowsingContext) 657 parameters->setString(ASCIILiteral("frameHandle"), m_currentBrowsingContext.value()); 658 658 parameters->setString(ASCIILiteral("function"), FindNodesJavaScript); 659 659 parameters->setArray(ASCIILiteral("arguments"), WTFMove(arguments)); … … 721 721 RefPtr<InspectorObject> parameters = InspectorObject::create(); 722 722 parameters->setString(ASCIILiteral("browsingContextHandle"), m_toplevelBrowsingContext.value()); 723 if (m_ browsingContext)724 parameters->setString(ASCIILiteral("frameHandle"), m_ browsingContext.value());723 if (m_currentBrowsingContext) 724 parameters->setString(ASCIILiteral("frameHandle"), m_currentBrowsingContext.value()); 725 725 parameters->setString(ASCIILiteral("function"), ElementAttributeJavaScript); 726 726 parameters->setArray(ASCIILiteral("arguments"), WTFMove(arguments)); … … 765 765 RefPtr<InspectorObject> parameters = InspectorObject::create(); 766 766 parameters->setString(ASCIILiteral("browsingContextHandle"), m_toplevelBrowsingContext.value()); 767 if (m_ browsingContext)768 parameters->setString(ASCIILiteral("frameHandle"), m_ browsingContext.value());767 if (m_currentBrowsingContext) 768 parameters->setString(ASCIILiteral("frameHandle"), m_currentBrowsingContext.value()); 769 769 // FIXME: Add an atom to properly implement this instead of just using innerText. 770 770 parameters->setString(ASCIILiteral("function"), ASCIILiteral("function(element) { return element.innerText.replace(/^[^\\S\\xa0]+|[^\\S\\xa0]+$/g, '') }")); … … 801 801 RefPtr<InspectorObject> parameters = InspectorObject::create(); 802 802 parameters->setString(ASCIILiteral("browsingContextHandle"), m_toplevelBrowsingContext.value()); 803 if (m_ browsingContext)804 parameters->setString(ASCIILiteral("frameHandle"), m_ browsingContext.value());803 if (m_currentBrowsingContext) 804 parameters->setString(ASCIILiteral("frameHandle"), m_currentBrowsingContext.value()); 805 805 parameters->setString(ASCIILiteral("function"), ASCIILiteral("function(element) { return element.tagName.toLowerCase() }")); 806 806 parameters->setArray(ASCIILiteral("arguments"), WTFMove(arguments)); … … 857 857 RefPtr<InspectorObject> parameters = InspectorObject::create(); 858 858 parameters->setString(ASCIILiteral("browsingContextHandle"), m_toplevelBrowsingContext.value()); 859 if (m_ browsingContext)860 parameters->setString(ASCIILiteral("frameHandle"), m_ browsingContext.value());859 if (m_currentBrowsingContext) 860 parameters->setString(ASCIILiteral("frameHandle"), m_currentBrowsingContext.value()); 861 861 parameters->setString(ASCIILiteral("function"), ASCIILiteral("function(element) { return element.disabled === undefined ? true : !element.disabled }")); 862 862 parameters->setArray(ASCIILiteral("arguments"), WTFMove(arguments)); … … 892 892 RefPtr<InspectorObject> parameters = InspectorObject::create(); 893 893 parameters->setString(ASCIILiteral("browsingContextHandle"), m_toplevelBrowsingContext.value()); 894 if (m_ browsingContext)895 parameters->setString(ASCIILiteral("frameHandle"), m_ browsingContext.value());894 if (m_currentBrowsingContext) 895 parameters->setString(ASCIILiteral("frameHandle"), m_currentBrowsingContext.value()); 896 896 parameters->setString(ASCIILiteral("function"), ElementDisplayedJavaScript); 897 897 parameters->setArray(ASCIILiteral("arguments"), WTFMove(arguments)); … … 928 928 RefPtr<InspectorObject> parameters = InspectorObject::create(); 929 929 parameters->setString(ASCIILiteral("browsingContextHandle"), m_toplevelBrowsingContext.value()); 930 if (m_ browsingContext)931 parameters->setString(ASCIILiteral("frameHandle"), m_ browsingContext.value());930 if (m_currentBrowsingContext) 931 parameters->setString(ASCIILiteral("frameHandle"), m_currentBrowsingContext.value()); 932 932 parameters->setString(ASCIILiteral("function"), ElementAttributeJavaScript); 933 933 parameters->setArray(ASCIILiteral("arguments"), WTFMove(arguments)); … … 960 960 RefPtr<InspectorObject> parameters = InspectorObject::create(); 961 961 parameters->setString(ASCIILiteral("browsingContextHandle"), m_toplevelBrowsingContext.value()); 962 if (m_ browsingContext)963 parameters->setString(ASCIILiteral("frameHandle"), m_ browsingContext.value());962 if (m_currentBrowsingContext) 963 parameters->setString(ASCIILiteral("frameHandle"), m_currentBrowsingContext.value()); 964 964 if (m_timeouts.pageLoad) 965 965 parameters->setInteger(ASCIILiteral("pageLoadTimeout"), m_timeouts.pageLoad.value().millisecondsAs<int>()); … … 1014 1014 RefPtr<InspectorObject> parameters = InspectorObject::create(); 1015 1015 parameters->setString(ASCIILiteral("browsingContextHandle"), m_toplevelBrowsingContext.value()); 1016 if (m_ browsingContext)1017 parameters->setString(ASCIILiteral("frameHandle"), m_ browsingContext.value());1016 if (m_currentBrowsingContext) 1017 parameters->setString(ASCIILiteral("frameHandle"), m_currentBrowsingContext.value()); 1018 1018 parameters->setString(ASCIILiteral("function"), FormElementClearJavaScript); 1019 1019 parameters->setArray(ASCIILiteral("arguments"), WTFMove(arguments)); … … 1176 1176 RefPtr<InspectorObject> parameters = InspectorObject::create(); 1177 1177 parameters->setString(ASCIILiteral("browsingContextHandle"), m_toplevelBrowsingContext.value()); 1178 if (m_ browsingContext)1179 parameters->setString(ASCIILiteral("frameHandle"), m_ browsingContext.value());1178 if (m_currentBrowsingContext) 1179 parameters->setString(ASCIILiteral("frameHandle"), m_currentBrowsingContext.value()); 1180 1180 parameters->setString(ASCIILiteral("function"), focusScript); 1181 1181 parameters->setArray(ASCIILiteral("arguments"), WTFMove(arguments)); … … 1235 1235 RefPtr<InspectorObject> parameters = InspectorObject::create(); 1236 1236 parameters->setString(ASCIILiteral("browsingContextHandle"), m_toplevelBrowsingContext.value()); 1237 if (m_ browsingContext)1238 parameters->setString(ASCIILiteral("frameHandle"), m_ browsingContext.value());1237 if (m_currentBrowsingContext) 1238 parameters->setString(ASCIILiteral("frameHandle"), m_currentBrowsingContext.value()); 1239 1239 parameters->setString(ASCIILiteral("function"), FormSubmitJavaScript); 1240 1240 parameters->setArray(ASCIILiteral("arguments"), WTFMove(arguments)); … … 1294 1294 RefPtr<InspectorObject> parameters = InspectorObject::create(); 1295 1295 parameters->setString(ASCIILiteral("browsingContextHandle"), m_toplevelBrowsingContext.value()); 1296 if (m_ browsingContext)1297 parameters->setString(ASCIILiteral("frameHandle"), m_ browsingContext.value());1296 if (m_currentBrowsingContext) 1297 parameters->setString(ASCIILiteral("frameHandle"), m_currentBrowsingContext.value()); 1298 1298 parameters->setString(ASCIILiteral("function"), "function(){" + script + '}'); 1299 1299 parameters->setArray(ASCIILiteral("arguments"), WTFMove(arguments)); -
trunk/Source/WebDriver/Session.h
r219722 r219833 160 160 String m_id; 161 161 std::optional<String> m_toplevelBrowsingContext; 162 std::optional<String> m_ browsingContext;162 std::optional<String> m_currentBrowsingContext; 163 163 }; 164 164
Note: See TracChangeset
for help on using the changeset viewer.