ewk_view_page_contents_get() API test is sometime failing like below. https://build.webkit.org/builders/EFL%20Linux%2064-bit%20Release%20WK2/builds/21679/steps/API%20tests/logs/stdio ../../Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_view.cpp:226: Failure Value of: String(data).length() == fileSize || String(data).length() == fileSize + 1 Actual: false Expected: true ERR<10438>: ../../Source/WebKit2/UIProcess/API/efl/ewk_view.cpp:633 ewk_view_page_contents_get() safety check failed: callback == NULL ERR<10438>: ../../Source/WebKit2/UIProcess/API/efl/ewk_view.cpp:54 toEwkViewChecked() safety check failed: evasObject == NULL CRI<10438>: ../../Source/WebKit2/UIProcess/API/efl/ewk_view.cpp:634 ewk_view_page_contents_get() no private data for object (nil) [ FAILED ] EWK2ViewTest.ewk_view_page_contents_get (204 ms) It's because callback of WKPageGetContentsAsMHTMLData returns WKData, which is not null-terminated string, but it is considered as common string. We should pass null terminated string instead of WKData.
Created attachment 252538 [details] Patch
Comment on attachment 252538 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=252538&action=review > Source/WebKit2/UIProcess/API/efl/ewk_view.cpp:616 > + contentsContext->callback(contentsContext->type, String(WKDataGetBytes(wkData), WKDataGetSize(wkData)).utf8().data(), contentsContext->userData); It doesn’t make sense to take this data and convert it to UTF-8 as if it was Latin-1. If you want to put it in a CString so it gets null terminated, then I suggest creating the CString directly, not through a String.
Created attachment 252549 [details] Patch
(In reply to comment #2) > Comment on attachment 252538 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=252538&action=review > > > Source/WebKit2/UIProcess/API/efl/ewk_view.cpp:616 > > + contentsContext->callback(contentsContext->type, String(WKDataGetBytes(wkData), WKDataGetSize(wkData)).utf8().data(), contentsContext->userData); > > It doesn’t make sense to take this data and convert it to UTF-8 as if it was > Latin-1. If you want to put it in a CString so it gets null terminated, then > I suggest creating the CString directly, not through a String. Thanks, I updated to use CString.
Comment on attachment 252549 [details] Patch r+ed based on Darin's comment.
Comment on attachment 252549 [details] Patch Clearing flags on attachment: 252549 Committed r183908: <http://trac.webkit.org/changeset/183908>
All reviewed patches have been landed. Closing bug.