RESOLVED FIXED 145900
-[WKWebView evaluateJavaScript] provides a misleading error when the return cannot be serialized
https://bugs.webkit.org/show_bug.cgi?id=145900
Summary -[WKWebView evaluateJavaScript] provides a misleading error when the return c...
Alexey Proskuryakov
Reported 2015-06-11 16:19:37 PDT
-[WKWebView evaluateJavaScript] can't return nodes, because they cannot be sent to UI process. But we currently claim that there was a JavaScript exception, which is super misleading.
Attachments
proposed fix (15.54 KB, patch)
2015-06-11 16:23 PDT, Alexey Proskuryakov
sam: review+
Alexey Proskuryakov
Comment 1 2015-06-11 16:23:33 PDT
Created attachment 254765 [details] proposed fix
WebKit Commit Bot
Comment 2 2015-06-11 16:25:53 PDT
Attachment 254765 [details] did not pass style-queue: ERROR: Source/WebKit2/UIProcess/WebPageProxy.cpp:2574: Extra space before ( in function call [whitespace/parens] [4] ERROR: Tools/TestWebKitAPI/Tests/WebKit2Cocoa/WKWebViewEvaluateJavaScript.mm:70: Place brace on its own line for function definitions. [whitespace/braces] [4] ERROR: Tools/TestWebKitAPI/Tests/WebKit2Cocoa/WKWebViewEvaluateJavaScript.mm:81: Place brace on its own line for function definitions. [whitespace/braces] [4] ERROR: Source/WebKit2/UIProcess/WebPageProxy.h:762: Extra space before ( in function call [whitespace/parens] [4] Total errors found: 4 in 13 files If any of these errors are false positives, please file a bug against check-webkit-style.
mitz
Comment 3 2015-06-11 17:27:51 PDT
The new API needs an availability macro.
Alexey Proskuryakov
Comment 4 2015-06-11 17:33:10 PDT
> The new API needs an availability macro. Why?
Anders Carlsson
Comment 5 2015-06-12 10:37:14 PDT
(In reply to comment #4) > > The new API needs an availability macro. > > Why? So people who deploy against older versions of OS X and iOS get the right compiler warnings/errors.
Anders Carlsson
Comment 6 2015-06-12 10:37:29 PDT
This also needs to go through internal API review.
Alexey Proskuryakov
Comment 7 2015-06-12 10:45:40 PDT
> So people who deploy against older versions of OS X and iOS get the right compiler warnings/errors. Can you please be more specific? I know what an availability macro is, but don't know what situation you have in mind. Perhaps a code snippet where a warning would be helpful.
Anders Carlsson
Comment 8 2015-06-12 10:50:43 PDT
(In reply to comment #7) > > So people who deploy against older versions of OS X and iOS get the right compiler warnings/errors. > > Can you please be more specific? I know what an availability macro is, but > don't know what situation you have in mind. > > Perhaps a code snippet where a warning would be helpful. Imagine someone writing an iOS app using the latest SDK but deploying back to 10.10 and iOS 8. In that case, this API is not available so attempting to use it should be an error. I'm sure Dan could be more specific if I we asked him nicely :)
Alexey Proskuryakov
Comment 9 2015-06-12 11:18:33 PDT
I don't think that there is any helpful way to express a change like this via availability macros. For someone who already looks at the error values, no longer reporting the condition as WKErrorJavaScriptExceptionOccurred would be quite harmful too. In person, Anders told me that he would prefer to have an availability macro just for consistency, which is OK with me, but I don't think that there is a true need for it here.
mitz
Comment 10 2015-06-12 11:55:06 PDT
Anders is right, the compiler is not going to emit a warning or generate different code, but the availability information is still useful to developers ("why am I not getting this error when doing this thing on this platform, but I do get it on that platform?") and to WebKit contributors. It is also the convention across all Cocoa API.
Alexey Proskuryakov
Comment 11 2015-06-15 09:58:25 PDT
Committed r185554 with Gtk build fixes and with the still questionable availability macro.
Note You need to log in before you can comment on or make changes to this bug.