[epiphany] ephy-web-view: add js_get_element_property



commit c825037c4440837ed53a98ef7d707ce567234a5a
Author: Diego Escalante Urrelo <descalante igalia com>
Date:   Sun Mar 7 19:27:02 2010 -0500

    ephy-web-view: add js_get_element_property
    
    This retrieves a property from a JS object, just like "element.property" in
    plain javascript.
    
    Bug #608740

 embed/ephy-web-view.c |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)
---
diff --git a/embed/ephy-web-view.c b/embed/ephy-web-view.c
index 129ee3b..398db35 100644
--- a/embed/ephy-web-view.c
+++ b/embed/ephy-web-view.c
@@ -583,6 +583,21 @@ js_object_get_property_as_object (JSContextRef js_context,
 }
 
 static char *
+js_get_element_property (JSContextRef js_context,
+                         JSObjectRef object,
+                         const char *prop)
+{
+  JSValueRef val;
+  char *buffer = NULL;
+
+  val = js_object_get_property (js_context, object, prop);
+  if (JSValueIsString (js_context, val))
+    buffer = js_value_to_string (js_context, val);
+
+  return buffer;
+}
+
+static char *
 js_get_element_attribute (JSContextRef js_context,
                           JSObjectRef object,
                           const char *attr)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]