From 2529daf9db210eb31cd3a35dba774158b6d7cf3c Mon Sep 17 00:00:00 2001 From: Brad Lassey Date: Sun, 27 Jul 2008 08:54:30 -0400 Subject: [PATCH 1/3] Bug 441636 - Add support for mailto uri, use hildon actions as protocol handler lookup r=biesi --- config/autoconf.mk.in | 5 ++ configure.in | 9 +- toolkit/library/Makefile.in | 8 ++ uriloader/exthandler/unix/nsMIMEInfoUnix.cpp | 92 +++++++++++++++++++- uriloader/exthandler/unix/nsMIMEInfoUnix.h | 3 + 5 files changed, 113 insertions(+), 4 deletions(-) diff --git a/config/autoconf.mk.in b/config/autoconf.mk.in index 9bd830c336ff..abe1e4ef2d73 100644 --- a/config/autoconf.mk.in +++ b/config/autoconf.mk.in @@ -627,6 +627,11 @@ MOZ_DISTRIBUTION_ID = @MOZ_DISTRIBUTION_ID@ NS_HILDON = @NS_HILDON@ NS_OSSO = @NS_OSSO@ +NS_HILDONMIME_CFLAGS = @NS_HILDONMIME_CFLAGS@ +NS_HILDONMIME_LIBS = @NS_HILDONMIME_LIBS@ +NS_OSSO_CFLAGS = @NS_OSSO_CFLAGS@ +NS_OSSO_LIBS = @NS_OSSO_LIBS@ + MACOS_SDK_DIR = @MACOS_SDK_DIR@ NEXT_ROOT = @NEXT_ROOT@ diff --git a/configure.in b/configure.in index 1f94a7190c7e..e5fc5fec8232 100644 --- a/configure.in +++ b/configure.in @@ -1582,14 +1582,16 @@ SEAMONKEY_VERSION=`cat $topsrcdir/suite/config/version.txt` AC_DEFINE_UNQUOTED(MOZILLA_VERSION,"$MOZILLA_VERSION") AC_DEFINE_UNQUOTED(MOZILLA_VERSION_U,$MOZILLA_VERSION) -PKG_CHECK_MODULES(LIBHILONMIME,libhildonmime, +PKG_CHECK_MODULES(NS_HILDONMIME,libhildonmime, NS_HILDON=1, NS_HILDON=) if test $NS_HILDON; then AC_DEFINE(NS_HILDON) fi +AC_SUBST(NS_HILDONMIME_CFLAGS) +AC_SUBST(NS_HILDONMIME_LIBS) -PKG_CHECK_MODULES(LIBOSSO,libosso, +PKG_CHECK_MODULES(NS_OSSO,libosso, NS_OSSO=1, NS_OSSO=) @@ -1597,6 +1599,9 @@ if test $NS_OSSO; then AC_DEFINE(NS_OSSO) fi +AC_SUBST(NS_OSSO_CFLAGS) +AC_SUBST(NS_OSSO_LIBS) + dnl ======================================================== dnl System overrides of the defaults for target dnl ======================================================== diff --git a/toolkit/library/Makefile.in b/toolkit/library/Makefile.in index 952ddd3f65f8..193973f3798a 100644 --- a/toolkit/library/Makefile.in +++ b/toolkit/library/Makefile.in @@ -207,6 +207,14 @@ EXTRA_DSO_LDOPTS += \ $(NULL) endif +ifdef NS_HILDON +EXTRA_DSO_LDOPTS += $(NS_HILDONMIME_LIBS) +endif + +ifdef NS_OSSO +EXTRA_DSO_LDOPTS += $(NS_OSSO_LIBS) +endif + ifdef MOZ_ENABLE_DBUS EXTRA_DSO_LDOPTS += $(MOZ_DBUS_GLIB_LIBS) endif diff --git a/uriloader/exthandler/unix/nsMIMEInfoUnix.cpp b/uriloader/exthandler/unix/nsMIMEInfoUnix.cpp index 2b1430666b0a..b21a0727eea3 100644 --- a/uriloader/exthandler/unix/nsMIMEInfoUnix.cpp +++ b/uriloader/exthandler/unix/nsMIMEInfoUnix.cpp @@ -37,14 +37,38 @@ * * ***** END LICENSE BLOCK ***** */ +#ifdef NS_HILDON +#include +#include +#endif + + #include "nsMIMEInfoUnix.h" #include "nsGNOMERegistry.h" #include "nsIGnomeVFSService.h" +#include "nsPrintfCString.h" +#ifdef MOZ_ENABLE_DBUS +#include "nsDBusHandlerApp.h" +#endif + nsresult nsMIMEInfoUnix::LoadUriInternal(nsIURI * aURI) -{ - return nsGNOMERegistry::LoadURL(aURI); +{ + nsresult rv = nsGNOMERegistry::LoadURL(aURI); +#ifdef NS_HILDON + if (NS_FAILED(rv)){ + HildonURIAction *action = hildon_uri_get_default_action(mType.get(), nsnull); + if (action) { + nsCAutoString spec; + aURI->GetAsciiSpec(spec); + if (hildon_uri_open(spec.get(), action, nsnull)) + rv = NS_OK; + hildon_uri_action_unref(action); + } + } +#endif + return rv; } NS_IMETHODIMP @@ -61,6 +85,15 @@ nsMIMEInfoUnix::GetHasDefaultHandler(PRBool *_retval) if (*_retval) return NS_OK; +#ifdef NS_HILDON + HildonURIAction *action = hildon_uri_get_default_action(mType.get(), nsnull); + if (action) { + *_retval = PR_TRUE; + hildon_uri_action_unref(action); + return NS_OK; + } +#endif + // If we didn't find a VFS handler, fallback. return nsMIMEInfoImpl::GetHasDefaultHandler(_retval); } @@ -84,3 +117,58 @@ nsMIMEInfoUnix::LaunchDefaultWithFile(nsIFile *aFile) return LaunchWithIProcess(mDefaultApplication, nativePath); } + +#ifdef NS_HILDON + +NS_IMETHODIMP +nsMIMEInfoUnix::GetPossibleApplicationHandlers(nsIMutableArray ** aPossibleAppHandlers) +{ + if (!mPossibleApplications) { + mPossibleApplications = do_CreateInstance(NS_ARRAY_CONTRACTID); + + if (!mPossibleApplications) + return NS_ERROR_OUT_OF_MEMORY; + + GSList *actions = hildon_uri_get_actions(mType.get(), nsnull); + GSList *actionsPtr = actions; + while (actionsPtr) { + HildonURIAction *action = (HildonURIAction*)actionsPtr->data; + actionsPtr = actionsPtr->next; + nsDBusHandlerApp* app = new nsDBusHandlerApp(); + if (!app){ + hildon_uri_free_actions(actions); + return NS_ERROR_OUT_OF_MEMORY; + } + nsDependentCString method(hildon_uri_action_get_method(action)); + nsDependentCString key(hildon_uri_action_get_service(action)); + nsCString service, objpath, interface; + app->SetMethod(method); + app->SetName(NS_ConvertUTF8toUTF16(key)); + + if (key.FindChar('.', 0) > 0) { + service.Assign(key); + int len = key.Length() + 1; + objpath.Assign(NS_LITERAL_CSTRING("/") + key); + objpath.ReplaceChar('.', '/'); + interface.Assign(key); + } else { + int len = key.Length() + 11; + service.Assign(NS_LITERAL_CSTRING("com.nokia.") + key); + objpath.Assign(NS_LITERAL_CSTRING("/com/nokia/") + key); + interface.Assign(NS_LITERAL_CSTRING("com.nokia.") + key); + } + + app->SetService(service); + app->SetObjectPath(objpath); + app->SetDBusInterface(interface); + + mPossibleApplications->AppendElement(app, PR_FALSE); + } + hildon_uri_free_actions(actions); + } + + *aPossibleAppHandlers = mPossibleApplications; + NS_ADDREF(*aPossibleAppHandlers); + return NS_OK; +} +#endif diff --git a/uriloader/exthandler/unix/nsMIMEInfoUnix.h b/uriloader/exthandler/unix/nsMIMEInfoUnix.h index 09688aa7c953..dbfea65aa98a 100644 --- a/uriloader/exthandler/unix/nsMIMEInfoUnix.h +++ b/uriloader/exthandler/unix/nsMIMEInfoUnix.h @@ -56,6 +56,9 @@ protected: virtual NS_HIDDEN_(nsresult) LoadUriInternal(nsIURI *aURI); virtual NS_HIDDEN_(nsresult) LaunchDefaultWithFile(nsIFile *aFile); +#ifdef NS_HILDON + NS_IMETHOD GetPossibleApplicationHandlers(nsIMutableArray * *aPossibleAppHandlers); +#endif }; #endif // nsMIMEInfoUnix_h_ From 4ab5f71126317c77e89e3a632533632ba14fb764 Mon Sep 17 00:00:00 2001 From: Brad Lassey Date: Sun, 27 Jul 2008 08:56:22 -0400 Subject: [PATCH 2/3] Bug 441636 - Store and retrieve DBus handler apps correctly r=biesi --- uriloader/exthandler/nsHandlerService.js | 51 +++++++++++++++++++++++- 1 file changed, 50 insertions(+), 1 deletion(-) diff --git a/uriloader/exthandler/nsHandlerService.js b/uriloader/exthandler/nsHandlerService.js index 2ba419dd2076..e5c21f04b76c 100755 --- a/uriloader/exthandler/nsHandlerService.js +++ b/uriloader/exthandler/nsHandlerService.js @@ -96,6 +96,17 @@ const NC_PATH = NC_NS + "path"; // nsIWebHandlerApp::uriTemplate const NC_URI_TEMPLATE = NC_NS + "uriTemplate"; +// nsIDBusHandlerApp::service +const NC_SERVICE = NC_NS + "service"; + +// nsIDBusHandlerApp::method +const NC_METHOD = NC_NS + "method"; + +// nsIDBusHandlerApp::objectPath +const NC_OBJPATH = NC_NS + "objectPath"; + +// nsIDBusHandlerApp::dbusInterface +const NC_INTERFACE = NC_NS + "dBusInterface"; Cu.import("resource://gre/modules/XPCOMUtils.jsm"); @@ -566,6 +577,31 @@ HandlerService.prototype = { createInstance(Ci.nsIWebHandlerApp); handlerApp.uriTemplate = uriTemplate; } + else if (this._hasValue(aHandlerAppID, NC_SERVICE)) { + let service = this._getValue(aHandlerAppID, NC_SERVICE); + if (!service) + return null; + + let method = this._getValue(aHandlerAppID, NC_METHOD); + if (!method) + return null; + + let objpath = this._getValue(aHandlerAppID, NC_OBJPATH); + if (!objpath) + return null; + + let interface = this._getValue(aHandlerAppID, NC_INTERFACE); + if (!interface) + return null; + + handlerApp = Cc["@mozilla.org/uriloader/dbus-handler-app;1"]. + createInstance(Ci.nsIDBusHandlerApp); + handlerApp.service = service; + handlerApp.method = method; + handlerApp.objectPath = objpath; + handlerApp.dBusInterface = interface; + + } else return null; @@ -771,15 +807,28 @@ HandlerService.prototype = { if (aHandlerApp instanceof Ci.nsILocalHandlerApp) { this._setLiteral(aHandlerAppID, NC_PATH, aHandlerApp.executable.path); this._removeTarget(aHandlerAppID, NC_URI_TEMPLATE); + this._removeTarget(aHandlerAppID, NC_METHOD); + this._removeTarget(aHandlerAppID, NC_SERVICE); + this._removeTarget(aHandlerAppID, NC_OBJPATH); + this._removeTarget(aHandlerAppID, NC_INTERFACE); } else if(aHandlerApp instanceof Ci.nsIWebHandlerApp){ aHandlerApp.QueryInterface(Ci.nsIWebHandlerApp); this._setLiteral(aHandlerAppID, NC_URI_TEMPLATE, aHandlerApp.uriTemplate); this._removeTarget(aHandlerAppID, NC_PATH); + this._removeTarget(aHandlerAppID, NC_METHOD); + this._removeTarget(aHandlerAppID, NC_SERVICE); + this._removeTarget(aHandlerAppID, NC_OBJPATH); + this._removeTarget(aHandlerAppID, NC_INTERFACE); } else if(aHandlerApp instanceof Ci.nsIDBusHandlerApp){ aHandlerApp.QueryInterface(Ci.nsIDBusHandlerApp); - + this._setLiteral(aHandlerAppID, NC_SERVICE, aHandlerApp.service); + this._setLiteral(aHandlerAppID, NC_METHOD, aHandlerApp.method); + this._setLiteral(aHandlerAppID, NC_OBJPATH, aHandlerApp.objectPath); + this._setLiteral(aHandlerAppID, NC_INTERFACE, aHandlerApp.dBusInterface); + this._removeTarget(aHandlerAppID, NC_PATH); + this._removeTarget(aHandlerAppID, NC_URI_TEMPLATE); } else { throw "unknown handler type"; From 142e6e0722b7dc3ab1dea95269cd60c6423f6e79 Mon Sep 17 00:00:00 2001 From: Brad Lassey Date: Sun, 27 Jul 2008 08:58:48 -0400 Subject: [PATCH 3/3] Bug 445918 - Setting xr version in deb package to gre version + buildid r=ted --- xulrunner/installer/Makefile.in | 14 +++++++++++++- xulrunner/installer/debian/changelog.in | 3 ++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/xulrunner/installer/Makefile.in b/xulrunner/installer/Makefile.in index 3613cbf76541..7d5716fcc19a 100644 --- a/xulrunner/installer/Makefile.in +++ b/xulrunner/installer/Makefile.in @@ -130,12 +130,24 @@ install:: $(pkg_config_files) GARBAGE += $(MOZILLA_VERSION).system.conf $(pkg_config_files) +GARBAGE += debian/changelog DEBDESTDIR=debian/$(MOZ_BUILD_APP) +GRE_MILESTONE = $(shell $(PYTHON) $(topsrcdir)/config/printconfigsetting.py $(LIBXUL_DIST)/bin/platform.ini Build Milestone) +GRE_BUILDID = $(shell $(PYTHON) $(topsrcdir)/config/printconfigsetting.py $(LIBXUL_DIST)/bin/platform.ini Build BuildID) +MOZ_DEB_TIMESTAMP = "$(shell date +"%a, %d %b %Y %T %z" )" + +DEFINES += -DGRE_MILESTONE=$(GRE_MILESTONE) -DGRE_BUILDID=$(GRE_BUILDID) -DMOZ_DEB_TIMESTAMP=$(MOZ_DEB_TIMESTAMP) + ifeq ($(OS_TARGET),Linux) -deb: +debian/changelog: $(srcdir)/debian/changelog.in $(LIBXUL_DIST)/bin/platform.ini + mkdir -p debian + $(PYTHON) $(topsrcdir)/config/Preprocessor.py \ + $(AUTOMATION_PPARGS) $(DEFINES) $(ACDEFINES) $< > $@ + +deb: debian/changelog $(NSINSTALL) $(topsrcdir)/$(MOZ_BUILD_APP)/installer/debian . rm -rf $(DEBDESTDIR)/usr/local/* $(NSINSTALL) -D $(DEBDESTDIR)/usr/local diff --git a/xulrunner/installer/debian/changelog.in b/xulrunner/installer/debian/changelog.in index ebc9eae88147..afc5f956cecf 100644 --- a/xulrunner/installer/debian/changelog.in +++ b/xulrunner/installer/debian/changelog.in @@ -1,4 +1,5 @@ -xulrunner (@MOZ_APP_VERSION@) unstable; urgency=low +#filter substitution +xulrunner (@GRE_MILESTONE@-@GRE_BUILDID@) unstable; urgency=low * Mozilla Nightly (Closes: #nnnn)