From ae437e7c97695787b075a3b7000b9de48c72a38b Mon Sep 17 00:00:00 2001 From: Jonas Smedegaard Date: Fri, 20 Jun 2008 22:19:16 +0000 Subject: Imported Upstream version 0.4.1 --- (limited to 'src') 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 #include #include +#include +#include #include #include @@ -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 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 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 contentWindow; + rv = web_view->browser->GetContentDOMWindow(getter_AddRefs(contentWindow)); + NS_ENSURE_SUCCESS(rv,); + + nsCOMPtr 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 -- cgit v0.9.1