From: Steve Lamerton Date: Sun, 5 May 2013 11:48:47 +0000 (+0000) Subject: Speculative fix for wxWebView unit tests on OSX. X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/ae4adc3d0644b50636f0c3f6f06590b8a08cd6c8?ds=inline Speculative fix for wxWebView unit tests on OSX. Use stringByEvaluatingJavaScriptFromString as it is guaranteed to return an NSString. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@73931 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/osx/webview_webkit.mm b/src/osx/webview_webkit.mm index 018dacf3f5..9659efdb08 100644 --- a/src/osx/webview_webkit.mm +++ b/src/osx/webview_webkit.mm @@ -909,16 +909,16 @@ wxString wxWebViewWebKit::GetSelectedSource() const "var element = document.createElement('div');" "element.appendChild(range.cloneContents());" "return element.innerHTML;"); - id result = [[m_webView windowScriptObject] - evaluateWebScript:wxNSStringWithWxString(script)]; - return wxStringWithNSString([result stringValue]); + NSString *result = [m_webView stringByEvaluatingJavaScriptFromString: + wxNSStringWithWxString(script)]; + return wxStringWithNSString(result); } wxString wxWebViewWebKit::GetPageText() const { - id result = [[m_webView windowScriptObject] - evaluateWebScript:@"document.body.textContent"]; - return wxStringWithNSString([result stringValue]); + NSString *result = [m_webView stringByEvaluatingJavaScriptFromString: + @"document.body.textContent"]; + return wxStringWithNSString(result); } void wxWebViewWebKit::EnableHistory(bool enable)