soc.2009.webkitmessageview: 385b672f: removed some ugly pointless pieces of co...

tdrhq at soc.pidgin.im tdrhq at soc.pidgin.im
Tue Aug 25 12:02:08 EDT 2009


-----------------------------------------------------------------
Revision: 385b672f37ae088cf2fd4cf4d8b22e71a63129aa
Ancestor: 42e91db125cee1c3d56784a26618afe0bb7f9dec
Author: tdrhq at soc.pidgin.im
Date: 2009-08-10T07:47:37
Branch: im.pidgin.soc.2009.webkitmessageview
URL: http://d.pidgin.im/viewmtn/revision/info/385b672f37ae088cf2fd4cf4d8b22e71a63129aa

Modified files:
        pidgin/gtkwebview.c pidgin/gtkwebview.h

ChangeLog: 

removed some ugly pointless pieces of code.

-------------- next part --------------
============================================================
--- pidgin/gtkwebview.c	6f53dd006aaa41c751c2e6c9502700b62baa9753
+++ pidgin/gtkwebview.c	642171e311b5cbf111007db28b616f6e111b7d8b
@@ -223,25 +223,6 @@ webview_load_finished (WebKitWebView *vi
 	g_idle_add ((GSourceFunc) process_js_script_queue, view);
 }
 
-char*
-gtk_webview_execute_script (GtkWebView *view, const char *script)
-{
-	JSStringRef js_script = JSStringCreateWithUTF8CString (script);
-	JSContextRef ctxt = webkit_web_frame_get_global_context (
-		webkit_web_view_get_main_frame (WEBKIT_WEB_VIEW (view))
-		);
-	JSValueRef ret = JSEvaluateScript (ctxt, js_script, NULL, NULL, 0, NULL);
-	JSStringRef ret_as_str = JSValueToStringCopy (ctxt, ret, NULL);
-
-	size_t cstr_len = JSStringGetMaximumUTF8CStringSize (ret_as_str);
-	char   *cstr = g_new0(char, cstr_len + 1);
-
-	JSStringGetUTF8CString (ret_as_str, cstr, cstr_len);
-
-	/* TODO: I'm not sure what, if at all, I need to free here! */
-	return cstr;
-}
-
 void
 gtk_webview_safe_execute_script (GtkWebView *view, const char* script)
 {
@@ -327,18 +308,6 @@ gtk_webview_append_html (GtkWebView* vie
 	g_free (escaped);
 }
 
-char*
-gtk_webview_get_markup (GtkWebView *view)
-{
-	return gtk_webview_execute_script (view, "document.body.innerHTML");
-}
-
-char*
-gtk_webview_get_text (GtkWebView *view)
-{
-	return gtk_webview_execute_script (view, "document.body.textContent");
-}
-
 gboolean gtk_webview_is_empty (GtkWebView *view)
 {
 	return view->priv->empty;
============================================================
--- pidgin/gtkwebview.h	7eff41f8e630dcc136da096d3716aac2147bf8b2
+++ pidgin/gtkwebview.h	07da553931f7db373b05c2482c02ac6801010bca
@@ -103,20 +103,6 @@ gboolean gtk_webview_is_empty (GtkWebVie
 gboolean gtk_webview_is_empty (GtkWebView *webview);
 
 /**
- * Executes javascript and returns the answer of the script
- * formatted as string. The return value needs to be freed using
- * g_free. If the return values is not required you may instead
- * use webkit_web_view_execute_script, or even better
- * gtk_webview_safe_execute_script.
- *
- * @param webview The GtkWebView object
- * @param script  The JavaScript to execute
- *
- * @return the return value of the script.
- */
-char* gtk_webview_execute_script (GtkWebView *webview, const char *script);
-
-/**
  * Execute the JavaScript only after the webkit_webview_load_string
  * loads completely. We also guarantee that the scripts are executed
  * in the order they are called here.This is useful to avoid race
@@ -129,24 +115,6 @@ void gtk_webview_safe_execute_script (Gt
 void gtk_webview_safe_execute_script (GtkWebView *webview, const char* script);
 
 /**
- * Get the current contents of the GtkWebView object.
- *
- * @param webview The GtkWebView object
- *
- * @return a string with the contents. Needs to be g_free'd after use.
- */
-char* gtk_webview_get_markup (GtkWebView *webview);
-
-/**
- * Returns the contents of the GtkWebView object, stripped of markups
- *
- * @param webview The GtkWebView object
- *
- * @return a string with the contents. Needs to be g_free'd after use.
- */
-char* gtk_webview_get_text (GtkWebView *view);
-
-/**
  * A convenience routine to quote a string for use as a JavaScript 
  * string. For instance, "hello 'world'" becomes "'hello \\'world\\''"
  *


More information about the Commits mailing list