Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[nemo][xulrunner] Use libcontentaction for uri scheme handling. JB#47892
  • Loading branch information
rainemak committed Feb 4, 2020
1 parent ef1e408 commit a377b05
Show file tree
Hide file tree
Showing 3 changed files with 139 additions and 0 deletions.
8 changes: 8 additions & 0 deletions embedding/embedlite/embedding.js
Expand Up @@ -146,6 +146,14 @@ pref("offline-apps.quota.warn", 1024); // kilobytes
// cache compression turned off for now - see bug #715198
pref("browser.cache.compression_level", 0);

// Default action for unlisted external protocol handlers
pref("network.protocol-handler.external-default", true); // OK to load
pref("network.protocol-handler.warn-external-default", false); // Do not warn

// This pref controls the default settings. Per protocol settings can be used
// to override this value.
pref("network.protocol-handler.expose-all", true);

/* disable some protocol warnings */
pref("network.protocol-handler.warn-external.tel", false);
pref("network.protocol-handler.warn-external.sms", false);
Expand Down
128 changes: 128 additions & 0 deletions rpm/0018-Use-libcontentaction-for-custom-schem.patch
@@ -0,0 +1,128 @@
From bbfe07e55e96b302c01842552d275853614ef9ad Mon Sep 17 00:00:00 2001
From: Raine Makelainen <raine.makelainen@jolla.com>
Date: Fri, 31 Jan 2020 11:09:02 +0000
Subject: [PATCH 18/18] [nemo][xulrunner] Use libcontentaction for custom
scheme uri handling. JB#47892

Signed-off-by: Raine Makelainen <raine.makelainen@jolla.com>
---
configure.in | 8 +++++---
uriloader/exthandler/nsContentHandlerApp.h | 5 +++--
uriloader/exthandler/unix/nsMIMEInfoUnix.cpp | 8 ++++----
uriloader/exthandler/unix/nsOSHelperAppService.cpp | 2 +-
xpcom/io/moz.build | 2 ++
xpcom/io/nsLocalFileUnix.cpp | 2 +-
8 files changed, 16 insertions(+), 11 deletions(-)

diff --git a/configure.in b/configure.in
index c98b3171c25e..872b5b2cb347 100644
--- a/configure.in
+++ b/configure.in
@@ -4518,11 +4518,13 @@ then
fi

MOZ_ENABLE_CONTENTACTION=
- PKG_CHECK_MODULES(LIBCONTENTACTION, contentaction-0.1, _LIB_FOUND=1, _LIB_FOUND=)
+ PKG_CHECK_MODULES(LIBCONTENTACTION, contentaction5,
+ MOZ_ENABLE_CONTENTACTION=1,
+ MOZ_ENABLE_CONTENTACTION=)
if test "$MOZ_ENABLE_CONTENTACTION"; then
MOZ_ENABLE_CONTENTACTION=1
- MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $_CONTENTACTION_CFLAGS"
- MOZ_QT_LIBS="$MOZ_QT_LIBS $_CONTENTACTION_LIBS"
+ MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $LIBCONTENTACTION_CFLAGS"
+ MOZ_QT_LIBS="$MOZ_QT_LIBS $LIBCONTENTACTION_LIBS"
AC_DEFINE(MOZ_ENABLE_CONTENTACTION)
AC_SUBST(MOZ_ENABLE_CONTENTACTION)
fi
diff --git a/uriloader/exthandler/nsContentHandlerApp.h b/uriloader/exthandler/nsContentHandlerApp.h
index 8ace9a2cd4d0..983faacc4d96 100644
--- a/uriloader/exthandler/nsContentHandlerApp.h
+++ b/uriloader/exthandler/nsContentHandlerApp.h
@@ -7,7 +7,7 @@
#ifndef __nsContentHandlerAppImpl_h__
#define __nsContentHandlerAppImpl_h__

-#include <contentaction/contentaction.h>
+#include <contentaction5/contentaction.h>
#include "nsString.h"
#include "nsIMIMEInfo.h"

@@ -18,9 +18,10 @@ public:
NS_DECL_NSIHANDLERAPP

nsContentHandlerApp(nsString aName, nsCString aType, ContentAction::Action& aAction);
+
+private:
virtual ~nsContentHandlerApp() { }

-protected:
nsString mName;
nsCString mType;
nsString mDetailedDescription;
diff --git a/uriloader/exthandler/unix/nsMIMEInfoUnix.cpp b/uriloader/exthandler/unix/nsMIMEInfoUnix.cpp
index caac2ff26694..be1b9e99b88b 100644
--- a/uriloader/exthandler/unix/nsMIMEInfoUnix.cpp
+++ b/uriloader/exthandler/unix/nsMIMEInfoUnix.cpp
@@ -5,8 +5,8 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

