RESOLVED FIXED 65972
[EFL] update ewk_frame_script_execute to return the result for JavaScript
https://bugs.webkit.org/show_bug.cgi?id=65972
Summary [EFL] update ewk_frame_script_execute to return the result for JavaScript
Jongseok Yang
Reported 2011-08-10 04:33:43 PDT
A developer using webkit may want to get the result of javascript. The ewk_frame_script_execute cannot satisfy the requirement because it returns just TRUE/FALSE. The function should return the result of javascript.
Attachments
Patch (3.06 KB, patch)
2011-08-10 04:37 PDT, Jongseok Yang
no flags
Patch (3.06 KB, patch)
2011-08-10 04:48 PDT, Jongseok Yang
no flags
Patch (3.13 KB, patch)
2011-08-11 01:02 PDT, Jongseok Yang
no flags
Patch (3.24 KB, patch)
2011-08-11 01:59 PDT, Jongseok Yang
ryuan.choi: commit-queue-
patch (3.33 KB, patch)
2011-11-10 00:30 PST, Jongseok Yang
no flags
Jongseok Yang
Comment 1 2011-08-10 04:37:39 PDT
WebKit Review Bot
Comment 2 2011-08-10 04:40:01 PDT
Attachment 103463 [details] did not pass style-queue: Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'Source/WebKit/efl/ChangeLog', u'Source/Web..." exit_code: 1 Source/WebKit/efl/ChangeLog:1: ChangeLog entry has no bug number [changelog/bugnumber] [5] Total errors found: 1 in 3 files If any of these errors are false positives, please file a bug against check-webkit-style.
Jongseok Yang
Comment 3 2011-08-10 04:48:07 PDT
Gyuyoung Kim
Comment 4 2011-08-10 20:43:38 PDT
Comment on attachment 103464 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=103464&action=review Does return value have success or fail message? Could you explain what can application does with the return value ? > Source/WebKit/efl/ewk/ewk_frame.cpp:426 > +char *ewk_frame_script_execute(Evas_Object* o, const char* script) Move '*' operator to parameter side. > Source/WebKit/efl/ewk/ewk_frame.cpp:441 > + JSC::JSLock lock(JSC::SilenceAssertionsOnly); You need to use #if USE(JSC) preprocessor. We may use V8 as JavaScriptEngine in future.
Jongseok Yang
Comment 5 2011-08-10 23:12:48 PDT
(In reply to comment #4) > (From update of attachment 103464 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=103464&action=review > > Does return value have success or fail message? Could you explain what can application does with the return value ? I doest not think that it have success or fail message. Because it returns NULL pointer in specific case like the below code. ===================================================================================== if (!sd->frame) // In case the script removed our frame from the page. return 0; if (!result || (!result.isBoolean() && !result.isString() && !result.isNumber())) return 0; ===================================================================================== To identify return value, it's helpfull to check "toString" function. <Source/JavaScriptCore/runtime/JSString.h>========================= inline UString JSValue::toString(ExecState* exec) const { if (isString()) return static_cast<JSString*>(asCell())->value(exec); if (isInt32()) return exec->globalData().numericStrings.add(asInt32()); if (isDouble()) return exec->globalData().numericStrings.add(asDouble()); if (isTrue()) return "true"; if (isFalse()) return "false"; if (isNull()) return "null"; if (isUndefined()) return "undefined"; ASSERT(isCell()); return asCell()->toString(exec); } =================================================================== From "toString" function, you may require to change the code like the below ===================================================================================== <before> if (!result || (!result.isBoolean() && !result.isString() && !result.isNumber())) return 0; <after> if (!result) return 0; ===================================================================================== I'll wait for your proposal. > > > Source/WebKit/efl/ewk/ewk_frame.cpp:426 > > +char *ewk_frame_script_execute(Evas_Object* o, const char* script) > > Move '*' operator to parameter side. I'll fix that. > > > Source/WebKit/efl/ewk/ewk_frame.cpp:441 > > + JSC::JSLock lock(JSC::SilenceAssertionsOnly); > > You need to use #if USE(JSC) preprocessor. We may use V8 as JavaScriptEngine in future. I'll fix that.
Jongseok Yang
Comment 6 2011-08-11 01:02:55 PDT
Grzegorz Czajkowski
Comment 7 2011-08-11 01:44:50 PDT
> Source/WebKit/efl/ewk/ewk_frame.h:325 > + * @return newly allocated string for result or @c NULL if the result cannot be converted to string or failure Generally we don't use NULL in documentation too. I'd better use @c 0. Additionally if the method allocates memory, it will be nice to mention that caller should free the string. See other documentation ewk_frame for details.
Jongseok Yang
Comment 8 2011-08-11 01:59:48 PDT
Jongseok Yang
Comment 9 2011-08-11 02:01:43 PDT
(In reply to comment #7) > > Source/WebKit/efl/ewk/ewk_frame.h:325 > > + * @return newly allocated string for result or @c NULL if the result cannot be converted to string or failure > > Generally we don't use NULL in documentation too. I'd better use @c 0. > Additionally if the method allocates memory, it will be nice to mention that caller should free the string. See other documentation ewk_frame for details. I accepted your comment. Please check new patch.
Raphael Kubo da Costa (:rakuco)
Comment 10 2011-08-22 07:07:00 PDT
Looks OK to me.
Ryuan Choi
Comment 11 2011-11-03 18:11:22 PDT
Comment on attachment 103592 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=103592&action=review > Source/WebKit/efl/ewk/ewk_frame.cpp:429 > + EWK_FRAME_SD_GET_OR_RETURN(o, sd, 0); > + EINA_SAFETY_ON_FALSE_RETURN_VAL(sd->frame, 0); EINA_SAFETY_ON_NULL_RETURN_VAL(sd->frame, 0); And this patch is out-dated. please rebased this.
Raphael Kubo da Costa (:rakuco)
Comment 12 2011-11-04 08:10:18 PDT
Comment on attachment 103592 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=103592&action=review > Source/WebKit/efl/ewk/ewk_frame.cpp:445 > +#elif USE(V8) BTW, I'd change this to an #else
Jongseok Yang
Comment 13 2011-11-10 00:30:47 PST
Created attachment 114450 [details] patch I updated the patch using re-based webkit source.
Raphael Kubo da Costa (:rakuco)
Comment 14 2011-11-10 03:42:01 PST
JSC code is not something I'm very familiar with, so from an uninformed point of view the patch LGTM.
Ryuan Choi
Comment 15 2011-11-10 05:56:16 PST
Looks good to me too.
WebKit Review Bot
Comment 16 2011-11-14 16:01:29 PST
Comment on attachment 114450 [details] patch Clearing flags on attachment: 114450 Committed r100204: <http://trac.webkit.org/changeset/100204>
WebKit Review Bot
Comment 17 2011-11-14 16:01:35 PST
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.