Web Automation: fail gracefully when a screenshot cannot be encoded as base64
authorbburg@apple.com <bburg@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 10 Feb 2017 17:25:36 +0000 (17:25 +0000)
committerbburg@apple.com <bburg@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 10 Feb 2017 17:25:36 +0000 (17:25 +0000)
commit0a171f18936b6a6bd130f7be3ee82d9458264e64
tree5bcfdbd911304e53ef6d12da900c9efcacc91cef
parent53758160ffbd414ad5767bc8e878fef8672392d9
Web Automation: fail gracefully when a screenshot cannot be encoded as base64
https://bugs.webkit.org/show_bug.cgi?id=168095
<rdar://problem/30297427>

Reviewed by Joseph Pecoraro.

Convert platformGetBase64EncodedPNGData to return a std::optional<String>.
Return nullopt if we can't create a screenshot or convert it to base64.

* UIProcess/Automation/WebAutomationSession.cpp:
(WebKit::WebAutomationSession::didTakeScreenshot):
(WebKit::WebAutomationSession::platformGetBase64EncodedPNGData):
* UIProcess/Automation/WebAutomationSession.h:
* UIProcess/Automation/cocoa/WebAutomationSessionCocoa.mm:
(WebKit::WebAutomationSession::platformGetBase64EncodedPNGData):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@212115 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/Automation/WebAutomationSession.cpp
Source/WebKit2/UIProcess/Automation/WebAutomationSession.h
Source/WebKit2/UIProcess/Automation/cocoa/WebAutomationSessionCocoa.mm