#ifdef MOZ_WIDGET_QT
-#if (MOZ_ENABLE_CONTENTACTION)
-#include <contentaction/contentaction.h>
+#if defined(MOZ_ENABLE_CONTENTACTION)
+#include <contentaction5/contentaction.h>
#include "nsContentHandlerApp.h"
#endif
#endif
@@ -92,9 +92,9 @@ nsMIMEInfoUnix::LaunchDefaultWithFile(nsIFile *aFile)
aFile->GetNativePath(nativePath);

#if defined(MOZ_ENABLE_CONTENTACTION)
- QUrl uri = QUrl::fromLocalFile(QString::fromUtf8(nativePath.get()));
+ QUrl localFileUri = QUrl::fromLocalFile(QString::fromUtf8(nativePath.get()));
ContentAction::Action action =
- ContentAction::Action::defaultActionForFile(uri, QString(mSchemeOrType.get()));
+ ContentAction::Action::defaultActionForFile(localFileUri, QString(mSchemeOrType.get()));
if (action.isValid()) {
action.trigger();
return NS_OK;
diff --git a/uriloader/exthandler/unix/nsOSHelperAppService.cpp b/uriloader/exthandler/unix/nsOSHelperAppService.cpp
index 84e1cf5b040b..3fda2378ee55 100644
--- a/uriloader/exthandler/unix/nsOSHelperAppService.cpp
+++ b/uriloader/exthandler/unix/nsOSHelperAppService.cpp
@@ -8,7 +8,7 @@
#include <sys/stat.h>

#if defined(MOZ_ENABLE_CONTENTACTION)
-#include <contentaction/contentaction.h>
+#include <contentaction5/contentaction.h>
#include <QString>
#endif

diff --git a/xpcom/io/moz.build b/xpcom/io/moz.build
index 45732e4cbf2f..c6cc71ee793e 100644
--- a/xpcom/io/moz.build
+++ b/xpcom/io/moz.build
@@ -135,3 +135,5 @@ if CONFIG['OS_ARCH'] == 'Linux' and 'lib64' in CONFIG['libdir']:
DEFINES['HAVE_USR_LIB64_DIR'] = True

LOCAL_INCLUDES += ['!..']
+
+CXXFLAGS += CONFIG['TK_CFLAGS']
diff --git a/xpcom/io/nsLocalFileUnix.cpp b/xpcom/io/nsLocalFileUnix.cpp
index 74c5bf072b71..d88ede495b7a 100644
--- a/xpcom/io/nsLocalFileUnix.cpp
+++ b/xpcom/io/nsLocalFileUnix.cpp
@@ -71,7 +71,7 @@ static nsresult MacErrorMapper(OSErr inErr);
#endif

#ifdef MOZ_ENABLE_CONTENTACTION
-#include <contentaction/contentaction.h>
+#include <contentaction5/contentaction.h>
#endif

#include "nsNativeCharsetUtils.h"
--
2.24.1

3 changes: 3 additions & 0 deletions rpm/xulrunner-qt5.spec
Expand Up @@ -60,6 +60,7 @@ Patch14: 0014-Embedlite-doesn-t-have-prompter-implementation.patch
Patch15: 0015-Disable-SiteSpecificUserAgent.js-from-the-build.-Con.patch
Patch16: 0016-Cleanup-build-configuration.-Fixes-JB-44612.patch
Patch17: 0017-Make-gc-stats-work-with-gcc8.patch
Patch18: 0018-Use-libcontentaction-for-custom-schem.patch

BuildRequires: pkgconfig(Qt5Quick)
BuildRequires: pkgconfig(Qt5Network)
Expand All @@ -80,6 +81,7 @@ BuildRequires: pkgconfig(gstreamer-1.0)
BuildRequires: pkgconfig(gstreamer-app-1.0)
BuildRequires: pkgconfig(gstreamer-plugins-base-1.0)
BuildRequires: pkgconfig(Qt5Positioning)
BuildRequires: pkgconfig(contentaction5)
BuildRequires: qt5-qttools
BuildRequires: qt5-default
BuildRequires: autoconf213
Expand Down Expand Up @@ -165,6 +167,7 @@ Tests and misc files for xulrunner.
%patch15 -p1
%patch16 -p1
%patch17 -p1
%patch18 -p1

mkdir -p "%BUILD_DIR"
cp -rf "%BASE_CONFIG" "%BUILD_DIR"/mozconfig
Expand Down

0 comments on commit a377b05

Please sign in to comment.