Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile.am2
-rw-r--r--components/.gitignore1
-rw-r--r--components/Makefile.am15
-rw-r--r--components/hulahopAddCertException.idl7
-rw-r--r--components/hulahopAddCertException.js21
-rw-r--r--configure.ac7
-rw-r--r--data/Makefile.am2
-rw-r--r--data/chrome/.gitignore1
-rw-r--r--data/chrome/Makefile.am25
-rw-r--r--data/chrome/brand.properties1
-rw-r--r--data/chrome/chrome.manifest.in2
-rw-r--r--data/chrome/netError.dtd9
-rw-r--r--src/HulahopDirectoryProvider.cpp26
-rw-r--r--src/Makefile.am3
-rw-r--r--src/hulahop.cpp6
-rw-r--r--tests/test-web-view.py44
16 files changed, 165 insertions, 7 deletions
diff --git a/Makefile.am b/Makefile.am
index 4204b17..77694ea 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,5 +1,5 @@
ACLOCAL_AMFLAGS = -I m4
-SUBDIRS = data src python
+SUBDIRS = components data src python
EXTRA_DIST = COPYING
diff --git a/components/.gitignore b/components/.gitignore
new file mode 100644
index 0000000..19903b8
--- /dev/null
+++ b/components/.gitignore
@@ -0,0 +1 @@
+*.xpt
diff --git a/components/Makefile.am b/components/Makefile.am
new file mode 100644
index 0000000..1f4466a
--- /dev/null
+++ b/components/Makefile.am
@@ -0,0 +1,15 @@
+xptdir = $(pkglibdir)/components
+xpt_in_files = hulahopAddCertException.idl
+xpt_DATA = $(xpt_in_files:.idl=.xpt)
+
+%.xpt: %.idl
+ $(LIBXUL_SDK_DIR)/bin/xpidl -m typelib -w -v -I $(LIBXUL_SDK_DIR)/idl -e $@ $<
+
+componentsdir = $(pkglibdir)/components
+components_DATA = hulahopAddCertException.js
+
+EXTRA_DIST = $(xpt_in_files) $(components_DATA)
+
+CLEANFILES = $(xpt_DATA)
+
+DISTCLEANFILES = $(xpt_DATA)
diff --git a/components/hulahopAddCertException.idl b/components/hulahopAddCertException.idl
new file mode 100644
index 0000000..066826a
--- /dev/null
+++ b/components/hulahopAddCertException.idl
@@ -0,0 +1,7 @@
+#include "nsISupports.idl"
+#include "nsIDOMWindow.idl"
+
+[scriptable, uuid(4117128f-0e50-4863-b7a7-40a853451cc0)]
+interface hulahopAddCertException : nsISupports {
+ void showDialog (in nsIDOMWindow aWindow);
+};
diff --git a/components/hulahopAddCertException.js b/components/hulahopAddCertException.js
new file mode 100644
index 0000000..3d1f88e
--- /dev/null
+++ b/components/hulahopAddCertException.js
@@ -0,0 +1,21 @@
+Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
+
+function AddCertException() { };
+
+AddCertException.prototype = {
+ classDescription: "AddCertException XPCOM Component",
+ classID: Components.ID("{4117128f-0e50-4863-b7a7-40a853451cc0}"),
+ contractID: "@sugarlabs.org/add-cert-exception;1",
+ QueryInterface: XPCOMUtils.generateQI([Components.interfaces.hulahopAddCertException]),
+ showDialog: function(window) {
+ var params = { location : window.location.href };
+ window.openDialog('chrome://pippki/content/exceptionDialog.xul',
+ '', 'chrome,centerscreen,modal', params);
+ }
+}
+
+var components = [AddCertException];
+function NSGetModule(compMgr, fileSpec) {
+ return XPCOMUtils.generateModule(components);
+}
+
diff --git a/configure.ac b/configure.ac
index ee5fddb..4b3c2eb 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,4 +1,4 @@
-AC_INIT([hulahop],[0.4.0],[],[hulahop])
+AC_INIT([hulahop],[0.4.1],[],[hulahop])
AC_PREREQ([2.59])
@@ -26,7 +26,7 @@ PKG_CHECK_MODULES([LIBXUL],[libxul])
# FIXME To be able to use pyxpcom we currently need
# to link to xpcom at build time. Which involves various hacks.
LIBXUL_SDK_DIR=`$PKG_CONFIG --variable=sdkdir libxul`
-LIBXUL_DIR=`echo $LIBXUL_SDK_DIR | sed -e 's/-devel//'`
+LIBXUL_DIR="`dirname $LIBXUL_SDK_DIR`/xulrunner-`$PKG_CONFIG --modversion libxul`"
LIBXUL_LIBS="$LIBXUL_LIBS -L$LIBXUL_DIR -lpyxpcom"
LIBXUL_CFLAGS=`$PKG_CONFIG --cflags --define-variable=includetype=unstable libxul`
@@ -34,10 +34,13 @@ LIBXUL_CFLAGS=`$PKG_CONFIG --cflags --define-variable=includetype=unstable libxu
AC_SUBST([LIBXUL_CFLAGS])
AC_SUBST([LIBXUL_LIBS])
AC_SUBST([LIBXUL_DIR])
+AC_SUBST([LIBXUL_SDK_DIR])
AC_OUTPUT([
Makefile
+components/Makefile
data/Makefile
+data/chrome/Makefile
src/Makefile
python/Makefile
python/config.py
diff --git a/data/Makefile.am b/data/Makefile.am
index 98d9b33..83b35fd 100644
--- a/data/Makefile.am
+++ b/data/Makefile.am
@@ -1,3 +1,5 @@
+SUBDIRS = chrome
+
hulahopdir = $(pkgdatadir)
hulahop_DATA = prefs.js
diff --git a/data/chrome/.gitignore b/data/chrome/.gitignore
new file mode 100644
index 0000000..c590bcb
--- /dev/null
+++ b/data/chrome/.gitignore
@@ -0,0 +1 @@
+chrome.manifest
diff --git a/data/chrome/Makefile.am b/data/chrome/Makefile.am
new file mode 100644
index 0000000..d319915
--- /dev/null
+++ b/data/chrome/Makefile.am
@@ -0,0 +1,25 @@
+manifestdir = $(pkgdatadir)/chrome
+manifest_in_files = chrome.manifest.in
+manifest_DATA = $(manifest_in_files:.manifest.in=.manifest)
+
+%.manifest: %.manifest.in
+ @sed -e "s!@CHROMEDIR@!$(pkgdatadir)/chrome!g" $< > $@
+
+brandingdir = $(manifestdir)/branding
+branding_DATA = brand.properties
+
+globalchromedir = $(manifestdir)/global
+globalchrome_DATA = netError.dtd
+
+EXTRA_DIST = \
+ $(manifest_in_files) \
+ $(branding_in_files) \
+ $(globalchrome_DATA) \
+ $(branding_DATA)
+
+CLEANFILES = \
+ $(manifest_DATA)
+
+DISTCLEANFILES = \
+ $(manifest_DATA) \
+ $(branding_DATA)
diff --git a/data/chrome/brand.properties b/data/chrome/brand.properties
new file mode 100644
index 0000000..48b6083
--- /dev/null
+++ b/data/chrome/brand.properties
@@ -0,0 +1 @@
+brandShortName=Hulahop
diff --git a/data/chrome/chrome.manifest.in b/data/chrome/chrome.manifest.in
new file mode 100644
index 0000000..eba0ee0
--- /dev/null
+++ b/data/chrome/chrome.manifest.in
@@ -0,0 +1,2 @@
+override chrome://branding/locale/brand.properties file://@CHROMEDIR@/branding/brand.properties
+override chrome://global/locale/netErrorApp.dtd file://@CHROMEDIR@/global/netError.dtd
diff --git a/data/chrome/netError.dtd b/data/chrome/netError.dtd
new file mode 100644
index 0000000..82fe3b1
--- /dev/null
+++ b/data/chrome/netError.dtd
@@ -0,0 +1,9 @@
+<!ENTITY securityOverride.linkText "Or you can add an exception…">
+<!ENTITY securityOverride.getMeOutOfHereButton "Get me out of here!">
+<!ENTITY securityOverride.exceptionButtonLabel "Add Exception…">
+
+<!ENTITY securityOverride.warningText "
+<p>You should not add an exception if you are using an internet connection that you do not trust completely or if you are not used to seeing a warning for this server.</p>
+
+<xul:button xmlns:xul='http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul' id='exceptionDialogButton' label='&securityOverride.exceptionButtonLabel;'/>
+">
diff --git a/src/HulahopDirectoryProvider.cpp b/src/HulahopDirectoryProvider.cpp
index 1162dbb..fb21d69 100644
--- a/src/HulahopDirectoryProvider.cpp
+++ b/src/HulahopDirectoryProvider.cpp
@@ -21,6 +21,10 @@
#include <nsAppDirectoryServiceDefs.h>
#include <nsDirectoryServiceDefs.h>
#include <nsArrayEnumerator.h>
+#include <nsIToolkitChromeRegistry.h>
+#include <nsNetUtil.h>
+#include <nsISupportsArray.h>
+#include <nsIMutableArray.h>
#include "HulahopDirectoryProvider.h"
@@ -84,7 +88,27 @@ HulahopDirectoryProvider::GetFiles(const char *aKey,
if (!strcmp(aKey, NS_XPCOM_COMPONENT_DIR_LIST)) {
rv = NS_NewArrayEnumerator(aResult, mComponentsDirs);
- }
+ } else if (!strcmp(aKey, NS_CHROME_MANIFESTS_FILE_LIST)) {
+ nsCOMPtr<nsILocalFile> manifestDir;
+ rv = NS_NewNativeLocalFile (nsDependentCString(DATA_DIR "/chrome"), PR_TRUE,
+ getter_AddRefs (manifestDir));
+ NS_ENSURE_SUCCESS (rv, rv);
+
+ nsCOMPtr<nsISupports> element (do_QueryInterface (manifestDir, &rv));
+ NS_ENSURE_SUCCESS (rv, rv);
+
+ nsCOMPtr<nsIMutableArray> array (do_CreateInstance(NS_ARRAY_CONTRACTID));
+ if(!array)
+ return NS_ERROR_OUT_OF_MEMORY;
+ rv = array->AppendElement (manifestDir, PR_FALSE);
+ NS_ENSURE_SUCCESS (rv, rv);
+
+ rv = array->Enumerate(aResult);
+
+ NS_ENSURE_SUCCESS (rv, rv);
+
+ rv = NS_SUCCESS_AGGREGATE_RESULT;
+ }
return rv;
}
diff --git a/src/Makefile.am b/src/Makefile.am
index 6cd5d59..573239e 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -4,7 +4,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
diff --git a/src/hulahop.cpp b/src/hulahop.cpp
index dbe9497..8d90c6f 100644
--- a/src/hulahop.cpp
+++ b/src/hulahop.cpp
@@ -48,6 +48,8 @@ hulahop_startup()
setup_plugin_path();
+ hulahop_add_components_path(LIB_DIR"/components");
+
nsCOMPtr<nsILocalFile> greDir;
rv = NS_NewNativeLocalFile(nsCString(LIBXUL_DIR), PR_TRUE,
getter_AddRefs(greDir));
@@ -61,8 +63,8 @@ hulahop_startup()
rv = XRE_InitEmbedding(greDir, binDir,
const_cast<HulahopDirectoryProvider *>
(&kDirectoryProvider), nsnull, 0);
- NS_ENSURE_SUCCESS(rv, FALSE);
-
+ NS_ENSURE_SUCCESS(rv, FALSE);
+
XRE_NotifyProfile();
return TRUE;
diff --git a/tests/test-web-view.py b/tests/test-web-view.py
new file mode 100644
index 0000000..0d3574f
--- /dev/null
+++ b/tests/test-web-view.py
@@ -0,0 +1,44 @@
+import os
+
+import gtk
+
+import hulahop
+hulahop.startup(os.path.expanduser('~/.test-hulahop'))
+from hulahop.webview import WebView
+
+def quit(window):
+ hulahop.shutdown()
+ gtk.main_quit()
+
+def entry_activate_cb(entry):
+ from xpcom import components
+ from xpcom.components import interfaces
+
+ cls = components.classes['@sugarlabs.org/add-cert-exception;1']
+ cert_exception = cls.createInstance(interfaces.hulahopAddCertException)
+ cert_exception.showDialog(web_view.dom_window)
+
+window = gtk.Window()
+window.set_default_size(600, 400)
+window.connect("destroy", quit)
+
+vbox = gtk.VBox()
+
+entry = gtk.Entry()
+entry.connect('activate', entry_activate_cb)
+vbox.pack_start(entry, False)
+entry.show()
+
+web_view = WebView()
+web_view.load_uri('https://mozilla.org')
+vbox.pack_start(web_view)
+web_view.show()
+
+window.add(vbox)
+vbox.show()
+
+window.show()
+
+entry.grab_focus()
+
+gtk.main()