Title: [100204] trunk/Source/WebKit/efl
- Revision
- 100204
- Author
- commit-qu...@webkit.org
- Date
- 2011-11-14 16:01:15 -0800 (Mon, 14 Nov 2011)
Log Message
[EFL] Update ewk_frame_script_execute to return the result for _javascript_
https://bugs.webkit.org/show_bug.cgi?id=65972
Patch by Jongseok Yang <js45.y...@samsung.com> on 2011-11-14
Reviewed by Antonio Gomes.
It executes the _javascript_ and converts the result to a string using toString.
And it returns the memory-allocated pointer for the value.
* ewk/ewk_frame.cpp:
(ewk_frame_script_execute):
* ewk/ewk_frame.h:
Modified Paths
Diff
Modified: trunk/Source/WebKit/efl/ChangeLog (100203 => 100204)
--- trunk/Source/WebKit/efl/ChangeLog 2011-11-15 00:00:00 UTC (rev 100203)
+++ trunk/Source/WebKit/efl/ChangeLog 2011-11-15 00:01:15 UTC (rev 100204)
@@ -1,3 +1,17 @@
+2011-11-14 Jongseok Yang <js45.y...@samsung.com>
+
+ [EFL] Update ewk_frame_script_execute to return the result for _javascript_
+ https://bugs.webkit.org/show_bug.cgi?id=65972
+
+ Reviewed by Antonio Gomes.
+
+ It executes the _javascript_ and converts the result to a string using toString.
+ And it returns the memory-allocated pointer for the value.
+
+ * ewk/ewk_frame.cpp:
+ (ewk_frame_script_execute):
+ * ewk/ewk_frame.h:
+
2011-11-13 Raphael Kubo da Costa <k...@profusion.mobi>
[EFL] Improve the documentation of ewk_view_setting_local_storage_*.
Modified: trunk/Source/WebKit/efl/ewk/ewk_frame.cpp (100203 => 100204)
--- trunk/Source/WebKit/efl/ewk/ewk_frame.cpp 2011-11-15 00:00:00 UTC (rev 100203)
+++ trunk/Source/WebKit/efl/ewk/ewk_frame.cpp 2011-11-15 00:01:15 UTC (rev 100204)
@@ -416,13 +416,29 @@
unreachableUri);
}
-Eina_Bool ewk_frame_script_execute(Evas_Object* ewkFrame, const char* script)
+char* ewk_frame_script_execute(Evas_Object* ewkFrame, const char* script)
{
- EWK_FRAME_SD_GET_OR_RETURN(ewkFrame, smartData, false);
- EINA_SAFETY_ON_FALSE_RETURN_VAL(smartData->frame, false);
- EINA_SAFETY_ON_NULL_RETURN_VAL(script, false);
- smartData->frame->script()->executeScript(WTF::String::fromUTF8(script), true);
- return true;
+ EWK_FRAME_SD_GET_OR_RETURN(ewkFrame, smartData, 0);
+ EINA_SAFETY_ON_NULL_RETURN_VAL(smartData->frame, 0);
+ EINA_SAFETY_ON_NULL_RETURN_VAL(script, 0);
+
+#if USE(JSC)
+ WTF::String resultString;
+ JSC::JSValue result = smartData->frame->script()->executeScript(WTF::String::fromUTF8(script), true).jsValue();
+
+ if (!smartData->frame) // In case the script removed our frame from the page.
+ return 0;
+
+ if (!result || (!result.isBoolean() && !result.isString() && !result.isNumber()))
+ return 0;
+
+ JSC::JSLock lock(JSC::SilenceAssertionsOnly);
+ resultString = WebCore::ustringToString(result.toString(smartData->frame->script()->globalObject(WebCore::mainThreadNormalWorld())->globalExec()));
+ return strdup(resultString.utf8().data());
+#else
+ notImplemented();
+ return 0;
+#endif
}
Eina_Bool ewk_frame_editable_get(const Evas_Object* ewkFrame)
Modified: trunk/Source/WebKit/efl/ewk/ewk_frame.h (100203 => 100204)
--- trunk/Source/WebKit/efl/ewk/ewk_frame.h 2011-11-15 00:00:00 UTC (rev 100203)
+++ trunk/Source/WebKit/efl/ewk/ewk_frame.h 2011-11-15 00:01:15 UTC (rev 100204)
@@ -319,12 +319,14 @@
/**
* Requests execution of the given script.
*
+ * The returned string @b should be freed after use.
+ *
* @param o frame object to execute script
* @param script _javascript_ to execute
*
- * @return @c EINA_TRUE if request was done, @c EINA_FALSE on errors
+ * @return newly allocated string for result or @c 0 if the result cannot be converted to string or failure
*/
-EAPI Eina_Bool ewk_frame_script_execute(Evas_Object *o, const char *script);
+EAPI char *ewk_frame_script_execute(Evas_Object *o, const char *script);
/**
* Queries if the frame is editable.
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes