Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJonas Smedegaard <dr@jones.dk>2008-06-20 22:19:16 (GMT)
committer Jonas Smedegaard <dr@jones.dk>2008-06-20 22:19:16 (GMT)
commitae437e7c97695787b075a3b7000b9de48c72a38b (patch)
treed344649706dd1125003b7dc9867d7d93d7db766c /src
parent575b6689b13b85b58551eaee386015725cd5b82b (diff)
Imported Upstream version 0.4.1upstream/0.4.1
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.in21
-rw-r--r--src/hulahop-web-view.cpp24
-rw-r--r--src/hulahop-web-view.h4
3 files changed, 37 insertions, 12 deletions
diff --git a/src/Makefile.in b/src/Makefile.in
index cd33347..38f36ce 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.10 from Makefile.am.
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -114,6 +114,7 @@ LIBTOOL = @LIBTOOL@
LIBXUL_CFLAGS = @LIBXUL_CFLAGS@
LIBXUL_DIR = @LIBXUL_DIR@
LIBXUL_LIBS = @LIBXUL_LIBS@
+LIBXUL_SDK_DIR = @LIBXUL_SDK_DIR@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
@@ -204,7 +205,8 @@ INCLUDES = \
$(LIBXUL_CFLAGS) \
-DPLUGIN_PATH=\"$(libdir)/mozilla/plugins\" \
-DLIBXUL_DIR=\"$(LIBXUL_DIR)\" \
- -DDATA_DIR=\"$(pkgdatadir)\"
+ -DDATA_DIR=\"$(pkgdatadir)\" \
+ -DLIB_DIR=\"$(pkglibdir)\"
noinst_LTLIBRARIES = libhulahop.la
libhulahop_la_SOURCES = \
@@ -302,8 +304,8 @@ ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
- $(AWK) ' { files[$$0] = 1; } \
- END { for (i in files) print i; }'`; \
+ $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
mkid -fID $$unique
tags: TAGS
@@ -315,8 +317,8 @@ TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
- $(AWK) ' { files[$$0] = 1; } \
- END { for (i in files) print i; }'`; \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
@@ -326,13 +328,12 @@ ctags: CTAGS
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
- here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
- $(AWK) ' { files[$$0] = 1; } \
- END { for (i in files) print i; }'`; \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
test -z "$(CTAGS_ARGS)$$tags$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$tags $$unique
diff --git a/src/hulahop-web-view.cpp b/src/hulahop-web-view.cpp
index 286f3cf..00705b9 100644
--- a/src/hulahop-web-view.cpp
+++ b/src/hulahop-web-view.cpp
@@ -30,6 +30,8 @@
#include <nsIInterfaceRequestorUtils.h>
#include <jscntxt.h>
#include <nsIJSContextStack.h>
+#include <nsIScriptGlobalObject.h>
+#include <nsIScriptContext.h>
#include <PyXPCOM.h>
#include <gtk/gtkfixed.h>
@@ -298,7 +300,7 @@ hulahop_web_view_grab_focus(HulahopWebView *web_view)
}
void
-hulahop_web_view_push_js_context (HulahopWebView *web_view)
+hulahop_web_view_push_js_context(HulahopWebView *web_view)
{
nsCOMPtr<nsIJSContextStack> stack(do_GetService("@mozilla.org/js/xpc/ContextStack;1"));
nsresult rv = stack->Push(nsnull);
@@ -306,10 +308,28 @@ hulahop_web_view_push_js_context (HulahopWebView *web_view)
}
void
-hulahop_web_view_pop_js_context (HulahopWebView *web_view)
+hulahop_web_view_pop_js_context(HulahopWebView *web_view)
{
nsCOMPtr<nsIJSContextStack> stack(do_GetService("@mozilla.org/js/xpc/ContextStack;1"));
nsresult rv = stack->Pop(nsnull);
g_assert(NS_SUCCEEDED(rv));
}
+void
+hulahop_web_view_evaluate_script(HulahopWebView *web_view, const char *script)
+{
+ nsresult rv;
+
+ nsCOMPtr<nsIDOMWindow> contentWindow;
+ rv = web_view->browser->GetContentDOMWindow(getter_AddRefs(contentWindow));
+ NS_ENSURE_SUCCESS(rv,);
+
+ nsCOMPtr<nsIScriptGlobalObject> globalObject = do_QueryInterface(contentWindow);
+ NS_ENSURE_TRUE(globalObject,);
+
+ nsIScriptContext *context = globalObject->GetContext();
+ NS_ENSURE_TRUE(context,);
+
+ context->EvaluateString(NS_ConvertUTF8toUTF16(script), nsnull, nsnull,
+ nsnull, 0, nsnull, nsnull, nsnull);
+}
diff --git a/src/hulahop-web-view.h b/src/hulahop-web-view.h
index 40ea6e8..f832b7a 100644
--- a/src/hulahop-web-view.h
+++ b/src/hulahop-web-view.h
@@ -45,6 +45,10 @@ PyObject *hulahop_web_view_get_window_root (HulahopWebView *web_view);
void hulahop_web_view_push_js_context (HulahopWebView *web_view);
void hulahop_web_view_pop_js_context (HulahopWebView *web_view);
+void hulahop_web_view_evaluate_script (HulahopWebView *web_view,
+ const char *script);
+
+
G_END_DECLS
#endif