Changeset 100204 in webkit
- Timestamp:
- Nov 14, 2011, 4:01:15 PM (15 years ago)
- Location:
- trunk/Source/WebKit/efl
- Files:
-
- 3 edited
-
ChangeLog (modified) (1 diff)
-
ewk/ewk_frame.cpp (modified) (1 diff)
-
ewk/ewk_frame.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/efl/ChangeLog
r100097 r100204 1 2011-11-14 Jongseok Yang <js45.yang@samsung.com> 2 3 [EFL] Update ewk_frame_script_execute to return the result for JavaScript 4 https://bugs.webkit.org/show_bug.cgi?id=65972 5 6 Reviewed by Antonio Gomes. 7 8 It executes the javascript and converts the result to a string using toString. 9 And it returns the memory-allocated pointer for the value. 10 11 * ewk/ewk_frame.cpp: 12 (ewk_frame_script_execute): 13 * ewk/ewk_frame.h: 14 1 15 2011-11-13 Raphael Kubo da Costa <kubo@profusion.mobi> 2 16 -
trunk/Source/WebKit/efl/ewk/ewk_frame.cpp
r99480 r100204 417 417 } 418 418 419 Eina_Bool ewk_frame_script_execute(Evas_Object* ewkFrame, const char* script) 420 { 421 EWK_FRAME_SD_GET_OR_RETURN(ewkFrame, smartData, false); 422 EINA_SAFETY_ON_FALSE_RETURN_VAL(smartData->frame, false); 423 EINA_SAFETY_ON_NULL_RETURN_VAL(script, false); 424 smartData->frame->script()->executeScript(WTF::String::fromUTF8(script), true); 425 return true; 419 char* ewk_frame_script_execute(Evas_Object* ewkFrame, const char* script) 420 { 421 EWK_FRAME_SD_GET_OR_RETURN(ewkFrame, smartData, 0); 422 EINA_SAFETY_ON_NULL_RETURN_VAL(smartData->frame, 0); 423 EINA_SAFETY_ON_NULL_RETURN_VAL(script, 0); 424 425 #if USE(JSC) 426 WTF::String resultString; 427 JSC::JSValue result = smartData->frame->script()->executeScript(WTF::String::fromUTF8(script), true).jsValue(); 428 429 if (!smartData->frame) // In case the script removed our frame from the page. 430 return 0; 431 432 if (!result || (!result.isBoolean() && !result.isString() && !result.isNumber())) 433 return 0; 434 435 JSC::JSLock lock(JSC::SilenceAssertionsOnly); 436 resultString = WebCore::ustringToString(result.toString(smartData->frame->script()->globalObject(WebCore::mainThreadNormalWorld())->globalExec())); 437 return strdup(resultString.utf8().data()); 438 #else 439 notImplemented(); 440 return 0; 441 #endif 426 442 } 427 443 -
trunk/Source/WebKit/efl/ewk/ewk_frame.h
r98378 r100204 320 320 * Requests execution of the given script. 321 321 * 322 * The returned string @b should be freed after use. 323 * 322 324 * @param o frame object to execute script 323 325 * @param script Java Script to execute 324 326 * 325 * @return @c EINA_TRUE if request was done, @c EINA_FALSE on errors326 */ 327 EAPI Eina_Boolewk_frame_script_execute(Evas_Object *o, const char *script);327 * @return newly allocated string for result or @c 0 if the result cannot be converted to string or failure 328 */ 329 EAPI char *ewk_frame_script_execute(Evas_Object *o, const char *script); 328 330 329 331 /**
Note:
See TracChangeset
for help on using the changeset viewer.