Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonas Smedegaard <dr@jones.dk>2008-08-16 09:25:35 (GMT)
committer Jonas Smedegaard <dr@jones.dk>2008-08-16 09:25:35 (GMT)
commita87aa71821beadb0c094ad3a013ffa080b969bf6 (patch)
tree2e3f775ec9f3f3b4937dd168074f4bb21d77ae89
parentae437e7c97695787b075a3b7000b9de48c72a38b (diff)
parent48a764911abd2f6d4906774e5ce197de8e6ee8ff (diff)
Merge commit 'v0.4.3' into upstream
Conflicts: components/.gitignore (dropped - confuses git-buildpackage)
-rw-r--r--components/Makefile.am3
-rw-r--r--components/xulappinfo.js.in106
-rw-r--r--configure.ac16
-rw-r--r--data/prefs.js1
-rw-r--r--python/webview.py19
-rw-r--r--src/HulahopDirectoryProvider.cpp17
-rw-r--r--src/hulahop-web-view.cpp2
-rw-r--r--src/hulahop.cpp2
8 files changed, 160 insertions, 6 deletions
diff --git a/components/Makefile.am b/components/Makefile.am
index 1f4466a..bd6bafc 100644
--- a/components/Makefile.am
+++ b/components/Makefile.am
@@ -6,7 +6,8 @@ xpt_DATA = $(xpt_in_files:.idl=.xpt)
$(LIBXUL_SDK_DIR)/bin/xpidl -m typelib -w -v -I $(LIBXUL_SDK_DIR)/idl -e $@ $<
componentsdir = $(pkglibdir)/components
-components_DATA = hulahopAddCertException.js
+components_DATA = hulahopAddCertException.js \
+ xulappinfo.js
EXTRA_DIST = $(xpt_in_files) $(components_DATA)
diff --git a/components/xulappinfo.js.in b/components/xulappinfo.js.in
new file mode 100644
index 0000000..6a40ce5
--- /dev/null
+++ b/components/xulappinfo.js.in
@@ -0,0 +1,106 @@
+/* FIXME: The values in the block below should be supplied by the activity. */
+const APPLICATION_ID = '{ab9fc198-f515-477b-843f-8fb52810a3e0}'
+const APPLICATION_VENDOR = 'Sugar'
+const APPLICATION_NAME = 'Browser Activity'
+const APPLICATION_VERSION = '@HULAHOP_VERSION@'
+const APPLICATION_BUILD_ID = '@HULAHOP_BUILD_ID@'
+
+const PLATFORM_VERSION = '1.9'
+const PLATFORM_BUILD_ID = '@HULAHOP_BUILD_ID@'
+const OS = '@HULAHOP_HOST_OS@'
+const XPCOMABI = '@HULAHOP_HOST_CPU@' + '-gcc3'
+
+
+const XULAPPINFO_CONTRACTID = "@mozilla.org/xre/app-info;1";
+const XULAPPINFO_CID = Components.ID("{18eec982-b411-4f07-9fca-79d33ee6e4b5}");
+
+const nsIXULAppInfo = Components.interfaces.nsIXULAppInfo;
+const nsIXULRuntime = Components.interfaces.nsIXULRuntime;
+const nsIComponentRegistrar = Components.interfaces.nsIComponentRegistrar;
+const nsIFactory = Components.interfaces.nsIFactory;
+
+function XULAppInfoService()
+{}
+
+XULAppInfoService.prototype.ID = APPLICATION_ID
+XULAppInfoService.prototype.vendor = APPLICATION_VENDOR
+XULAppInfoService.prototype.name = APPLICATION_NAME
+XULAppInfoService.prototype.version = APPLICATION_VERSION
+XULAppInfoService.prototype.appBuildID = APPLICATION_BUILD_ID
+XULAppInfoService.prototype.platformVersion = PLATFORM_VERSION
+XULAppInfoService.prototype.platformBuildID = PLATFORM_BUILD_ID
+XULAppInfoService.prototype.inSafeMode = false
+XULAppInfoService.prototype.logConsoleErrors = true
+XULAppInfoService.prototype.OS = OS
+XULAppInfoService.prototype.XPCOMABI = XPCOMABI
+
+XULAppInfoService.prototype.QueryInterface =
+function appinfo_QueryInterface(iid)
+{
+ if (!iid.equals(nsIXULAppInfo) &&
+ !iid.equals(nsIXULRuntime) &&
+ !iid.equals(nsISupports))
+ {
+ throw Components.results.NS_ERROR_NO_INTERFACE;
+ }
+
+ return this;
+}
+
+var XULAppInfoFactory = new Object();
+
+XULAppInfoFactory.createInstance =
+function(outer, iid)
+{
+ if (outer != null)
+ throw Components.results.NS_ERROR_NO_AGGREGATION;
+
+ if (!iid.equals(nsIXULAppInfo) && !iid.equals(nsISupports))
+ throw Components.results.NS_ERROR_INVALID_ARG;
+
+ return new XULAppInfoService();
+}
+
+
+var XULAppInfoModule = new Object();
+
+XULAppInfoModule.registerSelf =
+function mod_registerSelf(compMgr, fileSpec, location, type)
+{
+ compMgr = compMgr.QueryInterface(nsIComponentRegistrar);
+
+ compMgr.registerFactoryLocation(XULAPPINFO_CID,
+ "XUL AppInfo service",
+ XULAPPINFO_CONTRACTID,
+ fileSpec, location, type);
+}
+
+XULAppInfoModule.unregisterSelf =
+function mod_unregisterSelf(compMgr, fileSpec, location)
+{
+}
+
+XULAppInfoModule.getClassObject =
+function mod_getClassObject(compMgr, cid, iid)
+{
+ if (cid.equals(XULAPPINFO_CID))
+ return XULAppInfoFactory;
+
+ if (!iid.equals(nsIFactory))
+ throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
+
+ throw Components.results.NS_ERROR_NO_INTERFACE;
+}
+
+XULAppInfoModule.canUnload =
+function mod_canUnload(compMgr)
+{
+ return true;
+}
+
+/* entrypoint */
+function NSGetModule(compMgr, fileSpec)
+{
+ return XULAppInfoModule;
+}
+
diff --git a/configure.ac b/configure.ac
index 4b3c2eb..1efd856 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,10 +1,20 @@
-AC_INIT([hulahop],[0.4.1],[],[hulahop])
+m4_define([hulahop_build_id],[2008072400]) # FIXME: when should we update this?
+m4_define([hulahop_version],[0.4.3])
+
+AC_INIT([hulahop],[hulahop_version],[],[hulahop])
+
+AC_SUBST([HULAHOP_VERSION],[hulahop_version])
+AC_SUBST([HULAHOP_BUILD_ID],[hulahop_build_id])
AC_PREREQ([2.59])
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_SRCDIR([configure.ac])
+AC_CANONICAL_HOST
+AC_SUBST([HULAHOP_HOST_CPU],[$host_cpu])
+AC_SUBST([HULAHOP_HOST_OS],[$host_os])
+
AM_INIT_AUTOMAKE([1.9 foreign dist-bzip2 no-dist-gzip])
AC_PROG_LIBTOOL
@@ -36,6 +46,10 @@ AC_SUBST([LIBXUL_LIBS])
AC_SUBST([LIBXUL_DIR])
AC_SUBST([LIBXUL_SDK_DIR])
+AC_CONFIG_FILES([
+components/xulappinfo.js
+])
+
AC_OUTPUT([
Makefile
components/Makefile
diff --git a/data/prefs.js b/data/prefs.js
index 71310b6..a20d414 100644
--- a/data/prefs.js
+++ b/data/prefs.js
@@ -100,3 +100,4 @@ pref("general.useragent.locale", "en-US");
pref("general.useragent.vendor", "OLPC");
pref("general.useragent.vendorSub", "Update.1");
pref("general.useragent.vendorComment", "XO");
+pref("general.useragent.extra.firefox", "Firefox/3.0");
diff --git a/python/webview.py b/python/webview.py
index 6b0af57..b4dc51f 100644
--- a/python/webview.py
+++ b/python/webview.py
@@ -25,6 +25,8 @@ from xpcom import components
from xpcom.components import interfaces
from xpcom.nsError import *
+_views = []
+
class _Chrome:
_com_interfaces_ = interfaces.nsIWebBrowserChrome, \
interfaces.nsIWebBrowserChrome2, \
@@ -41,7 +43,10 @@ class _Chrome:
def provideWindow(self, parent, flags, position_specified,
size_specified, uri, name, features):
- return parent, False
+ if name == "_blank":
+ return parent, False
+ else:
+ return None, False
# nsIWebBrowserChrome
def destroyBrowserWindow(self):
@@ -223,6 +228,13 @@ class WebView(_hulahop.WebView):
self.create_window()
+ self.connect('destroy', self.__destroy_cb)
+
+ _views.append(self)
+
+ def __destroy_cb(self):
+ _views.remove(self)
+
def _notify_title_changed(self):
self.notify('title')
@@ -267,3 +279,8 @@ class WebView(_hulahop.WebView):
web_progress = property(get_web_progress)
web_navigation = property(get_web_navigation)
+def lookup_view(chrome):
+ for view in _views:
+ if view._chrome == chrome:
+ return view
+ return None
diff --git a/src/HulahopDirectoryProvider.cpp b/src/HulahopDirectoryProvider.cpp
index fb21d69..6fc438c 100644
--- a/src/HulahopDirectoryProvider.cpp
+++ b/src/HulahopDirectoryProvider.cpp
@@ -51,7 +51,8 @@ HulahopDirectoryProvider::GetFile(const char *aKey,
{
nsresult rv;
- if (!strcmp(aKey, NS_APP_USER_PROFILE_50_DIR) && mProfilePath) {
+ if ((!strcmp(aKey, NS_APP_USER_PROFILE_50_DIR) ||
+ !strcmp(aKey, NS_APP_USER_PROFILE_LOCAL_50_DIR)) && mProfilePath) {
NS_ADDREF(*aResult = mProfilePath);
return NS_OK;
}
@@ -67,7 +68,19 @@ HulahopDirectoryProvider::GetFile(const char *aKey,
NS_ADDREF(*aResult = file);
return NS_OK;
}
-
+
+ if (!strcmp(aKey, NS_XPCOM_XPTI_REGISTRY_FILE) && mProfilePath) {
+ nsCOMPtr<nsIFile> file;
+ rv = mProfilePath->Clone(getter_AddRefs(file));
+ NS_ENSURE_SUCCESS(rv, NS_ERROR_FAILURE);
+
+ rv = file->AppendNative(nsCString("xpti.dat"));
+ NS_ENSURE_SUCCESS(rv, NS_ERROR_FAILURE);
+
+ NS_ADDREF(*aResult = file);
+ return NS_OK;
+ }
+
if (!strcmp(aKey, NS_APP_PREF_DEFAULTS_50_DIR)) {
nsCOMPtr<nsILocalFile> dataDir;
NS_NewNativeLocalFile(nsCString(DATA_DIR),
diff --git a/src/hulahop-web-view.cpp b/src/hulahop-web-view.cpp
index 00705b9..eee333d 100644
--- a/src/hulahop-web-view.cpp
+++ b/src/hulahop-web-view.cpp
@@ -186,6 +186,8 @@ hulahop_web_view_size_allocate(GtkWidget *widget, GtkAllocation *allocation)
{
HulahopWebView *web_view = HULAHOP_WEB_VIEW(widget);
+ widget->allocation = *allocation;
+
if (GTK_WIDGET_REALIZED(widget)) {
gdk_window_move_resize(widget->window,
allocation->x, allocation->y,
diff --git a/src/hulahop.cpp b/src/hulahop.cpp
index 8d90c6f..3e3b963 100644
--- a/src/hulahop.cpp
+++ b/src/hulahop.cpp
@@ -56,7 +56,7 @@ hulahop_startup()
NS_ENSURE_SUCCESS(rv, FALSE);
nsCOMPtr<nsILocalFile> binDir;
- rv = NS_NewNativeLocalFile(nsCString(LIBXUL_DIR"/components"), PR_TRUE,
+ rv = NS_NewNativeLocalFile(nsCString(LIBXUL_DIR), PR_TRUE,
getter_AddRefs(binDir));
NS_ENSURE_SUCCESS(rv, FALSE);