Merge lp:~ted/url-dispatcher/devel into lp:url-dispatcher/16.10

Proposed by Ted Gould
Status: Merged
Approved by: Ted Gould
Approved revision: 107
Merged at revision: 94
Proposed branch: lp:~ted/url-dispatcher/devel
Merge into: lp:url-dispatcher/16.10
Diff against target: 2187 lines (+1247/-130)
50 files modified
CMakeLists.txt (+12/-4)
data/CMakeLists.txt (+10/-0)
data/bad-url.qml (+42/-0)
data/url-dispatcher-update-user.conf.in (+1/-1)
data/url-dispatcher.conf.in (+4/-0)
debian/apparmor/url-dispatcher-bad-url-helper (+15/-0)
debian/changelog (+25/-2)
debian/control (+24/-5)
debian/rules (+4/-0)
debian/url-dispatcher-tools-gui.install (+2/-0)
debian/url-dispatcher.install (+3/-0)
gui/CMakeLists.txt (+13/-0)
gui/url-dispatcher-gui.desktop.in (+6/-0)
gui/url-dispatcher-gui.qml (+59/-0)
gui/url-dispatcher-gui.svg (+129/-0)
po/CMakeLists.txt (+39/-0)
po/POTFILES.in (+1/-0)
po/genpotfiles.sh (+6/-0)
service/CMakeLists.txt (+11/-13)
service/bad-url/CMakeLists.txt (+14/-0)
service/bad-url/exec-tool.c (+42/-0)
service/dispatcher.c (+141/-6)
service/dispatcher.h (+2/-1)
service/overlay-tracker-iface.h (+1/-0)
service/overlay-tracker-mir.cpp (+70/-39)
service/overlay-tracker-mir.h (+22/-8)
service/overlay-tracker.cpp (+9/-0)
service/overlay-tracker.h (+1/-0)
service/scope-checker-facade.h (+27/-0)
service/scope-checker.cpp (+114/-0)
service/scope-checker.h (+29/-0)
service/service.c (+9/-1)
service/url-overlay/CMakeLists.txt (+14/-0)
tests/CMakeLists.txt (+3/-0)
tests/app-id-test.cc (+27/-29)
tests/apparmor-mock.c (+36/-0)
tests/apparmor-mock.h (+20/-0)
tests/click-data/manifests/com.test.good.manifest (+1/-1)
tests/click-data/manifests/com.test.multiple.manifest (+3/-3)
tests/dispatcher-test.cc (+84/-1)
tests/overlay-tracker-mock.h (+6/-0)
tests/overlay-tracker-test.cpp (+41/-12)
tests/scope-mock.h (+95/-0)
tests/service-test.cc (+8/-3)
tests/test-config.h.in (+1/-1)
tests/ual-link-farm/com.test.good_app1_1.2.3.desktop (+1/-0)
tests/ual-link-farm/com.test.multiple_app-first_1.2.3.desktop (+1/-0)
tests/xdg-cache/libertine-container/container-id/rootfs/usr/share/applications/org.canonical.app1.desktop (+4/-0)
tests/xdg-data/applications/foo-bar.desktop (+1/-0)
tests/xdg-data/libertine/ContainersConfig.json (+14/-0)
To merge this branch: bzr merge lp:~ted/url-dispatcher/devel
Reviewer Review Type Date Requested Status
unity-api-1-bot continuous-integration Needs Fixing
Unity API Team Pending
Review via email: mp+306286@code.launchpad.net

This proposal supersedes a proposal from 2016-09-20.

Commit message

Pull all the branches together for merge conflicts

Description of the change

The merge conflicts were too difficult to make easy sense of, so pulled everything into a single branch that we can then land. This is the combination of a whole host of branches.

To post a comment you must log in.
Revision history for this message
unity-api-1-bot (unity-api-1-bot) wrote :
review: Needs Fixing (continuous-integration)
lp:~ted/url-dispatcher/devel updated
105. By Ted Gould

Merge issues from trunk

Revision history for this message
unity-api-1-bot (unity-api-1-bot) wrote :
review: Needs Fixing (continuous-integration)
lp:~ted/url-dispatcher/devel updated
106. By Ted Gould

Forgot the container config

Revision history for this message
unity-api-1-bot (unity-api-1-bot) wrote :

FAILED: Continuous integration, rev:106
https://jenkins.canonical.com/unity-api-1/job/lp-url-dispatcher-ci/21/
Executed test runs:
    FAILURE: https://jenkins.canonical.com/unity-api-1/job/build/703/console
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-0-fetch/709
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=vivid+overlay/517
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=vivid+overlay/517/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=xenial+overlay/517
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=xenial+overlay/517/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=yakkety/517
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=yakkety/517/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=vivid+overlay/517
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=vivid+overlay/517/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=xenial+overlay/517
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=xenial+overlay/517/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=yakkety/517
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=yakkety/517/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=vivid+overlay/517
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=vivid+overlay/517/artifact/output/*zip*/output.zip
    FAILURE: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=xenial+overlay/517/console
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=yakkety/517
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=yakkety/517/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://jenkins.canonical.com/unity-api-1/job/lp-url-dispatcher-ci/21/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
unity-api-1-bot (unity-api-1-bot) wrote :

FAILED: Continuous integration, rev:106
https://jenkins.canonical.com/unity-api-1/job/lp-url-dispatcher-ci/22/
Executed test runs:
    FAILURE: https://jenkins.canonical.com/unity-api-1/job/build/704/console
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-0-fetch/710
    FAILURE: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=vivid+overlay/518/console
    FAILURE: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=xenial+overlay/518/console
    FAILURE: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=yakkety/518/console
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=vivid+overlay/518
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=vivid+overlay/518/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=xenial+overlay/518
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=xenial+overlay/518/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=yakkety/518
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=yakkety/518/artifact/output/*zip*/output.zip
    FAILURE: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=vivid+overlay/518/console
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=xenial+overlay/518
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=xenial+overlay/518/artifact/output/*zip*/output.zip
    FAILURE: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=yakkety/518/console

Click here to trigger a rebuild:
https://jenkins.canonical.com/unity-api-1/job/lp-url-dispatcher-ci/22/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
unity-api-1-bot (unity-api-1-bot) wrote :

FAILED: Continuous integration, rev:106
https://jenkins.canonical.com/unity-api-1/job/lp-url-dispatcher-ci/23/
Executed test runs:
    FAILURE: https://jenkins.canonical.com/unity-api-1/job/build/713/console
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-0-fetch/719
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=vivid+overlay/527
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=vivid+overlay/527/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=xenial+overlay/527
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=xenial+overlay/527/artifact/output/*zip*/output.zip
    FAILURE: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=yakkety/527/console
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=vivid+overlay/527
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=vivid+overlay/527/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=xenial+overlay/527
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=xenial+overlay/527/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=yakkety/527
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=yakkety/527/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=vivid+overlay/527
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=vivid+overlay/527/artifact/output/*zip*/output.zip
    FAILURE: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=xenial+overlay/527/console
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=yakkety/527
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=yakkety/527/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://jenkins.canonical.com/unity-api-1/job/lp-url-dispatcher-ci/23/rebuild

review: Needs Fixing (continuous-integration)
lp:~ted/url-dispatcher/devel updated
107. By Ted Gould

Fixes from review

Revision history for this message
unity-api-1-bot (unity-api-1-bot) wrote :

FAILED: Continuous integration, rev:107
https://jenkins.canonical.com/unity-api-1/job/lp-url-dispatcher-ci/27/
Executed test runs:
    FAILURE: https://jenkins.canonical.com/unity-api-1/job/build/989/console
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-0-fetch/996
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=vivid+overlay/793
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=vivid+overlay/793/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=xenial+overlay/793
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=xenial+overlay/793/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=yakkety/793
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=yakkety/793/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=vivid+overlay/793
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=vivid+overlay/793/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=xenial+overlay/793
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=xenial+overlay/793/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=yakkety/793
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=yakkety/793/artifact/output/*zip*/output.zip
    FAILURE: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=vivid+overlay/793/console
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=xenial+overlay/793
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=xenial+overlay/793/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=yakkety/793
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=yakkety/793/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://jenkins.canonical.com/unity-api-1/job/lp-url-dispatcher-ci/27/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
Ted Gould (ted) wrote :

Marking as approved as the subbranches are and this is just an integration branch.

lp:~ted/url-dispatcher/devel updated
108. By Ted Gould

Be more specific so that the packages don't conflict

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'CMakeLists.txt'
2--- CMakeLists.txt 2015-06-11 21:38:13 +0000
3+++ CMakeLists.txt 2016-11-07 16:32:23 +0000
4@@ -3,7 +3,7 @@
5
6 string(TOLOWER "${CMAKE_BUILD_TYPE}" cmake_build_type_lower) # Build types should always be lowercase but sometimes they are not.
7
8-if (${cmake_build_type_lower} STREQUAL debug)
9+if ("${cmake_build_type_lower}" STREQUAL "debug")
10 option (werror "Treat warnings as errors." FALSE)
11 else()
12 option (werror "Treat warnings as errors." TRUE)
13@@ -30,7 +30,7 @@
14 include(UseConstantBuilder)
15
16 # Workaround for libexecdir on debian
17-if (EXISTS "/etc/debian_version")
18+if (EXISTS "/etc/debian_version")
19 set(CMAKE_INSTALL_LIBEXECDIR ${CMAKE_INSTALL_LIBDIR})
20 set(CMAKE_INSTALL_FULL_LIBEXECDIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBEXECDIR}")
21 endif()
22@@ -42,7 +42,7 @@
23 # Since gdbus-codegen does not produce warning-free code
24 # and we use -Werror, only enable these warnings for debug
25 # builds. Drop this once the issue has been fixed and landed.
26-if (${cmake_build_type_lower} STREQUAL debug)
27+if ("${cmake_build_type_lower}" STREQUAL debug)
28 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wpedantic")# -Wextra")
29 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wpedantic -Wextra")
30 endif()
31@@ -50,7 +50,7 @@
32 if (${werror})
33 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror")
34 set(CMAKE_C_FLAGS "${CMAKE_CXX_FLAGS} -Werror")
35-endif()
36+endif()
37
38 pkg_check_modules(UBUNTU_APP_LAUNCH REQUIRED ubuntu-app-launch-2>=0.5)
39 include_directories(${UBUNTU_APP_LAUNCH_INCLUDE_DIRS})
40@@ -79,6 +79,12 @@
41 pkg_check_modules(CLICK REQUIRED click-0.4)
42 include_directories(${CLICK_INCLUDE_DIRS})
43
44+pkg_check_modules(SCOPES REQUIRED libunity-scopes)
45+include_directories(${SCOPES_INCLUDE_DIRS})
46+
47+pkg_check_modules(APPARMOR REQUIRED libapparmor)
48+include_directories(${APPARMOR_INCLUDE_DIRS})
49+
50 if(${LOCAL_INSTALL})
51 set(DBUSSERVICEDIR "${CMAKE_INSTALL_DATADIR}/dbus-1/services/")
52 else()
53@@ -103,6 +109,7 @@
54 add_subdirectory(service)
55 add_subdirectory(liburl-dispatcher)
56 add_subdirectory(tools)
57+add_subdirectory(gui)
58
59 # testing & coverage
60 if (${enable_tests})
61@@ -116,3 +123,4 @@
62 add_subdirectory(tests)
63 endif ()
64
65+add_subdirectory(po)
66
67=== modified file 'data/CMakeLists.txt'
68--- data/CMakeLists.txt 2015-11-06 22:59:11 +0000
69+++ data/CMakeLists.txt 2016-11-07 16:32:23 +0000
70@@ -102,3 +102,13 @@
71 @ONLY
72 )
73
74+###########################
75+# QML
76+###########################
77+
78+install(
79+FILES
80+bad-url.qml
81+DESTINATION ${datadir}/url-dispatcher
82+)
83+
84
85=== added file 'data/bad-url.qml'
86--- data/bad-url.qml 1970-01-01 00:00:00 +0000
87+++ data/bad-url.qml 2016-11-07 16:32:23 +0000
88@@ -0,0 +1,42 @@
89+/*
90+ * Copyright © 2015 Canonical Ltd.
91+ *
92+ * This program is free software; you can redistribute it and/or modify
93+ * it under the terms of the GNU General Public License as published by
94+ * the Free Software Foundation; version 3.
95+ *
96+ * This program is distributed in the hope that it will be useful,
97+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
98+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
99+ * GNU General Public License for more details.
100+ *
101+ * You should have received a copy of the GNU General Public License
102+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
103+ */
104+
105+import QtQuick 2.0
106+import Ubuntu.Components 1.0
107+import Ubuntu.Components.Popups 1.0
108+
109+MainView {
110+ applicationName: "com.canonical.url-dispatcher.bad-url-prompt"
111+ automaticOrientation: true
112+ backgroundColor: "transparent"
113+ anchors.fill: parent
114+
115+ Component {
116+ id: dialog
117+ Dialog {
118+ title: i18n.tr("Unrecognized Address")
119+ text: i18n.tr("Ubuntu can't open addresses of type “%1”.").arg(Qt.application.arguments[2].split(':')[0])
120+
121+ Button {
122+ text: i18n.tr("OK")
123+ color: UbuntuColors.orange
124+ onClicked: Qt.quit()
125+ }
126+ }
127+ }
128+
129+ Component.onCompleted: PopupUtils.open(dialog)
130+}
131
132=== modified file 'data/url-dispatcher-update-user.conf.in'
133--- data/url-dispatcher-update-user.conf.in 2015-09-04 19:53:45 +0000
134+++ data/url-dispatcher-update-user.conf.in 2016-11-07 16:32:23 +0000
135@@ -13,4 +13,4 @@
136 fi
137 end script
138
139-exec @pkglibexecdir@/update-directory "~/.config/url-dispatcher/urls/*.url-dispatcher"
140+exec @pkglibexecdir@/update-directory "${HOME}/.config/url-dispatcher/urls/"
141
142=== modified file 'data/url-dispatcher.conf.in'
143--- data/url-dispatcher.conf.in 2015-11-06 23:05:12 +0000
144+++ data/url-dispatcher.conf.in 2016-11-07 16:32:23 +0000
145@@ -7,6 +7,7 @@
146 respawn
147
148 emits application-start
149+emits untrusted-helper-type-end
150
151 script
152 @pkglibexecdir@/url-dispatcher
153@@ -18,3 +19,6 @@
154 fi
155 end script
156
157+post-stop script
158+ initctl emit untrusted-helper-type-end HELPER_TYPE=url-overlay
159+end script
160
161=== added directory 'debian/apparmor'
162=== added file 'debian/apparmor/url-dispatcher-bad-url-helper'
163--- debian/apparmor/url-dispatcher-bad-url-helper 1970-01-01 00:00:00 +0000
164+++ debian/apparmor/url-dispatcher-bad-url-helper 2016-11-07 16:32:23 +0000
165@@ -0,0 +1,15 @@
166+# vim:syntax=apparmor
167+#include <tunables/global>
168+
169+# Mostly unconfined. Don't allow capability or any mount rules. Also ensure that
170+# exec inherits from this profile
171+profile url-dispatcher-bad-url-helper (attach_disconnected) {
172+ network,
173+ / rwkl,
174+ /** rwlkm,
175+ /** pix,
176+ dbus,
177+ signal,
178+ ptrace,
179+ unix,
180+}
181
182=== modified file 'debian/changelog'
183--- debian/changelog 2016-08-16 15:20:27 +0000
184+++ debian/changelog 2016-11-07 16:32:23 +0000
185@@ -1,3 +1,26 @@
186+url-dispatcher (0.1+16.04.20151110-0ubuntu2) UNRELEASED; urgency=medium
187+
188+ [ Florian Boucault ]
189+ * Crossbuilding Fixes
190+
191+ [ Larry Price ]
192+ * App ID should allow package names with dots. (LP: #1591342) (LP: #1606498)
193+
194+ [ Ted Gould ]
195+ * Check versions of appid:// urls to reduce the number of invalid appids
196+ we send to UAL (LP: #1352656)
197+ * Scope testing for the scope:// URL and overlays that should be over
198+ the dash
199+ * Protect the dash from getting NULL urls (LP: #1476257)
200+ * Make sure URL Overlays are shutdown on exit
201+ * Remove the wildcard that is confusing the update script (LP: #1461496)
202+ * Not using a message that isn't set properly (LP: #1608009)
203+ * Fixing tests to adjust for UAL changes
204+ * Add a small GUI helper tool for testing
205+ * Show error dialog over apps that use Bad URLs (LP: #1370008)
206+
207+ -- Ted Gould <ted@ubuntu.com> Tue, 20 Sep 2016 16:17:26 -0500
208+
209 url-dispatcher (0.1+16.10.20160816.1-0ubuntu1) yakkety; urgency=medium
210
211 * No chnage rebuild for UAL migration
212@@ -5,9 +28,9 @@
213 -- Ted Gould <ted@gould.cx> Tue, 16 Aug 2016 15:20:27 +0000
214
215 url-dispatcher (0.1+16.04.20151110-0ubuntu2) xenial; urgency=high
216-
217+
218 * No change rebuild for s390x.
219-
220+
221 -- Dimitri John Ledkov <xnox@ubuntu.com> Fri, 11 Dec 2015 01:30:51 +0000
222
223 url-dispatcher (0.1+16.04.20151110-0ubuntu1) xenial; urgency=medium
224
225=== modified file 'debian/control'
226--- debian/control 2015-06-08 15:27:58 +0000
227+++ debian/control 2016-11-07 16:32:23 +0000
228@@ -7,8 +7,10 @@
229 dbus-test-runner,
230 debhelper (>= 9),
231 dh-autoreconf,
232+ dh-apparmor,
233 gtester2xunit,
234 intltool,
235+ libapparmor-dev,
236 libclick-0.4-dev,
237 libdbus-1-dev,
238 libdbustest1-dev (>= 14.04.0),
239@@ -17,11 +19,12 @@
240 libgtest-dev,
241 libsqlite3-dev,
242 libubuntu-app-launch2-dev (>= 0.5),
243- python3,
244- python3-dbusmock,
245- python3-fixtures,
246- python3-nose,
247- python3-testtools,
248+ libunity-scopes-dev,
249+ python3:any,
250+ python3-dbusmock <!cross>,
251+ python3-fixtures <!cross>,
252+ python3-nose <!cross>,
253+ python3-testtools <!cross>,
254 sqlite3,
255 upstart,
256 Standards-Version: 3.9.4
257@@ -38,6 +41,9 @@
258 Pre-Depends: ${misc:Pre-Depends},
259 Depends: ${misc:Depends},
260 ${shlibs:Depends},
261+# For the bad URL dialog
262+ qtchooser,
263+ qtdeclarative5-ubuntu-ui-toolkit-plugin,
264 Description: service to allow sending of URLs and get handlers started
265 Allows applications to request a URL to be opened and handled by another
266 process without seeing the list of other applications on the system or
267@@ -57,6 +63,19 @@
268 .
269 This package provides tools for working with the URL Dispatcher.
270
271+Package: url-dispatcher-tools-gui
272+Architecture: any
273+Depends: url-dispatcher (= ${binary:Version}),
274+ ${misc:Depends},
275+ ${shlibs:Depends},
276+ qtchooser,
277+Description: GUI tools for working with the URL Dispatcher.
278+ Allows applications to request a URL to be opened and handled by another
279+ process without seeing the list of other applications on the system or
280+ starting them inside its own Application Confinement.
281+ .
282+ This package provides GUI tools for working with the URL Dispatcher.
283+
284 Package: liburl-dispatcher1
285 Section: libs
286 Architecture: any
287
288=== modified file 'debian/rules'
289--- debian/rules 2015-05-20 16:22:44 +0000
290+++ debian/rules 2016-11-07 16:32:23 +0000
291@@ -3,6 +3,9 @@
292 export DPKG_GENSYMBOLS_CHECK_LEVEL = 4
293 export G_MESSAGES_DEBUG=all
294 export URL_DISPATCHER_DISABLE_RECOVERABLE_ERROR=1
295+ifneq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE))
296+export DEB_BUILD_PROFILES := cross
297+endif
298
299 %:
300 dh $@ --fail-missing --with click
301@@ -12,6 +15,7 @@
302 install -m 644 debian/source_url-dispatcher.py debian/url-dispatcher/usr/share/apport/package-hooks/
303 mkdir -p debian/url-dispatcher/etc/apport/crashdb.conf.d/
304 install -m 644 debian/url-dispatcher-crashdb.conf debian/url-dispatcher/etc/apport/crashdb.conf.d/
305+ dh_apparmor --profile-name=url-dispatcher-bad-url-helper -p url-dispatcher
306 dh_install --fail-missing
307
308 override_dh_click:
309
310=== added file 'debian/url-dispatcher-tools-gui.install'
311--- debian/url-dispatcher-tools-gui.install 1970-01-01 00:00:00 +0000
312+++ debian/url-dispatcher-tools-gui.install 2016-11-07 16:32:23 +0000
313@@ -0,0 +1,2 @@
314+/usr/share/applications/
315+/usr/share/url-dispatcher/gui/
316
317=== modified file 'debian/url-dispatcher.install'
318--- debian/url-dispatcher.install 2015-06-12 16:00:37 +0000
319+++ debian/url-dispatcher.install 2016-11-07 16:32:23 +0000
320@@ -1,5 +1,8 @@
321 usr/lib/*/url-dispatcher
322 usr/lib/*/ubuntu-app-launch/url-overlay/exec-tool
323+usr/lib/*/ubuntu-app-launch/bad-url/exec-tool
324 usr/share/dbus-1
325 usr/share/upstart/sessions
326+usr/share/url-dispatcher/bad-url.qml
327 usr/bin/url-dispatcher-dump
328+debian/apparmor/url-dispatcher-bad-url-helper etc/apparmor.d
329
330=== added directory 'gui'
331=== added file 'gui/CMakeLists.txt'
332--- gui/CMakeLists.txt 1970-01-01 00:00:00 +0000
333+++ gui/CMakeLists.txt 2016-11-07 16:32:23 +0000
334@@ -0,0 +1,13 @@
335+
336+install(FILES
337+ url-dispatcher-gui.qml
338+ url-dispatcher-gui.svg
339+ DESTINATION "${CMAKE_INSTALL_DATADIR}/url-dispatcher/gui/")
340+install(FILES
341+ ${CMAKE_CURRENT_BINARY_DIR}/url-dispatcher-gui.desktop
342+ DESTINATION "${CMAKE_INSTALL_DATADIR}/applications/")
343+
344+configure_file(
345+ "url-dispatcher-gui.desktop.in"
346+ "url-dispatcher-gui.desktop"
347+ @ONLY)
348
349=== added file 'gui/url-dispatcher-gui.desktop.in'
350--- gui/url-dispatcher-gui.desktop.in 1970-01-01 00:00:00 +0000
351+++ gui/url-dispatcher-gui.desktop.in 2016-11-07 16:32:23 +0000
352@@ -0,0 +1,6 @@
353+[Desktop Entry]
354+Name=URL Dispatcher GUI
355+Icon=@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_DATADIR@/url-dispatcher/gui/url-dispatcher-gui.svg
356+Type=Application
357+Exec=qmlscene @CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_DATADIR@/url-dispatcher/gui/url-dispatcher-gui.qml
358+X-Ubuntu-Touch=true
359
360=== added file 'gui/url-dispatcher-gui.qml'
361--- gui/url-dispatcher-gui.qml 1970-01-01 00:00:00 +0000
362+++ gui/url-dispatcher-gui.qml 2016-11-07 16:32:23 +0000
363@@ -0,0 +1,59 @@
364+import QtQuick 2.4
365+import Ubuntu.Components 1.3
366+import Ubuntu.Components.ListItems 1.3
367+
368+MainView {
369+ applicationName: "url-dispatcher-gui"
370+
371+ Page {
372+ header: PageHeader {
373+ title: "URL Dispatcher GUI"
374+ flickable: flickme
375+ }
376+
377+ Flickable {
378+ id: flickme
379+ anchors.fill: parent
380+
381+ Column {
382+ anchors.fill: parent
383+
384+ ListItem {
385+ contentItem.anchors {
386+ leftMargin: units.gu(2)
387+ rightMargin: units.gu(2)
388+ topMargin: units.gu(1)
389+ bottomMargin: units.gu(1)
390+ }
391+
392+ TextField {
393+ id: textbox
394+ anchors.fill: parent
395+ placeholderText: "URL (e.g. 'http://ubuntu.com')"
396+ }
397+ }
398+
399+ ListItem {
400+ contentItem.anchors {
401+ leftMargin: units.gu(2)
402+ rightMargin: units.gu(2)
403+ topMargin: units.gu(1)
404+ bottomMargin: units.gu(1)
405+ }
406+
407+ Button {
408+ anchors.fill: parent
409+ text: "Send URL"
410+ onClicked: {
411+ console.log("Sending URL: " + textbox.text)
412+ Qt.openUrlExternally(textbox.text)
413+ }
414+ }
415+ }
416+ }
417+ }
418+
419+ }
420+
421+
422+}
423
424=== added file 'gui/url-dispatcher-gui.svg'
425--- gui/url-dispatcher-gui.svg 1970-01-01 00:00:00 +0000
426+++ gui/url-dispatcher-gui.svg 2016-11-07 16:32:23 +0000
427@@ -0,0 +1,129 @@
428+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
429+<!-- Created with Inkscape (http://www.inkscape.org/) -->
430+
431+<svg
432+ xmlns:dc="http://purl.org/dc/elements/1.1/"
433+ xmlns:cc="http://creativecommons.org/ns#"
434+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
435+ xmlns:svg="http://www.w3.org/2000/svg"
436+ xmlns="http://www.w3.org/2000/svg"
437+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
438+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
439+ width="256"
440+ height="256"
441+ viewBox="0 0 67.733332 67.733335"
442+ version="1.1"
443+ id="svg8"
444+ inkscape:version="0.92pre1 15068"
445+ sodipodi:docname="url-dispatcher-gui.svg">
446+ <defs
447+ id="defs2" />
448+ <sodipodi:namedview
449+ id="base"
450+ pagecolor="#ffffff"
451+ bordercolor="#666666"
452+ borderopacity="1.0"
453+ inkscape:pageopacity="1"
454+ inkscape:pageshadow="2"
455+ inkscape:zoom="3.375"
456+ inkscape:cx="128"
457+ inkscape:cy="128.88889"
458+ inkscape:document-units="mm"
459+ inkscape:current-layer="g3484"
460+ showgrid="false"
461+ units="px"
462+ inkscape:showpageshadow="false"
463+ inkscape:pagecheckerboard="false"
464+ inkscape:window-width="1920"
465+ inkscape:window-height="1050"
466+ inkscape:window-x="0"
467+ inkscape:window-y="30"
468+ inkscape:window-maximized="1" />
469+ <metadata
470+ id="metadata5">
471+ <rdf:RDF>
472+ <cc:Work
473+ rdf:about="">
474+ <dc:format>image/svg+xml</dc:format>
475+ <dc:type
476+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
477+ <dc:title></dc:title>
478+ </cc:Work>
479+ </rdf:RDF>
480+ </metadata>
481+ <g
482+ inkscape:label="Layer 1"
483+ inkscape:groupmode="layer"
484+ id="layer1"
485+ transform="translate(0,-229.26665)">
486+ <g
487+ id="g3484"
488+ transform="translate(0,-2.732619)">
489+ <path
490+ inkscape:connector-curvature="0"
491+ id="path3486"
492+ style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:17.4939785px;font-family:Ubuntu;-inkscape-font-specification:Ubuntu;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.69975913px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
493+ d="m 16.89882,270.19082 q -1.903345,0 -3.302863,-0.5878 -1.399518,-0.58779 -2.29521,-1.59545 -0.895692,-1.03564 -1.3435374,-2.43516 -0.4198555,-1.39952 -0.4198555,-3.02296 V 250.37364 H 12.25242 v 11.86792 q 0,2.911 1.287556,4.22654 1.287557,1.31555 3.358844,1.31555 1.035644,0 1.875355,-0.30789 0.867701,-0.33589 1.483489,-1.00766 0.615788,-0.67177 0.951673,-1.70741 0.335884,-1.06363 0.335884,-2.51913 v -11.86792 h 2.715066 v 12.17581 q 0,1.62344 -0.447846,3.02296 -0.419856,1.39952 -1.343538,2.43516 -0.895692,1.00766 -2.29521,1.59545 -1.371528,0.5878 -3.274873,0.5878 z" />
494+ <path
495+ inkscape:connector-curvature="0"
496+ id="path3488"
497+ style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:17.4939785px;font-family:Ubuntu;-inkscape-font-specification:Ubuntu;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.69975913px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
498+ d="m 38.409416,261.65376 q 0.447846,0.55981 1.119614,1.48349 0.69976,0.89569 1.427509,2.01531 0.72775,1.09162 1.427509,2.29521 0.727749,1.20358 1.231576,2.3232 h -2.966979 q -0.559807,-1.06364 -1.231576,-2.15526 -0.643778,-1.09163 -1.315547,-2.07129 -0.671769,-1.00765 -1.343538,-1.87535 -0.643778,-0.86771 -1.175595,-1.51148 -0.363875,0.028 -0.75574,0.028 -0.363875,0 -0.75574,0 h -2.435162 v 7.58539 h -2.715065 v -19.11742 q 1.147605,-0.27991 2.547123,-0.36388 1.427509,-0.11196 2.603104,-0.11196 4.086593,0 6.213861,1.53947 2.155258,1.53947 2.155258,4.59042 0,1.93133 -1.035643,3.30286 -1.007653,1.37153 -2.994969,2.0433 z m -4.114584,-9.09687 q -1.735403,0 -2.659085,0.084 v 7.30549 h 1.931335 q 1.399519,0 2.519133,-0.13995 1.119615,-0.13996 1.875355,-0.53182 0.78373,-0.39187 1.203586,-1.09163 0.419855,-0.72775 0.419855,-1.90334 0,-1.09163 -0.419855,-1.81937 -0.419856,-0.72775 -1.147605,-1.14761 -0.69976,-0.41986 -1.679422,-0.5878 -0.951673,-0.16794 -2.043297,-0.16794 z" />
499+ <path
500+ inkscape:connector-curvature="0"
501+ id="path3490"
502+ style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:17.4939785px;font-family:Ubuntu;-inkscape-font-specification:Ubuntu;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.69975913px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
503+ d="m 58.19598,267.41977 v 2.3512 H 46.523997 v -19.39733 h 2.715066 v 17.04613 z" />
504+ <path
505+ inkscape:connector-curvature="0"
506+ id="path3493"
507+ style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:6.10472965px;font-family:Ubuntu;-inkscape-font-specification:Ubuntu;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.24418919px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
508+ d="m 16.002471,276.35782 q 0,0.87908 -0.273492,1.5335 -0.273492,0.64466 -0.771638,1.07444 -0.498145,0.42 -1.191643,0.63489 -0.693497,0.20512 -1.52374,0.20512 -0.410238,0 -0.908384,-0.0391 -0.488379,-0.0293 -0.888849,-0.12698 v -6.56381 q 0.40047,-0.0977 0.888849,-0.12698 0.498146,-0.0391 0.908384,-0.0391 0.830243,0 1.52374,0.21489 0.693498,0.20512 1.191643,0.63489 0.498146,0.42001 0.771638,1.07444 0.273492,0.64465 0.273492,1.52374 z m -3.682373,2.6177 q 1.347925,0 2.012119,-0.68373 0.664195,-0.69349 0.664195,-1.93397 0,-1.24049 -0.664195,-1.92421 -0.664194,-0.6935 -2.012119,-0.6935 -0.40047,0 -0.625124,0.01 -0.214887,0.01 -0.302795,0.0195 v 5.17681 q 0.08791,0.01 0.302795,0.0195 0.224654,0.01 0.625124,0.01 z" />
509+ <path
510+ inkscape:connector-curvature="0"
511+ id="path3495"
512+ style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:6.10472965px;font-family:Ubuntu;-inkscape-font-specification:Ubuntu;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.24418919px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
513+ d="m 18.257711,279.74716 h -0.908384 v -5.07913 h 0.908384 z m -0.459076,-5.99728 q -0.244189,0 -0.420005,-0.15629 -0.166049,-0.16604 -0.166049,-0.43954 0,-0.27349 0.166049,-0.42977 0.175816,-0.16605 0.420005,-0.16605 0.244189,0 0.410238,0.16605 0.175816,0.15628 0.175816,0.42977 0,0.2735 -0.175816,0.43954 -0.166049,0.15629 -0.410238,0.15629 z" />
514+ <path
515+ inkscape:connector-curvature="0"
516+ id="path3497"
517+ style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:6.10472965px;font-family:Ubuntu;-inkscape-font-specification:Ubuntu;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.24418919px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
518+ d="m 21.011249,279.09273 q 0.556751,0 0.820476,-0.14651 0.273492,-0.14651 0.273492,-0.46884 0,-0.3321 -0.263725,-0.52745 -0.263724,-0.19535 -0.869313,-0.43954 -0.293027,-0.11721 -0.566519,-0.23442 -0.263725,-0.12698 -0.459076,-0.29303 -0.195351,-0.16605 -0.312562,-0.40047 -0.117211,-0.23442 -0.117211,-0.57629 0,-0.67396 0.498146,-1.06466 0.498146,-0.40047 1.357692,-0.40047 0.214886,0 0.429773,0.0293 0.214886,0.0195 0.40047,0.0586 0.185584,0.0293 0.32233,0.0684 0.146514,0.0391 0.224654,0.0684 l -0.166049,0.78141 q -0.146513,-0.0781 -0.459075,-0.15628 -0.312562,-0.0879 -0.752103,-0.0879 -0.380935,0 -0.664195,0.15628 -0.283259,0.14651 -0.283259,0.46884 0,0.16605 0.05861,0.29303 0.06837,0.12698 0.195352,0.23442 0.136746,0.0977 0.332097,0.18559 0.195351,0.0879 0.468843,0.18558 0.3614,0.13675 0.64466,0.27349 0.283259,0.12698 0.478611,0.3028 0.205118,0.17581 0.312562,0.42977 0.107443,0.24419 0.107443,0.60559 0,0.70326 -0.527449,1.06466 -0.517681,0.3614 -1.48467,0.3614 -0.673962,0 -1.054897,-0.11721 -0.380935,-0.10744 -0.517681,-0.16605 l 0.166048,-0.7814 q 0.156281,0.0586 0.498146,0.17581 0.341865,0.11721 0.908384,0.11721 z" />
519+ <path
520+ inkscape:connector-curvature="0"
521+ id="path3499"
522+ style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:6.10472965px;font-family:Ubuntu;-inkscape-font-specification:Ubuntu;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.24418919px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
523+ d="m 27.705085,277.21736 q 0,-0.88885 -0.43954,-1.36746 -0.439541,-0.47861 -1.172109,-0.47861 -0.410237,0 -0.644659,0.0293 -0.224654,0.0293 -0.3614,0.0684 v 3.20376 q 0.166049,0.13675 0.478611,0.26372 0.312562,0.12698 0.68373,0.12698 0.390702,0 0.664194,-0.13674 0.28326,-0.14652 0.459076,-0.39071 0.175816,-0.25395 0.253957,-0.58605 0.07814,-0.34187 0.07814,-0.73257 z m 0.947454,0 q 0,0.57629 -0.156281,1.06467 -0.146513,0.48838 -0.43954,0.84001 -0.293027,0.35163 -0.7228,0.54698 -0.420006,0.19535 -0.96699,0.19535 -0.43954,0 -0.781405,-0.11721 -0.332097,-0.11721 -0.498146,-0.22465 v 2.03165 h -0.908384 v -6.72985 q 0.32233,-0.0781 0.800941,-0.16605 0.488378,-0.0977 1.12327,-0.0977 0.586054,0 1.054897,0.18559 0.468844,0.18558 0.800941,0.52745 0.332097,0.34186 0.507913,0.84001 0.185584,0.48838 0.185584,1.10373 z" />
524+ <path
525+ inkscape:connector-curvature="0"
526+ id="path3501"
527+ style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:6.10472965px;font-family:Ubuntu;-inkscape-font-specification:Ubuntu;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.24418919px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
528+ d="m 31.659424,279.09273 q 0.32233,0 0.566519,-0.01 0.253957,-0.0195 0.420006,-0.0586 v -1.51397 q -0.09768,-0.0488 -0.32233,-0.0781 -0.214887,-0.0391 -0.527449,-0.0391 -0.205119,0 -0.43954,0.0293 -0.224654,0.0293 -0.420006,0.12698 -0.185584,0.0879 -0.312562,0.25396 -0.126978,0.15628 -0.126978,0.42 0,0.48838 0.312562,0.68373 0.312562,0.18558 0.849778,0.18558 z m -0.07814,-4.55168 q 0.546984,0 0.918151,0.14651 0.380935,0.13675 0.605589,0.40047 0.234422,0.25396 0.332098,0.61536 0.09767,0.35163 0.09767,0.7814 v 3.17446 q -0.117211,0.0195 -0.332097,0.0586 -0.205119,0.0293 -0.468843,0.0586 -0.263725,0.0293 -0.576287,0.0488 -0.302794,0.0293 -0.605589,0.0293 -0.429773,0 -0.791173,-0.0879 -0.3614,-0.0879 -0.625124,-0.27349 -0.263725,-0.19536 -0.410238,-0.50792 -0.146514,-0.31256 -0.146514,-0.7521 0,-0.42001 0.166049,-0.7228 0.175816,-0.3028 0.468843,-0.48838 0.293027,-0.18558 0.68373,-0.27349 0.390703,-0.0879 0.820476,-0.0879 0.136746,0 0.283259,0.0195 0.146514,0.01 0.273492,0.0391 0.136746,0.0195 0.234422,0.0391 0.09768,0.0195 0.136746,0.0293 v -0.25396 q 0,-0.22465 -0.04884,-0.43954 -0.04884,-0.22465 -0.175816,-0.3907 -0.126979,-0.17582 -0.351633,-0.27349 -0.214886,-0.10745 -0.566519,-0.10745 -0.449308,0 -0.791173,0.0684 -0.332097,0.0586 -0.498146,0.12698 l -0.107443,-0.75211 q 0.175816,-0.0781 0.586054,-0.14651 0.410238,-0.0781 0.888849,-0.0781 z" />
529+ <path
530+ inkscape:connector-curvature="0"
531+ id="path3503"
532+ style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:6.10472965px;font-family:Ubuntu;-inkscape-font-specification:Ubuntu;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.24418919px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
533+ d="m 35.883744,274.66803 h 1.924211 v 0.76187 h -1.924211 v 2.34421 q 0,0.38094 0.05861,0.6349 0.05861,0.24418 0.175816,0.3907 0.117211,0.13674 0.293027,0.19535 0.175816,0.0586 0.410238,0.0586 0.410238,0 0.654427,-0.0879 0.253957,-0.0977 0.351632,-0.13675 l 0.175817,0.7521 q -0.136746,0.0684 -0.478611,0.16605 -0.341865,0.10745 -0.781406,0.10745 -0.517681,0 -0.859546,-0.12698 -0.332097,-0.13675 -0.537216,-0.40047 -0.205119,-0.26373 -0.293027,-0.64466 -0.07814,-0.39071 -0.07814,-0.89862 v -4.53215 l 0.908383,-0.15628 z" />
534+ <path
535+ inkscape:connector-curvature="0"
536+ id="path3505"
537+ style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:6.10472965px;font-family:Ubuntu;-inkscape-font-specification:Ubuntu;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.24418919px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
538+ d="m 41.037815,279.86437 q -0.615356,0 -1.0842,-0.19535 -0.459075,-0.19535 -0.781405,-0.54698 -0.312562,-0.35163 -0.468843,-0.83025 -0.156281,-0.48837 -0.156281,-1.07443 0,-0.58605 0.166048,-1.07443 0.175817,-0.48838 0.488379,-0.84001 0.312562,-0.3614 0.76187,-0.55675 0.459076,-0.20512 1.015827,-0.20512 0.341865,0 0.68373,0.0586 0.341865,0.0586 0.654427,0.18559 l -0.205119,0.77164 q -0.205119,-0.0977 -0.478611,-0.15629 -0.263724,-0.0586 -0.566519,-0.0586 -0.76187,0 -1.172108,0.47861 -0.40047,0.47861 -0.40047,1.39676 0,0.41024 0.08791,0.7521 0.09768,0.34187 0.293027,0.58606 0.205119,0.24419 0.517681,0.38093 0.312562,0.12698 0.76187,0.12698 0.3614,0 0.654427,-0.0684 0.293027,-0.0684 0.459076,-0.14651 l 0.126978,0.76187 q -0.07814,0.0488 -0.224654,0.0977 -0.146513,0.0391 -0.332097,0.0684 -0.185584,0.0391 -0.40047,0.0586 -0.205119,0.0293 -0.400471,0.0293 z" />
539+ <path
540+ inkscape:connector-curvature="0"
541+ id="path3507"
542+ style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:6.10472965px;font-family:Ubuntu;-inkscape-font-specification:Ubuntu;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.24418919px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
543+ d="m 43.370739,279.74716 v -7.42335 l 0.908384,-0.15628 v 2.59817 q 0.253956,-0.0977 0.537216,-0.14651 0.293027,-0.0586 0.576286,-0.0586 0.60559,0 1.00606,0.17582 0.40047,0.16605 0.634892,0.47861 0.244189,0.3028 0.341865,0.73257 0.09768,0.42977 0.09768,0.94745 v 2.85213 h -0.908383 v -2.65678 q 0,-0.46884 -0.06837,-0.80094 -0.05861,-0.33209 -0.205119,-0.53721 -0.146514,-0.20512 -0.390703,-0.29303 -0.244189,-0.0977 -0.605589,-0.0977 -0.146514,0 -0.302795,0.0195 -0.156281,0.0195 -0.302794,0.0488 -0.136746,0.0195 -0.253957,0.0488 -0.107443,0.0293 -0.156281,0.0488 v 4.21959 z" />
544+ <path
545+ inkscape:connector-curvature="0"
546+ id="path3509"
547+ style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:6.10472965px;font-family:Ubuntu;-inkscape-font-specification:Ubuntu;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.24418919px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
548+ d="m 48.658044,277.21736 q 0,-0.67396 0.195351,-1.17211 0.195351,-0.50791 0.517681,-0.84001 0.32233,-0.33209 0.742335,-0.49814 0.420006,-0.16605 0.859546,-0.16605 1.025595,0 1.572579,0.64466 0.546983,0.63489 0.546983,1.94374 0,0.0586 0,0.15628 0,0.0879 -0.0098,0.16605 h -3.477254 q 0.05861,0.79118 0.459075,1.20141 0.400471,0.41024 1.250249,0.41024 0.478611,0 0.800941,-0.0781 0.332097,-0.0879 0.498146,-0.16605 l 0.126978,0.76187 q -0.166049,0.0879 -0.586054,0.18559 -0.410238,0.0977 -0.937687,0.0977 -0.664194,0 -1.152573,-0.19535 -0.47861,-0.20512 -0.791172,-0.55675 -0.312563,-0.35163 -0.468844,-0.83024 -0.146513,-0.48838 -0.146513,-1.06467 z m 3.487021,-0.49814 q 0.0098,-0.61536 -0.312562,-1.00606 -0.312562,-0.40047 -0.869313,-0.40047 -0.312562,0 -0.556752,0.12697 -0.234421,0.11722 -0.40047,0.31257 -0.166049,0.19535 -0.263724,0.4493 -0.08791,0.25396 -0.117211,0.51769 z" />
549+ <path
550+ inkscape:connector-curvature="0"
551+ id="path3511"
552+ style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:6.10472965px;font-family:Ubuntu;-inkscape-font-specification:Ubuntu;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.24418919px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
553+ d="m 56.27278,274.56058 q 0.117211,0 0.263725,0.0195 0.156281,0.01 0.302794,0.0391 0.146514,0.0195 0.263725,0.0488 0.126978,0.0195 0.185584,0.0391 l -0.156282,0.79117 q -0.107443,-0.0391 -0.3614,-0.0879 -0.244189,-0.0586 -0.634891,-0.0586 -0.253957,0 -0.507914,0.0586 -0.244189,0.0488 -0.32233,0.0684 v 4.26843 h -0.908384 v -4.86425 q 0.32233,-0.11721 0.800941,-0.21488 0.478611,-0.10745 1.074432,-0.10745 z" />
554+ </g>
555+ </g>
556+</svg>
557
558=== added directory 'po'
559=== added file 'po/CMakeLists.txt'
560--- po/CMakeLists.txt 1970-01-01 00:00:00 +0000
561+++ po/CMakeLists.txt 2016-11-07 16:32:23 +0000
562@@ -0,0 +1,39 @@
563+include(FindGettext)
564+find_program(GETTEXT_XGETTEXT_EXECUTABLE xgettext)
565+find_program(INTLTOOL_UPDATE intltool-update)
566+
567+set(GETTEXT_PACKAGE ${PROJECT_NAME})
568+set(POT_FILE ${GETTEXT_PACKAGE}.pot)
569+file(GLOB POFILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.po)
570+
571+# Creates POTFILES
572+add_custom_target(POTFILES ALL
573+ COMMENT "Generating POTFILES"
574+ COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/genpotfiles.sh ${CMAKE_SOURCE_DIR}
575+)
576+
577+# Creates the .pot file containing the translations template
578+set(INTLTOOL_ENV
579+ XGETTEXT="${GETTEXT_XGETTEXT_EXECUTABLE}"
580+ XGETTEXT_ARGS="--keyword=Gettext;--keyword=NGettext:1,2;--keyword=tr;--keyword=tr:1,2;--keyword=N_"
581+ srcdir="${CMAKE_CURRENT_SOURCE_DIR}"
582+)
583+add_custom_target(${POT_FILE}
584+ COMMENT "Generating translation template"
585+ COMMAND ${INTLTOOL_ENV} ${INTLTOOL_UPDATE} --gettext-package ${GETTEXT_PACKAGE} --pot
586+ COMMAND cp -f ${POT_FILE} ${CMAKE_CURRENT_SOURCE_DIR}/
587+ DEPENDS POTFILES
588+)
589+
590+# Builds the binary translations catalog for each language
591+# it finds source translations (*.po) for
592+foreach(POFILE ${POFILES})
593+ string(REPLACE ".po" "" LANG ${POFILE})
594+ list(APPEND PO_FILES "${POFILE}")
595+ gettext_process_po_files(${LANG} ALL PO_FILES "${POFILE}")
596+ set(INSTALL_DIR ${CMAKE_INSTALL_LOCALEDIR}/${LANG}/LC_MESSAGES)
597+ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${LANG}.gmo
598+ DESTINATION ${INSTALL_DIR}
599+ RENAME ${GETTEXT_PACKAGE}.mo
600+ )
601+endforeach(POFILE)
602
603=== added file 'po/POTFILES.in'
604--- po/POTFILES.in 1970-01-01 00:00:00 +0000
605+++ po/POTFILES.in 2016-11-07 16:32:23 +0000
606@@ -0,0 +1,1 @@
607+data/bad-url.qml
608
609=== added file 'po/genpotfiles.sh'
610--- po/genpotfiles.sh 1970-01-01 00:00:00 +0000
611+++ po/genpotfiles.sh 2016-11-07 16:32:23 +0000
612@@ -0,0 +1,6 @@
613+#!/bin/sh
614+
615+sed '/^#/d
616+ s/^[[].*] *//
617+ /^[ ]*$/d' \
618+ "`dirname ${0}`/POTFILES.in" | sed '$!s/$/ \\/' > POTFILES
619
620=== modified file 'service/CMakeLists.txt'
621--- service/CMakeLists.txt 2015-06-11 21:38:13 +0000
622+++ service/CMakeLists.txt 2016-11-07 16:32:23 +0000
623@@ -47,15 +47,20 @@
624 overlay-tracker.cpp
625 overlay-tracker-iface.h
626 overlay-tracker-mir.h
627- overlay-tracker-mir.cpp)
628+ overlay-tracker-mir.cpp
629+ scope-checker-facade.h
630+ scope-checker.h
631+ scope-checker.cpp)
632
633 target_link_libraries(dispatcher-lib
634 url-db-lib
635 service-generated
636 -pthread
637+ ${APPARMOR_LIBRARIES}
638 ${GLIB2_LIBRARIES}
639 ${GOBJECT2_LIBRARIES}
640 ${GIO2_LIBRARIES}
641+ ${SCOPES_LIBRARIES}
642 ${SQLITE_LIBRARIES}
643 ${UBUNTU_APP_LAUNCH_LIBRARIES}
644 )
645@@ -106,14 +111,6 @@
646 target_link_libraries(update-directory ${GIO2_LIBRARIES} ${JSONGLIB_LIBRARIES} url-db-lib)
647
648 ###########################
649-# URL Overlay Exec Tool
650-###########################
651-
652-add_executable(url-overlay-exec-tool url-overlay.c recoverable-problem.c)
653-set_target_properties(url-overlay-exec-tool PROPERTIES OUTPUT_NAME "exec-tool")
654-target_link_libraries(url-overlay-exec-tool ${GIO2_LIBRARIES} ${UBUNTU_APP_LAUNCH_LIBRARIES} ${CLICK_LIBRARIES})
655-
656-###########################
657 # Installation
658 ###########################
659
660@@ -122,8 +119,9 @@
661 RUNTIME DESTINATION "${CMAKE_INSTALL_FULL_LIBEXECDIR}/url-dispatcher"
662 )
663
664-install(
665- TARGETS url-overlay-exec-tool
666- RUNTIME DESTINATION "${CMAKE_INSTALL_FULL_LIBEXECDIR}/ubuntu-app-launch/url-overlay"
667-)
668+###########################
669+# Exec Tools
670+###########################
671
672+add_subdirectory(url-overlay)
673+add_subdirectory(bad-url)
674
675=== added directory 'service/bad-url'
676=== added file 'service/bad-url/CMakeLists.txt'
677--- service/bad-url/CMakeLists.txt 1970-01-01 00:00:00 +0000
678+++ service/bad-url/CMakeLists.txt 2016-11-07 16:32:23 +0000
679@@ -0,0 +1,14 @@
680+###########################
681+# Bad URL Exec Tool
682+###########################
683+
684+add_definitions( -DQML_BAD_URL="${CMAKE_INSTALL_FULL_DATADIR}/url-dispatcher/bad-url.qml" )
685+add_executable(bad-url-exec-tool exec-tool.c)
686+set_target_properties(bad-url-exec-tool PROPERTIES OUTPUT_NAME "exec-tool")
687+target_link_libraries(bad-url-exec-tool ${GIO2_LIBRARIES} ${UBUNTU_APP_LAUNCH_LIBRARIES})
688+
689+install(
690+ TARGETS bad-url-exec-tool
691+ RUNTIME DESTINATION "${CMAKE_INSTALL_FULL_LIBEXECDIR}/ubuntu-app-launch/bad-url"
692+)
693+
694
695=== added file 'service/bad-url/exec-tool.c'
696--- service/bad-url/exec-tool.c 1970-01-01 00:00:00 +0000
697+++ service/bad-url/exec-tool.c 2016-11-07 16:32:23 +0000
698@@ -0,0 +1,42 @@
699+/*
700+ * Copyright © 2015 Canonical Ltd.
701+ *
702+ * This program is free software: you can redistribute it and/or modify it
703+ * under the terms of the GNU General Public License version 3, as published
704+ * by the Free Software Foundation.
705+ *
706+ * This program is distributed in the hope that it will be useful, but
707+ * WITHOUT ANY WARRANTY; without even the implied warranties of
708+ * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
709+ * PURPOSE. See the GNU General Public License for more details.
710+ *
711+ * You should have received a copy of the GNU General Public License along
712+ * with this program. If not, see <http://www.gnu.org/licenses/>.
713+ *
714+ * Authors:
715+ * Ted Gould <ted.gould@canonical.com>
716+ */
717+
718+#include <gio/gio.h>
719+#include <ubuntu-app-launch.h>
720+
721+int
722+main (int argc, char * argv[])
723+{
724+ GDBusConnection * bus = g_bus_get_sync(G_BUS_TYPE_SESSION, NULL, NULL);
725+ g_return_val_if_fail(bus != NULL, -1);
726+
727+ gchar * exec = g_strdup_printf("qmlscene %s %s", QML_BAD_URL, g_getenv("APP_URIS"));
728+
729+ gboolean sended = ubuntu_app_launch_helper_set_exec(exec, NULL);
730+ g_free(exec);
731+
732+ /* Ensuring the messages get on the bus before we quit */
733+ g_dbus_connection_flush_sync(bus, NULL, NULL);
734+ g_clear_object(&bus);
735+
736+ if (sended)
737+ return 0;
738+ else
739+ return -1;
740+}
741
742=== modified file 'service/dispatcher.c'
743--- service/dispatcher.c 2015-09-03 21:50:06 +0000
744+++ service/dispatcher.c 2016-11-07 16:32:23 +0000
745@@ -23,10 +23,12 @@
746 #include "dispatcher.h"
747 #include "service-iface.h"
748 #include "recoverable-problem.h"
749+#include "scope-checker.h"
750 #include "url-db.h"
751
752 /* Globals */
753 static OverlayTracker * tracker = NULL;
754+static ScopeChecker * checker = NULL;
755 static GCancellable * cancellable = NULL;
756 static ServiceIfaceComCanonicalURLDispatcher * skel = NULL;
757 static GRegex * applicationre = NULL;
758@@ -73,6 +75,10 @@
759 g_variant_get(pid_tuple, "(u)", &pid);
760 g_variant_unref(pid_tuple);
761
762+ /* Popup the bad url dialog */
763+ overlay_tracker_badurl(tracker, pid, badurl);
764+
765+ /* Report recoverable error */
766 const gchar * additional[3] = {
767 "BadURL",
768 badurl,
769@@ -151,6 +157,11 @@
770 gboolean
771 send_to_dash (const gchar * url)
772 {
773+ if (url == NULL) {
774+ g_warning("Can not send nothing to the dash");
775+ return FALSE;
776+ }
777+
778 GDBusConnection * bus = g_bus_get_sync(G_BUS_TYPE_SESSION, NULL, NULL);
779 g_return_val_if_fail(bus != NULL, FALSE);
780
781@@ -210,13 +221,109 @@
782 return TRUE;
783 }
784
785+/* Queries Upstart for the PID of a given upstart job */
786+pid_t
787+pid_for_upstart_job (GDBusConnection * conn, const gchar* jobname)
788+{
789+ GError* error = NULL;
790+
791+ if (jobname == NULL) {
792+ return 0;
793+ }
794+
795+ GVariant* retval = g_dbus_connection_call_sync(
796+ conn,
797+ "com.ubuntu.Upstart",
798+ "/com/ubuntu/Upstart",
799+ "com.ubuntu.Upstart0_6",
800+ "GetJobByName",
801+ g_variant_new("(s)", jobname),
802+ G_VARIANT_TYPE("(o)"),
803+ G_DBUS_CALL_FLAGS_NO_AUTO_START,
804+ -1, /* timeout */
805+ NULL, /* cancel */
806+ &error);
807+
808+ if (error != NULL) {
809+ g_warning("Unable to get path for job '%s': %s", jobname, error->message);
810+ g_error_free(error);
811+ return 0;
812+ }
813+
814+ gchar* path = NULL;
815+ g_variant_get(retval, "(o)", &path);
816+ g_variant_unref(retval);
817+
818+ retval = g_dbus_connection_call_sync(
819+ conn,
820+ "com.ubuntu.Upstart",
821+ path,
822+ "com.ubuntu.Upstart0_6.Job",
823+ "GetInstanceByName",
824+ g_variant_new("(s)", ""),
825+ G_VARIANT_TYPE("(o)"),
826+ G_DBUS_CALL_FLAGS_NO_AUTO_START,
827+ -1, /* timeout */
828+ NULL, /* cancel */
829+ &error);
830+
831+ g_free(path);
832+
833+ if (error != NULL) {
834+ g_warning("Unable to get instance for job '%s': %s", jobname, error->message);
835+ g_error_free(error);
836+ return 0;
837+ }
838+
839+ g_variant_get(retval, "(o)", &path);
840+ g_variant_unref(retval);
841+
842+ retval = g_dbus_connection_call_sync(
843+ conn,
844+ "com.ubuntu.Upstart",
845+ path,
846+ "org.freedesktop.DBus.Properties",
847+ "Get",
848+ g_variant_new("(ss)", "com.ubuntu.Upstart0_6.Instance", "processes"),
849+ G_VARIANT_TYPE("(v)"),
850+ G_DBUS_CALL_FLAGS_NO_AUTO_START,
851+ -1, /* timeout */
852+ NULL, /* cancel */
853+ &error);
854+
855+ g_free(path);
856+
857+ if (error != NULL) {
858+ g_warning("Unable to get processes for job '%s': %s", jobname, error->message);
859+ g_error_free(error);
860+ return 0;
861+ }
862+
863+ GPid pid = 0;
864+ GVariant* variant = g_variant_get_child_value(retval, 0);
865+ GVariant* array = g_variant_get_variant(variant);
866+ if (g_variant_n_children(array) > 0) {
867+ /* (si) */
868+ GVariant* firstitem = g_variant_get_child_value(array, 0);
869+ GVariant* vpid = g_variant_get_child_value(firstitem, 1);
870+ pid = g_variant_get_int32(vpid);
871+ g_variant_unref(vpid);
872+ g_variant_unref(firstitem);
873+ }
874+ g_variant_unref(variant);
875+ g_variant_unref(array);
876+ g_variant_unref(retval);
877+
878+ return pid;
879+}
880+
881+
882 /* Handles setting up the overlay with the URL */
883 gboolean
884 dispatcher_send_to_overlay (const gchar * app_id, const gchar * url, GDBusConnection * conn, const gchar * sender)
885 {
886 GError * error = NULL;
887
888- /* TODO: Detect if a scope is what we need to overlay on */
889 GVariant * callret = g_dbus_connection_call_sync(conn,
890 "org.freedesktop.DBus",
891 "/",
892@@ -239,6 +346,12 @@
893 g_variant_get_child(callret, 0, "u", &pid);
894 g_variant_unref(callret);
895
896+ /* If it is from a scope we need to overlay onto the
897+ dash instead */
898+ if (scope_checker_is_scope_pid(checker, pid)) {
899+ pid = pid_for_upstart_job(conn, "unity8-dash");
900+ }
901+
902 return overlay_tracker_add(tracker, app_id, pid, url);
903 }
904
905@@ -437,7 +550,17 @@
906
907 *out_appid = ubuntu_app_launch_triplet_to_app_id(package, app, version);
908 if (*out_appid != NULL) {
909- retval = TRUE;
910+ /* Look at the current version of the app and ensure
911+ we're not asking for an older version */
912+ gchar * testappid = ubuntu_app_launch_triplet_to_app_id(package, app, NULL);
913+ if (g_strcmp0(*out_appid, testappid) != 0) {
914+ retval = FALSE;
915+ g_clear_pointer(out_appid, g_free);
916+ } else {
917+ retval = TRUE;
918+ }
919+
920+ g_free(testappid);
921 }
922
923 g_free(package);
924@@ -483,6 +606,17 @@
925 }
926 }
927
928+ if (g_strcmp0(protocol, "scope") == 0) {
929+ /* Add a check for the scope if we can do that, since it is
930+ a system URL that we can do more checking on */
931+ if (!scope_checker_is_scope(checker, domain)) {
932+ found = FALSE;
933+ g_clear_pointer(out_appid, g_free);
934+ if (out_url != NULL)
935+ g_clear_pointer(out_url, g_free);
936+ }
937+ }
938+
939 g_free(protocol);
940 g_free(domain);
941
942@@ -517,7 +651,7 @@
943
944 if (error != NULL) {
945 if (!g_error_matches(error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
946- g_error("Unable to connect to D-Bus: %s", error->message);
947+ g_error("Unable to connect to D-Bus");
948 g_main_loop_quit(mainloop);
949 }
950 g_error_free(error);
951@@ -547,17 +681,18 @@
952
953 /* Initialize all the globals */
954 gboolean
955-dispatcher_init (GMainLoop * mainloop, OverlayTracker * intracker)
956+dispatcher_init (GMainLoop * mainloop, OverlayTracker * intracker, ScopeChecker * inchecker)
957 {
958 tracker = intracker;
959+ checker = inchecker;
960 cancellable = g_cancellable_new();
961
962 urldb = url_db_create_database();
963 g_return_val_if_fail(urldb != NULL, FALSE);
964
965 applicationre = g_regex_new("^application:///([a-zA-Z0-9_\\.-]*)\\.desktop$", 0, 0, NULL);
966- appidre = g_regex_new("^appid://([a-z0-9\\.-]*)/([a-zA-Z0-9-]*)/([a-zA-Z0-9\\.-]*)$", 0, 0, NULL);
967- genericre = g_regex_new("^([a-z][a-z0-9]*):(?://(?:.*@)?([a-zA-Z0-9\\.-]*)(?::[0-9]*)?/?)?(.*)?$", 0, 0, NULL);
968+ appidre = g_regex_new("^appid://([a-z0-9\\.-]*)/([a-zA-Z0-9-\\.]*)/([a-zA-Z0-9\\.-]*)$", 0, 0, NULL);
969+ genericre = g_regex_new("^([a-z][a-z0-9]*):(?://(?:.*@)?([a-zA-Z0-9\\.-_]*)(?::[0-9]*)?/?)?(.*)?$", 0, 0, NULL);
970 intentre = g_regex_new("^intent://.*package=([a-zA-Z0-9\\.]*);.*$", 0, 0, NULL);
971
972 g_bus_get(G_BUS_TYPE_SESSION, cancellable, bus_got, mainloop);
973
974=== modified file 'service/dispatcher.h'
975--- service/dispatcher.h 2015-06-11 21:47:17 +0000
976+++ service/dispatcher.h 2016-11-07 16:32:23 +0000
977@@ -22,10 +22,11 @@
978
979 #include <gio/gio.h>
980 #include "overlay-tracker.h"
981+#include "scope-checker.h"
982
983 G_BEGIN_DECLS
984
985-gboolean dispatcher_init (GMainLoop * mainloop, OverlayTracker * tracker);
986+gboolean dispatcher_init (GMainLoop * mainloop, OverlayTracker * tracker, ScopeChecker * checker);
987 gboolean dispatcher_shutdown ();
988 gboolean dispatcher_url_to_appid (const gchar * url, gchar ** out_appid, const gchar ** out_url);
989 gboolean dispatcher_appid_restrict (const gchar * appid, const gchar * package);
990
991=== modified file 'service/overlay-tracker-iface.h'
992--- service/overlay-tracker-iface.h 2015-05-19 20:24:47 +0000
993+++ service/overlay-tracker-iface.h 2016-11-07 16:32:23 +0000
994@@ -23,4 +23,5 @@
995 public:
996 virtual ~OverlayTrackerIface() = default;
997 virtual bool addOverlay (const char * appid, unsigned long pid, const char * url) = 0;
998+ virtual bool badUrl (unsigned long pid, const char * url) = 0;
999 };
1000
1001=== modified file 'service/overlay-tracker-mir.cpp'
1002--- service/overlay-tracker-mir.cpp 2015-06-11 21:47:17 +0000
1003+++ service/overlay-tracker-mir.cpp 2016-11-07 16:32:23 +0000
1004@@ -20,16 +20,20 @@
1005 #include "overlay-tracker-mir.h"
1006 #include <ubuntu-app-launch.h>
1007
1008-static const char * HELPER_TYPE = "url-overlay";
1009+static const char * OVERLAY_HELPER_TYPE = "url-overlay";
1010+static const char * BAD_URL_HELPER_TYPE = "bad-url";
1011+static const char * BAD_URL_APP_ID = "url-dispatcher-bad-url-helper";
1012
1013 OverlayTrackerMir::OverlayTrackerMir ()
1014 : thread([this] {
1015 /* Setup Helper Observer */
1016- ubuntu_app_launch_observer_add_helper_stop(untrustedHelperStoppedStatic, HELPER_TYPE, this);
1017+ ubuntu_app_launch_observer_add_helper_stop(overlayHelperStoppedStatic, OVERLAY_HELPER_TYPE, this);
1018+ ubuntu_app_launch_observer_add_helper_stop(overlayHelperStoppedStatic, BAD_URL_HELPER_TYPE, this);
1019 },
1020 [this] {
1021 /* Remove Helper Observer */
1022- ubuntu_app_launch_observer_delete_helper_stop(untrustedHelperStoppedStatic, HELPER_TYPE, this);
1023+ ubuntu_app_launch_observer_delete_helper_stop(overlayHelperStoppedStatic, OVERLAY_HELPER_TYPE, this);
1024+ ubuntu_app_launch_observer_delete_helper_stop(overlayHelperStoppedStatic, BAD_URL_HELPER_TYPE, this);
1025 })
1026 {
1027 mir = std::shared_ptr<MirConnection>([] {
1028@@ -52,8 +56,10 @@
1029 OverlayTrackerMir::~OverlayTrackerMir ()
1030 {
1031 thread.executeOnThread<bool>([this] {
1032- while (!ongoingSessions.empty()) {
1033- removeSession(std::get<2>(*ongoingSessions.begin()).get());
1034+ for (auto& sessionType : ongoingSessions) {
1035+ while (!sessionType.second.empty()) {
1036+ removeSession(sessionType.first, sessionType.second.begin()->session.get());
1037+ }
1038 }
1039
1040 return true;
1041@@ -65,53 +71,76 @@
1042 bool
1043 OverlayTrackerMir::addOverlay (const char * appid, unsigned long pid, const char * url)
1044 {
1045- std::string sappid(appid);
1046+ return addOverlayCore(OVERLAY_HELPER_TYPE, appid, pid, url, overlaySessionStateChangedStatic);
1047+}
1048+
1049+bool
1050+OverlayTrackerMir::addOverlayCore (const char * helper_id, const char * appid, unsigned long pid, const char * url, void (*stateChangedFunction) (MirPromptSession*, MirPromptSessionState, void *))
1051+{
1052+ OverlayData data;
1053+ data.appid = appid;
1054 std::string surl(url);
1055
1056- return thread.executeOnThread<bool>([this, sappid, pid, surl] {
1057- g_debug("Setting up over lay for PID %d with '%s'", pid, sappid.c_str());
1058+ return thread.executeOnThread<bool>([this, helper_id, &data, pid, surl, stateChangedFunction] {
1059+ g_debug("Setting up over lay for PID %d with '%s'", int(pid), data.appid.c_str());
1060
1061- auto session = std::shared_ptr<MirPromptSession>(
1062- mir_connection_create_prompt_session_sync(mir.get(), pid, sessionStateChangedStatic, this),
1063+ data.session = std::shared_ptr<MirPromptSession>(
1064+ mir_connection_create_prompt_session_sync(mir.get(), pid, stateChangedFunction, this),
1065 [] (MirPromptSession * session) { if (session) mir_prompt_session_release_sync(session); });
1066- if (!session) {
1067- g_critical("Unable to create trusted prompt session for %d with appid '%s'", pid, sappid.c_str());
1068+ if (!data.session) {
1069+ g_critical("Unable to create trusted prompt session for %d with appid '%s'", (int)pid, data.appid.c_str());
1070 return false;
1071 }
1072-
1073+
1074 std::array<const char *, 2> urls { surl.c_str(), nullptr };
1075- auto instance = ubuntu_app_launch_start_session_helper(HELPER_TYPE, session.get(), sappid.c_str(), urls.data());
1076+ auto instance = ubuntu_app_launch_start_session_helper(helper_id, data.session.get(), data.appid.c_str(), urls.data());
1077 if (instance == nullptr) {
1078- g_critical("Unable to start helper for %d with appid '%s'", pid, sappid.c_str());
1079+ g_critical("Unable to start helper for %d with appid '%s'", int(pid), data.appid.c_str());
1080 return false;
1081 }
1082+ data.instanceid = instance;
1083
1084- ongoingSessions.emplace(std::make_tuple(sappid, std::string(instance), session));
1085+ ongoingSessions[helper_id].push_back(data);
1086 g_free(instance);
1087 return true;
1088 });
1089 }
1090
1091-void
1092-OverlayTrackerMir::sessionStateChangedStatic (MirPromptSession * session, MirPromptSessionState state, void * user_data)
1093-{
1094- reinterpret_cast<OverlayTrackerMir *>(user_data)->sessionStateChanged(session, state);
1095-}
1096-
1097-void
1098-OverlayTrackerMir::removeSession (MirPromptSession * session)
1099-{
1100- for (auto it = ongoingSessions.begin(); it != ongoingSessions.end(); it++) {
1101- if (std::get<2>(*it).get() == session) {
1102- ubuntu_app_launch_stop_multiple_helper(HELPER_TYPE, std::get<0>(*it).c_str(), std::get<1>(*it).c_str());
1103- ongoingSessions.erase(it);
1104+bool
1105+OverlayTrackerMir::badUrl (unsigned long pid, const char * url)
1106+{
1107+ return addOverlayCore(BAD_URL_HELPER_TYPE, BAD_URL_APP_ID, pid, url, badUrlSessionStateChangedStatic);
1108+}
1109+
1110+void
1111+OverlayTrackerMir::overlaySessionStateChangedStatic (MirPromptSession * session, MirPromptSessionState state, void * user_data)
1112+{
1113+ reinterpret_cast<OverlayTrackerMir *>(user_data)->sessionStateChanged(session, state, OVERLAY_HELPER_TYPE);
1114+}
1115+
1116+void
1117+OverlayTrackerMir::badUrlSessionStateChangedStatic (MirPromptSession * session, MirPromptSessionState state, void * user_data)
1118+{
1119+ reinterpret_cast<OverlayTrackerMir *>(user_data)->sessionStateChanged(session, state, BAD_URL_HELPER_TYPE);
1120+}
1121+
1122+void
1123+OverlayTrackerMir::removeSession (const std::string &type, MirPromptSession * session)
1124+{
1125+ g_debug("Removing session: %p", (void*)session);
1126+ auto& sessions = ongoingSessions[type];
1127+
1128+ for (auto it = sessions.begin(); it != sessions.end(); it++) {
1129+ if (it->session.get() == session) {
1130+ ubuntu_app_launch_stop_multiple_helper(type.c_str(), it->appid.c_str(), it->instanceid.c_str());
1131+ sessions.erase(it);
1132 break;
1133 }
1134 }
1135 }
1136
1137 void
1138-OverlayTrackerMir::sessionStateChanged (MirPromptSession * session, MirPromptSessionState state)
1139+OverlayTrackerMir::sessionStateChanged (MirPromptSession * session, MirPromptSessionState state, const std::string &type)
1140 {
1141 if (state != mir_prompt_session_state_stopped) {
1142 /* We only care about the stopped state */
1143@@ -120,23 +149,24 @@
1144
1145 /* Executing on the Mir thread, which is nice and all, but we
1146 want to get back on our thread */
1147- thread.executeOnThread([this, session]() {
1148- removeSession(session);
1149+ thread.executeOnThread([this, type, session]() {
1150+ removeSession(type, session);
1151 });
1152 }
1153
1154 void
1155-OverlayTrackerMir::untrustedHelperStoppedStatic (const gchar * appid, const gchar * instanceid, const gchar * helpertype, gpointer user_data)
1156+OverlayTrackerMir::overlayHelperStoppedStatic (const gchar * appid, const gchar * instanceid, const gchar * helpertype, gpointer user_data)
1157 {
1158- reinterpret_cast<OverlayTrackerMir *>(user_data)->untrustedHelperStopped(appid, instanceid, helpertype);
1159+ reinterpret_cast<OverlayTrackerMir *>(user_data)->overlayHelperStopped(appid, instanceid, helpertype);
1160 }
1161
1162 void
1163-OverlayTrackerMir::untrustedHelperStopped(const gchar * appid, const gchar * instanceid, const gchar * helpertype)
1164+OverlayTrackerMir::overlayHelperStopped(const gchar * appid, const gchar * instanceid, const gchar * helpertype)
1165 {
1166 /* This callback will happen on our thread already, we don't need
1167 to proxy it on */
1168- if (g_strcmp0(helpertype, HELPER_TYPE) != 0) {
1169+ if (g_strcmp0(helpertype, OVERLAY_HELPER_TYPE) != 0
1170+ && g_strcmp0(helpertype, BAD_URL_HELPER_TYPE) != 0) {
1171 return;
1172 }
1173
1174@@ -144,10 +174,11 @@
1175 std::string sappid(appid);
1176 std::string sinstanceid(instanceid);
1177
1178- for (auto it = ongoingSessions.begin(); it != ongoingSessions.end(); it++) {
1179- if (std::get<0>(*it) == sappid && std::get<1>(*it) == sinstanceid) {
1180- ongoingSessions.erase(it);
1181+ for (auto it = ongoingSessions[helpertype].begin(); it != ongoingSessions[helpertype].end(); it++) {
1182+ if (it->appid == sappid && it->instanceid == sinstanceid) {
1183+ ongoingSessions[helpertype].erase(it);
1184 break;
1185 }
1186 }
1187 }
1188+
1189
1190=== modified file 'service/overlay-tracker-mir.h'
1191--- service/overlay-tracker-mir.h 2015-06-11 21:50:05 +0000
1192+++ service/overlay-tracker-mir.h 2016-11-07 16:32:23 +0000
1193@@ -19,7 +19,9 @@
1194
1195 #pragma once
1196
1197+#include <map>
1198 #include <set>
1199+#include <vector>
1200
1201 #include <mir_toolkit/mir_connection.h>
1202 #include <mir_toolkit/mir_prompt_session.h>
1203@@ -29,21 +31,33 @@
1204
1205 class OverlayTrackerMir : public OverlayTrackerIface {
1206 private:
1207+ struct OverlayData {
1208+ std::string appid;
1209+ std::string instanceid;
1210+ std::shared_ptr<MirPromptSession> session;
1211+ };
1212+
1213 GLib::ContextThread thread;
1214 std::shared_ptr<MirConnection> mir;
1215- std::set<std::tuple<std::string, std::string, std::shared_ptr<MirPromptSession>>> ongoingSessions;
1216+ std::map<std::string, std::vector<OverlayData>> ongoingSessions;
1217
1218 public:
1219 OverlayTrackerMir ();
1220 ~OverlayTrackerMir ();
1221 bool addOverlay (const char * appid, unsigned long pid, const char * url) override;
1222+ bool badUrl (unsigned long pid, const char * url) override;
1223
1224 private:
1225- void removeSession (MirPromptSession * session);
1226-
1227- static void sessionStateChangedStatic (MirPromptSession * session, MirPromptSessionState state, void * user_data);
1228- void sessionStateChanged (MirPromptSession * session, MirPromptSessionState state);
1229-
1230- static void untrustedHelperStoppedStatic (const gchar * appid, const gchar * instanceid, const gchar * helpertype, gpointer user_data);
1231- void untrustedHelperStopped(const gchar * appid, const gchar * instanceid, const gchar * helpertype);
1232+ /* Overlay Functions */
1233+ void removeSession (const std::string &type, MirPromptSession * session);
1234+
1235+ static void badUrlSessionStateChangedStatic (MirPromptSession * session, MirPromptSessionState state, void * user_data);
1236+ static void overlaySessionStateChangedStatic (MirPromptSession * session, MirPromptSessionState state, void * user_data);
1237+ void sessionStateChanged (MirPromptSession * session, MirPromptSessionState state, const std::string &type);
1238+
1239+ static void overlayHelperStoppedStatic (const gchar * appid, const gchar * instanceid, const gchar * helpertype, gpointer user_data);
1240+ void overlayHelperStopped(const gchar * appid, const gchar * instanceid, const gchar * helpertype);
1241+
1242+ bool addOverlayCore (const gchar * helperid, const gchar * appid, unsigned long pid, const gchar * url, void (*stateChangedFunction) (MirPromptSession*, MirPromptSessionState, void *));
1243+
1244 };
1245
1246=== modified file 'service/overlay-tracker.cpp'
1247--- service/overlay-tracker.cpp 2015-06-11 21:47:17 +0000
1248+++ service/overlay-tracker.cpp 2016-11-07 16:32:23 +0000
1249@@ -52,3 +52,12 @@
1250
1251 return reinterpret_cast<OverlayTrackerIface *>(tracker)->addOverlay(appid, pid, url) ? TRUE : FALSE;
1252 }
1253+
1254+gboolean
1255+overlay_tracker_badurl (OverlayTracker * tracker, unsigned long pid, const gchar * url) {
1256+ g_return_val_if_fail(tracker != nullptr, FALSE);
1257+ g_return_val_if_fail(pid != 0, FALSE);
1258+ g_return_val_if_fail(url != nullptr, FALSE);
1259+
1260+ return reinterpret_cast<OverlayTrackerIface *>(tracker)->badUrl(pid, url) ? TRUE : FALSE;
1261+}
1262
1263=== modified file 'service/overlay-tracker.h'
1264--- service/overlay-tracker.h 2015-06-11 21:47:17 +0000
1265+++ service/overlay-tracker.h 2016-11-07 16:32:23 +0000
1266@@ -25,4 +25,5 @@
1267 OverlayTracker * overlay_tracker_new ();
1268 void overlay_tracker_delete (OverlayTracker * tracker);
1269 gboolean overlay_tracker_add (OverlayTracker * tracker, const char * appid, unsigned long pid, const char * url);
1270+gboolean overlay_tracker_badurl (OverlayTracker * tracker, unsigned long pid, const char * url);
1271
1272
1273=== added file 'service/scope-checker-facade.h'
1274--- service/scope-checker-facade.h 1970-01-01 00:00:00 +0000
1275+++ service/scope-checker-facade.h 2016-11-07 16:32:23 +0000
1276@@ -0,0 +1,27 @@
1277+/**
1278+ * Copyright © 2016 Canonical, Ltd.
1279+ *
1280+ * This program is free software: you can redistribute it and/or modify it under
1281+ * the terms of the GNU Lesser General Public License version 3, as published by
1282+ * the Free Software Foundation.
1283+ *
1284+ * This program is distributed in the hope that it will be useful, but WITHOUT
1285+ * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,
1286+ * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1287+ * Lesser General Public License for more details.
1288+ *
1289+ * You should have received a copy of the GNU Lesser General Public License
1290+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
1291+ *
1292+ */
1293+
1294+#pragma once
1295+
1296+#include <unity-scopes.h>
1297+
1298+class RuntimeFacade {
1299+public:
1300+ RuntimeFacade () = default;
1301+ virtual ~RuntimeFacade () = default;
1302+ virtual unity::scopes::RegistryProxy registry () = 0;
1303+};
1304
1305=== added file 'service/scope-checker.cpp'
1306--- service/scope-checker.cpp 1970-01-01 00:00:00 +0000
1307+++ service/scope-checker.cpp 2016-11-07 16:32:23 +0000
1308@@ -0,0 +1,114 @@
1309+/**
1310+ * Copyright © 2016 Canonical, Ltd.
1311+ *
1312+ * This program is free software: you can redistribute it and/or modify it under
1313+ * the terms of the GNU Lesser General Public License version 3, as published by
1314+ * the Free Software Foundation.
1315+ *
1316+ * This program is distributed in the hope that it will be useful, but WITHOUT
1317+ * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,
1318+ * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1319+ * Lesser General Public License for more details.
1320+ *
1321+ * You should have received a copy of the GNU Lesser General Public License
1322+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
1323+ *
1324+ */
1325+
1326+extern "C" {
1327+#include "scope-checker.h"
1328+#include <sys/apparmor.h>
1329+#include <ubuntu-app-launch.h>
1330+}
1331+
1332+#include <unity-scopes.h>
1333+#include "scope-checker-facade.h"
1334+
1335+class RuntimeReal : public RuntimeFacade {
1336+public:
1337+ unity::scopes::Runtime::UPtr runtime;
1338+ RuntimeReal () {
1339+ runtime = unity::scopes::Runtime::create();
1340+ }
1341+
1342+ unity::scopes::RegistryProxy registry () override {
1343+ return runtime->registry();
1344+ }
1345+};
1346+
1347+ScopeChecker *
1348+scope_checker_new ()
1349+{
1350+ auto fu_runtime = new RuntimeReal();
1351+ return reinterpret_cast<ScopeChecker *>(fu_runtime);
1352+}
1353+
1354+void
1355+scope_checker_delete (ScopeChecker * checker)
1356+{
1357+ auto runtime = reinterpret_cast<RuntimeFacade *>(checker);
1358+ delete runtime;
1359+}
1360+
1361+bool
1362+scope_checker_is_scope (ScopeChecker * checker, const char * appid)
1363+{
1364+ if (checker == nullptr) {
1365+ g_warning("%s:%d: Checker is '(null)'", __FILE__, __LINE__);
1366+ return false;
1367+ }
1368+ if (appid == nullptr) {
1369+ g_warning("%s:%d: appid is '(null)'", __FILE__, __LINE__);
1370+ return false;
1371+ }
1372+
1373+ auto runtime = reinterpret_cast<RuntimeFacade *>(checker);
1374+
1375+ try {
1376+ auto registry = runtime->registry();
1377+ registry->get_metadata(appid);
1378+ return true;
1379+ } catch (unity::scopes::NotFoundException e) {
1380+ return false;
1381+ } catch (...) {
1382+ g_warning("Unable to read the Unity Scopes Registry");
1383+ return false;
1384+ }
1385+}
1386+
1387+bool
1388+scope_checker_is_scope_pid (ScopeChecker * checker, pid_t pid)
1389+{
1390+ if (pid == 0)
1391+ return false;
1392+
1393+ char * aa = nullptr;
1394+ if (aa_gettaskcon(pid, &aa, nullptr) != 0) {
1395+ return false;
1396+ }
1397+
1398+ if (aa == nullptr)
1399+ return false;
1400+
1401+ std::string appid(aa);
1402+ free(aa);
1403+
1404+ if (appid == "unconfined") {
1405+ /* We're not going to support unconfined scopes, too hard */
1406+ return false;
1407+ }
1408+
1409+ gchar * pkg = nullptr;
1410+ gchar * app = nullptr;
1411+ if (ubuntu_app_launch_app_id_parse(appid.c_str(), &pkg, &app, nullptr)) {
1412+ appid= pkg;
1413+ appid += "_";
1414+ appid += app;
1415+
1416+ g_free(pkg);
1417+ g_free(app);
1418+ }
1419+
1420+ g_debug("PID %d is short App ID %s", pid, appid.c_str());
1421+ return scope_checker_is_scope(checker, appid.c_str());
1422+}
1423
1424=== added file 'service/scope-checker.h'
1425--- service/scope-checker.h 1970-01-01 00:00:00 +0000
1426+++ service/scope-checker.h 2016-11-07 16:32:23 +0000
1427@@ -0,0 +1,29 @@
1428+/**
1429+ * Copyright © 2016 Canonical, Ltd.
1430+ *
1431+ * This program is free software: you can redistribute it and/or modify it under
1432+ * the terms of the GNU Lesser General Public License version 3, as published by
1433+ * the Free Software Foundation.
1434+ *
1435+ * This program is distributed in the hope that it will be useful, but WITHOUT
1436+ * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,
1437+ * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1438+ * Lesser General Public License for more details.
1439+ *
1440+ * You should have received a copy of the GNU Lesser General Public License
1441+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
1442+ *
1443+ */
1444+
1445+#pragma once
1446+
1447+#include <sys/types.h>
1448+#include <stdbool.h>
1449+
1450+typedef struct _ScopeChecker ScopeChecker;
1451+
1452+ScopeChecker * scope_checker_new ();
1453+void scope_checker_delete (ScopeChecker * checker);
1454+bool scope_checker_is_scope (ScopeChecker * checker, const char * appid);
1455+bool scope_checker_is_scope_pid (ScopeChecker * checker, pid_t pid);
1456+
1457
1458=== modified file 'service/service.c'
1459--- service/service.c 2015-09-03 21:50:06 +0000
1460+++ service/service.c 2016-11-07 16:32:23 +0000
1461@@ -40,7 +40,14 @@
1462 guint term_source = g_unix_signal_add(SIGTERM, sig_term, mainloop);
1463
1464 OverlayTracker * tracker = overlay_tracker_new();
1465- if (!dispatcher_init(mainloop, tracker)) {
1466+
1467+ ScopeChecker * checker = NULL;
1468+ /* Allow disabing for testing */
1469+ if (g_getenv("URL_DISPATCHER_DISABLE_SCOPE_CHECKING") == NULL)
1470+ checker = scope_checker_new();
1471+
1472+ /* Initialize Dispatcher */
1473+ if (!dispatcher_init(mainloop, tracker, checker)) {
1474 return -1;
1475 }
1476
1477@@ -50,6 +57,7 @@
1478 /* Clean up globals */
1479 dispatcher_shutdown();
1480 overlay_tracker_delete(tracker);
1481+ scope_checker_delete(checker);
1482 g_source_remove(term_source);
1483 g_main_loop_unref(mainloop);
1484
1485
1486=== added directory 'service/url-overlay'
1487=== added file 'service/url-overlay/CMakeLists.txt'
1488--- service/url-overlay/CMakeLists.txt 1970-01-01 00:00:00 +0000
1489+++ service/url-overlay/CMakeLists.txt 2016-11-07 16:32:23 +0000
1490@@ -0,0 +1,14 @@
1491+
1492+###########################
1493+# URL Overlay Exec Tool
1494+###########################
1495+
1496+add_executable(url-overlay-exec-tool exec-tool.c ../recoverable-problem.c)
1497+set_target_properties(url-overlay-exec-tool PROPERTIES OUTPUT_NAME "exec-tool")
1498+target_link_libraries(url-overlay-exec-tool ${GIO2_LIBRARIES} ${UBUNTU_APP_LAUNCH_LIBRARIES} ${CLICK_LIBRARIES})
1499+
1500+install(
1501+ TARGETS url-overlay-exec-tool
1502+ RUNTIME DESTINATION "${CMAKE_INSTALL_FULL_LIBEXECDIR}/ubuntu-app-launch/url-overlay"
1503+)
1504+
1505
1506=== renamed file 'service/url-overlay.c' => 'service/url-overlay/exec-tool.c'
1507=== modified file 'tests/CMakeLists.txt'
1508--- tests/CMakeLists.txt 2015-06-11 21:38:13 +0000
1509+++ tests/CMakeLists.txt 2016-11-07 16:32:23 +0000
1510@@ -25,6 +25,8 @@
1511 ###########################
1512
1513 add_library(mock-lib STATIC
1514+ apparmor-mock.h
1515+ apparmor-mock.c
1516 recoverable-problem-mock.c
1517 ubuntu-app-launch-mock.h
1518 ubuntu-app-launch-mock.c)
1519@@ -62,6 +64,7 @@
1520 mock-lib
1521 gtest
1522 ${UBUNTU_APP_LAUNCH_LIBRARIES}
1523+ ${DBUSTEST_LIBRARIES}
1524 ${GTEST_LIBS})
1525
1526 add_test (dispatcher-test dispatcher-test)
1527
1528=== modified file 'tests/app-id-test.cc'
1529--- tests/app-id-test.cc 2015-05-15 21:24:15 +0000
1530+++ tests/app-id-test.cc 2016-11-07 16:32:23 +0000
1531@@ -23,6 +23,8 @@
1532 #include "ubuntu-app-launch-mock.h"
1533 #include "overlay-tracker-mock.h"
1534
1535+#include "ubuntu-app-launch/registry.h"
1536+
1537 class AppIdTest : public ::testing::Test
1538 {
1539 private:
1540@@ -33,9 +35,20 @@
1541
1542 protected:
1543 virtual void SetUp() {
1544+ /* Click DB Config */
1545 g_setenv("TEST_CLICK_DB", "click-db", TRUE);
1546 g_setenv("TEST_CLICK_USER", "test-user", TRUE);
1547
1548+ /* Make sure we don't use the local snapd */
1549+ g_setenv("UBUNTU_APP_LAUNCH_SNAPD_SOCKET", "/this/should/not/exist", TRUE);
1550+
1551+ /* UAL Desktop Hook check */
1552+ g_setenv("UBUNTU_APP_LAUNCH_LINK_FARM", CMAKE_SOURCE_DIR "/tests/ual-link-farm", TRUE);
1553+
1554+ /* XDG Data home for libertine */
1555+ g_setenv("XDG_DATA_HOME", CMAKE_SOURCE_DIR "/tests/xdg-data", TRUE);
1556+ g_setenv("XDG_CACHE_HOME", CMAKE_SOURCE_DIR "/tests/xdg-cache", TRUE);
1557+
1558 cachedir = g_build_filename(CMAKE_BINARY_DIR, "app-id-test-cache", nullptr);
1559 g_setenv("URL_DISPATCHER_CACHE_DIR", cachedir, TRUE);
1560
1561@@ -43,13 +56,14 @@
1562 g_test_dbus_up(testbus);
1563
1564 mainloop = g_main_loop_new(nullptr, FALSE);
1565- dispatcher_init(mainloop, reinterpret_cast<OverlayTracker *>(&tracker));
1566+ dispatcher_init(mainloop, reinterpret_cast<OverlayTracker *>(&tracker), nullptr);
1567
1568 return;
1569 }
1570
1571 virtual void TearDown() {
1572 dispatcher_shutdown();
1573+ ubuntu::app_launch::Registry::clearDefault();
1574
1575 /* Clean up queued events */
1576 while (g_main_pending()) {
1577@@ -88,6 +102,18 @@
1578 g_clear_pointer(&out_appid, g_free);
1579 out_url = nullptr;
1580
1581+ /* App ID with periods */
1582+ dispatcher_url_to_appid("appid://container-id/org.canonical.app1/0.0", &out_appid, &out_url);
1583+ ASSERT_STREQ("container-id_org.canonical.app1_0.0", out_appid);
1584+ EXPECT_EQ(nullptr, out_url);
1585+
1586+ dispatcher_send_to_app(out_appid, out_url);
1587+ EXPECT_STREQ("container-id_org.canonical.app1_0.0", ubuntu_app_launch_mock_get_last_app_id());
1588+
1589+ ubuntu_app_launch_mock_clear_last_app_id();
1590+ g_clear_pointer(&out_appid, g_free);
1591+ out_url = nullptr;
1592+
1593 /* No version at all */
1594 dispatcher_url_to_appid("appid://com.test.good/app1", &out_appid, &out_url);
1595
1596@@ -199,31 +225,3 @@
1597
1598 return;
1599 }
1600-
1601-TEST_F(AppIdTest, BadDirectory)
1602-{
1603- gchar * out_appid = nullptr;
1604- const gchar * out_url = nullptr;
1605-
1606- g_setenv("TEST_CLICK_DB", "not-click-db", TRUE);
1607-
1608- dispatcher_url_to_appid("appid://com.test.good/app1/current-user-version", &out_appid, &out_url);
1609-
1610- EXPECT_EQ(nullptr, out_appid);
1611- EXPECT_EQ(nullptr, out_url);
1612-
1613- return;
1614-}
1615-
1616-TEST_F(AppIdTest, BadUser)
1617-{
1618- gchar * out_appid = nullptr;
1619- const gchar * out_url = nullptr;
1620-
1621- g_setenv("TEST_CLICK_USER", "not-test-user", TRUE);
1622-
1623- dispatcher_url_to_appid("appid://com.test.good/app1/current-user-version", &out_appid, &out_url);
1624-
1625- EXPECT_EQ(nullptr, out_appid);
1626- EXPECT_EQ(nullptr, out_url);
1627-}
1628
1629=== added file 'tests/apparmor-mock.c'
1630--- tests/apparmor-mock.c 1970-01-01 00:00:00 +0000
1631+++ tests/apparmor-mock.c 2016-11-07 16:32:23 +0000
1632@@ -0,0 +1,36 @@
1633+/**
1634+ * Copyright © 2015 Canonical, Ltd.
1635+ *
1636+ * This program is free software: you can redistribute it and/or modify it under
1637+ * the terms of the GNU Lesser General Public License version 3, as published by
1638+ * the Free Software Foundation.
1639+ *
1640+ * This program is distributed in the hope that it will be useful, but WITHOUT
1641+ * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,
1642+ * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1643+ * Lesser General Public License for more details.
1644+ *
1645+ * You should have received a copy of the GNU Lesser General Public License
1646+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
1647+ *
1648+ */
1649+
1650+#include <glib.h>
1651+#include <sys/apparmor.h>
1652+
1653+const char * aa_mock_gettask_profile = NULL;
1654+
1655+int aa_gettaskcon (pid_t pid, char ** profile, char ** mode)
1656+{
1657+ g_debug("Gettask Con '%s'", aa_mock_gettask_profile);
1658+
1659+ if (aa_mock_gettask_profile == NULL) {
1660+ return 1;
1661+ }
1662+
1663+ if (profile != NULL) {
1664+ *profile = g_strdup(aa_mock_gettask_profile);
1665+ }
1666+
1667+ return 0;
1668+}
1669
1670=== added file 'tests/apparmor-mock.h'
1671--- tests/apparmor-mock.h 1970-01-01 00:00:00 +0000
1672+++ tests/apparmor-mock.h 2016-11-07 16:32:23 +0000
1673@@ -0,0 +1,20 @@
1674+/**
1675+ * Copyright © 2015 Canonical, Ltd.
1676+ *
1677+ * This program is free software: you can redistribute it and/or modify it under
1678+ * the terms of the GNU Lesser General Public License version 3, as published by
1679+ * the Free Software Foundation.
1680+ *
1681+ * This program is distributed in the hope that it will be useful, but WITHOUT
1682+ * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,
1683+ * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1684+ * Lesser General Public License for more details.
1685+ *
1686+ * You should have received a copy of the GNU Lesser General Public License
1687+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
1688+ *
1689+ */
1690+
1691+#pragma once
1692+
1693+extern const char * aa_mock_gettask_profile;
1694
1695=== modified file 'tests/click-data/manifests/com.test.good.manifest'
1696--- tests/click-data/manifests/com.test.good.manifest 2013-09-18 04:16:51 +0000
1697+++ tests/click-data/manifests/com.test.good.manifest 2016-11-07 16:32:23 +0000
1698@@ -3,7 +3,7 @@
1699 "name": "com.test.good",
1700 "hooks": {
1701 "app1": {
1702- "test": "test"
1703+ "desktop": "app1.desktop"
1704 }
1705 }
1706 }
1707
1708=== modified file 'tests/click-data/manifests/com.test.multiple.manifest'
1709--- tests/click-data/manifests/com.test.multiple.manifest 2013-09-26 20:30:45 +0000
1710+++ tests/click-data/manifests/com.test.multiple.manifest 2016-11-07 16:32:23 +0000
1711@@ -3,13 +3,13 @@
1712 "name": "com.test.good",
1713 "hooks": {
1714 "app-first": {
1715- "test": "test"
1716+ "desktop": "app-first.desktop"
1717 },
1718 "app-middle": {
1719- "test": "test"
1720+ "desktop": "app-middle.desktop"
1721 },
1722 "app-last": {
1723- "test": "test"
1724+ "desktop": "app-last.desktop"
1725 }
1726 }
1727 }
1728
1729=== modified file 'tests/dispatcher-test.cc'
1730--- tests/dispatcher-test.cc 2015-06-08 17:13:44 +0000
1731+++ tests/dispatcher-test.cc 2016-11-07 16:32:23 +0000
1732@@ -19,10 +19,13 @@
1733
1734 #include <gio/gio.h>
1735 #include <gtest/gtest.h>
1736+#include <libdbustest/dbus-test.h>
1737 #include "dispatcher.h"
1738 #include "ubuntu-app-launch-mock.h"
1739 #include "overlay-tracker-mock.h"
1740 #include "url-db.h"
1741+#include "scope-mock.h"
1742+#include "apparmor-mock.h"
1743
1744 class DispatcherTest : public ::testing::Test
1745 {
1746@@ -33,6 +36,7 @@
1747
1748 protected:
1749 OverlayTrackerMock tracker;
1750+ RuntimeMock scope_runtime;
1751 GDBusConnection * session = nullptr;
1752
1753 virtual void SetUp() {
1754@@ -66,6 +70,9 @@
1755 url_db_set_file_motification_time(db, "/testdir/intenter.url-dispatcher", &timestamp);
1756 url_db_insert_url(db, "/testdir/intenter.url-dispatcher", "intent", "my.android.package");
1757
1758+ url_db_set_file_motification_time(db, "/testdir/scoper.url-dispatcher", &timestamp);
1759+ url_db_insert_url(db, "/testdir/scoper.url-dispatcher", "scope", nullptr);
1760+
1761 sqlite3_close(db);
1762
1763 testbus = g_test_dbus_new(G_TEST_DBUS_NONE);
1764@@ -74,7 +81,7 @@
1765 session = g_bus_get_sync(G_BUS_TYPE_SESSION, NULL, NULL);
1766
1767 mainloop = g_main_loop_new(nullptr, FALSE);
1768- dispatcher_init(mainloop, reinterpret_cast<OverlayTracker *>(&tracker));
1769+ dispatcher_init(mainloop, reinterpret_cast<OverlayTracker *>(&tracker), reinterpret_cast<ScopeChecker *>(&scope_runtime));
1770
1771 return;
1772 }
1773@@ -90,6 +97,7 @@
1774 g_main_loop_unref(mainloop);
1775
1776 ubuntu_app_launch_mock_clear_last_app_id();
1777+ scope_runtime.clearExceptions();
1778
1779 /* let other threads settle */
1780 g_usleep(500000);
1781@@ -260,6 +268,42 @@
1782 return;
1783 }
1784
1785+DbusTestDbusMock *
1786+setupUpstartMock ()
1787+{
1788+ auto mock = dbus_test_dbus_mock_new("com.ubuntu.Upstart");
1789+ auto obj = dbus_test_dbus_mock_get_object(mock, "/com/ubuntu/Upstart", "com.ubuntu.Upstart0_6", nullptr);
1790+
1791+ dbus_test_dbus_mock_object_add_method(mock, obj,
1792+ "GetJobByName",
1793+ G_VARIANT_TYPE_STRING,
1794+ G_VARIANT_TYPE_OBJECT_PATH, /* out */
1795+ "ret = dbus.ObjectPath('/job')", /* python */
1796+ nullptr); /* error */
1797+
1798+ auto jobobj = dbus_test_dbus_mock_get_object(mock, "/job", "com.ubuntu.Upstart0_6.Job", nullptr);
1799+
1800+ dbus_test_dbus_mock_object_add_method(mock, jobobj,
1801+ "GetInstanceByName",
1802+ G_VARIANT_TYPE_STRING,
1803+ G_VARIANT_TYPE_OBJECT_PATH, /* out */
1804+ "ret = dbus.ObjectPath('/instance')", /* python */
1805+ NULL); /* error */
1806+
1807+ auto instobj = dbus_test_dbus_mock_get_object(mock, "/instance", "com.ubuntu.Upstart0_6.Instance", NULL);
1808+
1809+ dbus_test_dbus_mock_object_add_property(mock, instobj,
1810+ "processes",
1811+ G_VARIANT_TYPE("a(si)"),
1812+ g_variant_new_parsed("[('main', 1234)]"),
1813+ NULL);
1814+
1815+ dbus_test_task_set_name(DBUS_TEST_TASK(mock), "Upstart");
1816+ dbus_test_task_run(DBUS_TEST_TASK(mock));
1817+
1818+ return mock;
1819+}
1820+
1821 TEST_F(DispatcherTest, OverlayTest)
1822 {
1823 EXPECT_TRUE(dispatcher_is_overlay("com.test.good_application_1.2.3"));
1824@@ -272,5 +316,44 @@
1825 EXPECT_EQ(getpid(), std::get<1>(tracker.addedOverlays[0]));
1826 EXPECT_EQ("overlay://ubuntu.com", std::get<2>(tracker.addedOverlays[0]));
1827
1828+ tracker.addedOverlays.clear();
1829+ aa_mock_gettask_profile = "simplescope.scopemaster_simplescope_1.2.3";
1830+
1831+ auto upstartMock = setupUpstartMock();
1832+
1833+ EXPECT_TRUE(dispatcher_send_to_overlay ("com.test.good_application_1.2.3", "overlay://ubuntu.com", session, g_dbus_connection_get_unique_name(session)));
1834+
1835+ ASSERT_EQ(1, tracker.addedOverlays.size());
1836+ EXPECT_EQ("com.test.good_application_1.2.3", std::get<0>(tracker.addedOverlays[0]));
1837+ EXPECT_EQ(1234, std::get<1>(tracker.addedOverlays[0]));
1838+ EXPECT_EQ("overlay://ubuntu.com", std::get<2>(tracker.addedOverlays[0]));
1839+
1840+ g_object_unref(upstartMock);
1841+
1842 return;
1843 }
1844+
1845+TEST_F(DispatcherTest, ScopeTest)
1846+{
1847+ gchar * out_appid = nullptr;
1848+
1849+ unity::scopes::NotFoundException scopeException("test", "badscope");
1850+ scope_runtime.addException("badscope.scopemaster_badscope", scopeException);
1851+ std::invalid_argument invalidException("confused");
1852+ scope_runtime.addException("confusedscope.scopemaster_confusedscope", invalidException);
1853+
1854+ /* Good sanity check */
1855+ dispatcher_url_to_appid("scope://simplescope.scopemaster_simplescope", &out_appid, nullptr);
1856+ EXPECT_STREQ("scoper", out_appid);
1857+ g_free(out_appid);
1858+
1859+ /* Bad scope */
1860+ dispatcher_url_to_appid("scope://badscope.scopemaster_badscope", &out_appid, nullptr);
1861+ EXPECT_STRNE("scoper", out_appid);
1862+ g_free(out_appid);
1863+
1864+ /* Confused scope */
1865+ dispatcher_url_to_appid("scope://confusedscope.scopemaster_confusedscope", &out_appid, nullptr);
1866+ EXPECT_STRNE("scoper", out_appid);
1867+ g_free(out_appid);
1868+}
1869
1870=== modified file 'tests/overlay-tracker-mock.h'
1871--- tests/overlay-tracker-mock.h 2015-05-19 20:24:47 +0000
1872+++ tests/overlay-tracker-mock.h 2016-11-07 16:32:23 +0000
1873@@ -22,9 +22,15 @@
1874 {
1875 public:
1876 std::vector<std::tuple<std::string, unsigned long, std::string>> addedOverlays;
1877+ std::vector<std::pair<unsigned long, std::string>> addedBadUrl;
1878
1879 bool addOverlay (const char * appid, unsigned long pid, const char * url) {
1880 addedOverlays.push_back(std::make_tuple(std::string(appid), pid, std::string(url)));
1881 return true;
1882 }
1883+
1884+ bool badUrl (unsigned long pid, const char * url) {
1885+ addedBadUrl.push_back(std::make_pair(pid, std::string(url)));
1886+ return true;
1887+ }
1888 };
1889
1890=== modified file 'tests/overlay-tracker-test.cpp'
1891--- tests/overlay-tracker-test.cpp 2015-05-19 20:24:47 +0000
1892+++ tests/overlay-tracker-test.cpp 2016-11-07 16:32:23 +0000
1893@@ -95,23 +95,43 @@
1894 }
1895 }
1896
1897-TEST_F(OverlayTrackerTest, UALSignalStop) {
1898- OverlayTrackerMir tracker;
1899+void
1900+ualStop (const char * helper_type, std::function<bool(OverlayTrackerMir *)> addFunc)
1901+{
1902+ auto tracker = new OverlayTrackerMir();
1903
1904 /* Call with the overlay before it is set */
1905- ubuntu_app_launch_mock_observer_helper_stop_func("app-id", "instance", "url-overlay", ubuntu_app_launch_mock_observer_helper_stop_user_data);
1906+ ubuntu_app_launch_mock_observer_helper_stop_func("app-id", "instance", helper_type, ubuntu_app_launch_mock_observer_helper_stop_user_data);
1907
1908- EXPECT_TRUE(tracker.addOverlay("app-id", 5, "http://no-name-yet.com"));
1909+ EXPECT_TRUE(addFunc(tracker));
1910
1911 mir_mock_last_released_session = nullptr;
1912- ubuntu_app_launch_mock_observer_helper_stop_func("app-id", "instance", "url-overlay", ubuntu_app_launch_mock_observer_helper_stop_user_data);
1913+ ubuntu_app_launch_mock_observer_helper_stop_func("app-id", "instance", helper_type, ubuntu_app_launch_mock_observer_helper_stop_user_data);
1914+
1915+ delete tracker;
1916+
1917 EXPECT_NE(nullptr, mir_mock_last_released_session);
1918 }
1919
1920-TEST_F(OverlayTrackerTest, MirSignalStop) {
1921- OverlayTrackerMir tracker;
1922-
1923- EXPECT_TRUE(tracker.addOverlay("app-id", 5, "http://no-name-yet.com"));
1924+TEST_F(OverlayTrackerTest, UALSignalStop) {
1925+ ualStop("url-overlay", [](OverlayTrackerMir * tracker) {
1926+ return tracker->addOverlay("app-id", 5, "http://no-name-yet.com");
1927+ });
1928+ ualStop("bad-url", [](OverlayTrackerMir * tracker) {
1929+ return tracker->badUrl(5, "http://no-name-yet.com");
1930+ });
1931+}
1932+
1933+void
1934+mirStop (const char * helper_type, const char * appid, std::function<bool(OverlayTrackerMir *)> addFunc)
1935+{
1936+ g_clear_pointer(&ubuntu_app_launch_mock_last_stop_helper, g_free);
1937+ g_clear_pointer(&ubuntu_app_launch_mock_last_stop_appid, g_free);
1938+ g_clear_pointer(&ubuntu_app_launch_mock_last_stop_instance, g_free);
1939+
1940+ auto tracker = new OverlayTrackerMir();
1941+
1942+ EXPECT_TRUE(addFunc(tracker));
1943
1944 /* Try a badie */
1945 mir_mock_last_trust_func((MirPromptSession *)1337, mir_prompt_session_state_stopped, mir_mock_last_trust_data);
1946@@ -119,9 +139,18 @@
1947 EXPECT_NE(nullptr, mir_mock_last_trust_func);
1948 mir_mock_last_trust_func(mir_mock_valid_trust_session, mir_prompt_session_state_stopped, mir_mock_last_trust_data);
1949
1950- pause(100);
1951+ delete tracker;
1952
1953- EXPECT_STREQ("url-overlay", ubuntu_app_launch_mock_last_stop_helper);
1954- EXPECT_STREQ("app-id", ubuntu_app_launch_mock_last_stop_appid);
1955+ EXPECT_STREQ(helper_type, ubuntu_app_launch_mock_last_stop_helper);
1956+ EXPECT_STREQ(appid, ubuntu_app_launch_mock_last_stop_appid);
1957 EXPECT_STREQ("instance", ubuntu_app_launch_mock_last_stop_instance);
1958 }
1959+
1960+TEST_F(OverlayTrackerTest, MirSignalStop) {
1961+ mirStop("url-overlay", "app-id", [](OverlayTrackerMir * tracker) {
1962+ return tracker->addOverlay("app-id", 5, "http://no-name-yet.com");
1963+ });
1964+ mirStop("bad-url", "url-dispatcher-bad-url-helper", [](OverlayTrackerMir * tracker) {
1965+ return tracker->badUrl(5, "http://no-name-yet.com");
1966+ });
1967+}
1968
1969=== added file 'tests/scope-mock.h'
1970--- tests/scope-mock.h 1970-01-01 00:00:00 +0000
1971+++ tests/scope-mock.h 2016-11-07 16:32:23 +0000
1972@@ -0,0 +1,95 @@
1973+/**
1974+ * Copyright © 2015 Canonical, Ltd.
1975+ *
1976+ * This program is free software: you can redistribute it and/or modify it under
1977+ * the terms of the GNU Lesser General Public License version 3, as published by
1978+ * the Free Software Foundation.
1979+ *
1980+ * This program is distributed in the hope that it will be useful, but WITHOUT
1981+ * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,
1982+ * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1983+ * Lesser General Public License for more details.
1984+ *
1985+ * You should have received a copy of the GNU Lesser General Public License
1986+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
1987+ *
1988+ */
1989+
1990+#include <unity-scopes.h>
1991+#include <unity/scopes/testing/ScopeMetadataBuilder.h>
1992+
1993+#include "scope-checker-facade.h"
1994+
1995+class unity::scopes::internal::ScopeMetadataImpl {
1996+public:
1997+ ScopeMetadataImpl () { }
1998+ virtual ~ScopeMetadataImpl () {}
1999+
2000+};
2001+
2002+/********
2003+ TODO: Look at replacing this with: #include <unity/scopes/testing/MockRegistry.h>
2004+ *******/
2005+
2006+class RegistryMock : public virtual unity::scopes::Registry
2007+{
2008+ std::shared_ptr<std::map<std::string, std::exception>> scopeExceptions;
2009+
2010+public:
2011+ RegistryMock (std::shared_ptr<std::map<std::string, std::exception>> inexceptions)
2012+ : scopeExceptions(inexceptions)
2013+ {
2014+ }
2015+
2016+ unity::scopes::ScopeMetadata get_metadata(std::string const& scope_id) override {
2017+ std::cout << "Getting Metadata" << std::endl;
2018+ try {
2019+ auto exp = scopeExceptions->at(scope_id);
2020+ throw exp;
2021+ } catch (std::out_of_range e) {
2022+ unity::scopes::testing::ScopeMetadataBuilder builder;
2023+ builder.scope_id(scope_id);
2024+ std::shared_ptr<unity::scopes::Scope> foo((unity::scopes::Scope *)5, [](unity::scopes::Scope *) { return; });
2025+ builder.proxy(foo);
2026+ builder.display_name("foo");
2027+ builder.description("foo");
2028+ builder.author("foo");
2029+ return builder();
2030+ }
2031+ }
2032+
2033+ /* I hate C++ so much right now */
2034+ std::string endpoint() override { throw new std::invalid_argument("Not implemented"); }
2035+ std::string identity() override { throw new std::invalid_argument("Not implemented"); }
2036+ std::string target_category() override { throw new std::invalid_argument("Not implemented"); }
2037+ std::string to_string() override { throw new std::invalid_argument("Not implemented"); }
2038+ int64_t timeout() override { throw new std::invalid_argument("Not implemented"); }
2039+ unity::scopes::MetadataMap list() override { throw new std::invalid_argument("Not implemented"); }
2040+ unity::scopes::MetadataMap list_if(std::function<bool(unity::scopes::ScopeMetadata const& item)>) override { throw new std::invalid_argument("Not implemented"); }
2041+ bool is_scope_running(std::string const&) override { throw new std::invalid_argument("Not implemented"); }
2042+ core::ScopedConnection set_scope_state_callback(std::string const&, std::function<void(bool is_running)>) override { throw new std::invalid_argument("Not implemented"); }
2043+ core::ScopedConnection set_list_update_callback(std::function<void()>) override { throw new std::invalid_argument("Not implemented"); }
2044+};
2045+
2046+class RuntimeMock : public RuntimeFacade
2047+{
2048+ std::shared_ptr<std::map<std::string, std::exception>> scopeExceptions;
2049+
2050+public:
2051+ RuntimeMock() {
2052+ scopeExceptions = std::make_shared<std::map<std::string, std::exception>>();
2053+ }
2054+
2055+ unity::scopes::RegistryProxy registry () {
2056+ return std::make_shared<RegistryMock>(scopeExceptions);
2057+ }
2058+
2059+ void clearExceptions() {
2060+ scopeExceptions->clear();
2061+ }
2062+
2063+ void addException (std::string scopeid, std::exception exp) {
2064+ (*scopeExceptions)[scopeid] = exp;
2065+ }
2066+};
2067+
2068
2069=== modified file 'tests/service-test.cc'
2070--- tests/service-test.cc 2015-05-20 16:27:27 +0000
2071+++ tests/service-test.cc 2016-11-07 16:32:23 +0000
2072@@ -38,6 +38,7 @@
2073 virtual void SetUp() {
2074 g_setenv("UBUNTU_APP_LAUNCH_USE_SESSION", "1", TRUE);
2075 g_setenv("URL_DISPATCHER_DISABLE_RECOVERABLE_ERROR", "1", TRUE);
2076+ g_setenv("URL_DISPATCHER_DISABLE_SCOPE_CHECKING", "1", TRUE);
2077 g_setenv("XDG_DATA_DIRS", XDG_DATA_DIRS, TRUE);
2078 g_setenv("LD_PRELOAD", MIR_MOCK_PATH, TRUE);
2079
2080@@ -95,6 +96,10 @@
2081 }
2082
2083 virtual void TearDown() {
2084+ gchar * cmdline = g_strdup_printf("kill -TERM %d", dbus_test_process_get_pid(dispatcher));
2085+ g_spawn_command_line_sync(cmdline, nullptr, nullptr, nullptr, nullptr);
2086+ g_free(cmdline);
2087+
2088 g_clear_object(&dispatcher);
2089 g_clear_object(&mock);
2090 g_clear_object(&dashmock);
2091@@ -123,7 +128,7 @@
2092 GTimeVal time = {0, 0};
2093 time.tv_sec = 5;
2094 url_db_set_file_motification_time(db, "/unity8-dash.url-dispatcher", &time);
2095- url_db_insert_url(db, "/unity8-dash.url-dispatcher", "scope", nullptr);
2096+ url_db_insert_url(db, "/unity8-dash.url-dispatcher", "scopeish", nullptr);
2097 sqlite3_close(db);
2098 }
2099
2100@@ -271,7 +276,7 @@
2101 GMainLoop * main = g_main_loop_new(nullptr, FALSE);
2102
2103 /* Send an invalid URL */
2104- url_dispatch_send("scope://foo-bar", simple_cb, main);
2105+ url_dispatch_send("scopeish://foo-bar", simple_cb, main);
2106
2107 /* Give it some time to send and reply */
2108 g_main_loop_run(main);
2109@@ -288,7 +293,7 @@
2110 calls = dbus_test_dbus_mock_object_get_method_calls(dashmock, fdoobj, "Open", &callslen, nullptr);
2111
2112 EXPECT_EQ(1, callslen);
2113- EXPECT_TRUE(g_variant_equal(calls[0].params, g_variant_new_parsed("(['scope://foo-bar'], @a{sv} {})")));
2114+ EXPECT_TRUE(g_variant_equal(calls[0].params, g_variant_new_parsed("(['scopeish://foo-bar'], @a{sv} {})")));
2115
2116 EXPECT_EQ(1, focus_count);
2117
2118
2119=== modified file 'tests/test-config.h.in'
2120--- tests/test-config.h.in 2015-06-08 16:39:15 +0000
2121+++ tests/test-config.h.in 2016-11-07 16:32:23 +0000
2122@@ -11,6 +11,6 @@
2123 #define UPDATE_DIRECTORY_VARIED "@CMAKE_CURRENT_SOURCE_DIR@/test-urls-varied"
2124 #define UPDATE_DIRECTORY_INTENT "@CMAKE_CURRENT_SOURCE_DIR@/test-urls-intent"
2125 #define OVERLAY_TEST_DIR "@CMAKE_CURRENT_SOURCE_DIR@/overlay-dir"
2126-#define EXEC_TOOL "@CMAKE_BINARY_DIR@/service/exec-tool"
2127+#define EXEC_TOOL "@CMAKE_BINARY_DIR@/service/url-overlay/exec-tool"
2128 #define MIR_MOCK_PATH "@CMAKE_CURRENT_BINARY_DIR@/libmir-mock.so"
2129 #define CLICK_DATA_DIR "@CMAKE_CURRENT_SOURCE_DIR@/click-data"
2130
2131=== added directory 'tests/ual-link-farm'
2132=== added file 'tests/ual-link-farm/com.test.good_app1_1.2.3.desktop'
2133--- tests/ual-link-farm/com.test.good_app1_1.2.3.desktop 1970-01-01 00:00:00 +0000
2134+++ tests/ual-link-farm/com.test.good_app1_1.2.3.desktop 2016-11-07 16:32:23 +0000
2135@@ -0,0 +1,1 @@
2136+Needs to exist
2137
2138=== added file 'tests/ual-link-farm/com.test.multiple_app-first_1.2.3.desktop'
2139--- tests/ual-link-farm/com.test.multiple_app-first_1.2.3.desktop 1970-01-01 00:00:00 +0000
2140+++ tests/ual-link-farm/com.test.multiple_app-first_1.2.3.desktop 2016-11-07 16:32:23 +0000
2141@@ -0,0 +1,1 @@
2142+Needs to exist
2143
2144=== added directory 'tests/xdg-cache'
2145=== added directory 'tests/xdg-cache/libertine-container'
2146=== added directory 'tests/xdg-cache/libertine-container/container-id'
2147=== added directory 'tests/xdg-cache/libertine-container/container-id/rootfs'
2148=== added directory 'tests/xdg-cache/libertine-container/container-id/rootfs/usr'
2149=== added directory 'tests/xdg-cache/libertine-container/container-id/rootfs/usr/share'
2150=== added directory 'tests/xdg-cache/libertine-container/container-id/rootfs/usr/share/applications'
2151=== added file 'tests/xdg-cache/libertine-container/container-id/rootfs/usr/share/applications/org.canonical.app1.desktop'
2152--- tests/xdg-cache/libertine-container/container-id/rootfs/usr/share/applications/org.canonical.app1.desktop 1970-01-01 00:00:00 +0000
2153+++ tests/xdg-cache/libertine-container/container-id/rootfs/usr/share/applications/org.canonical.app1.desktop 2016-11-07 16:32:23 +0000
2154@@ -0,0 +1,4 @@
2155+[Desktop File]
2156+Name=App1
2157+Exec=app1
2158+Icon=app1.png
2159
2160=== modified file 'tests/xdg-data/applications/foo-bar.desktop'
2161--- tests/xdg-data/applications/foo-bar.desktop 2014-09-17 22:12:21 +0000
2162+++ tests/xdg-data/applications/foo-bar.desktop 2016-11-07 16:32:23 +0000
2163@@ -2,3 +2,4 @@
2164 Name=Foo Bar
2165 Exec=foo-bar
2166 Type=Application
2167+Icon=foo-bar.png
2168
2169=== added directory 'tests/xdg-data/libertine'
2170=== added file 'tests/xdg-data/libertine/ContainersConfig.json'
2171--- tests/xdg-data/libertine/ContainersConfig.json 1970-01-01 00:00:00 +0000
2172+++ tests/xdg-data/libertine/ContainersConfig.json 2016-11-07 16:32:23 +0000
2173@@ -0,0 +1,14 @@
2174+{
2175+ "containerList": [
2176+ {
2177+ "distro": "xenial",
2178+ "id": "container-id",
2179+ "installStatus": "ready",
2180+ "installedApps": [],
2181+ "multiarch": "disabled",
2182+ "name": "Ubuntu 'Xenial Xerus'",
2183+ "type": "lxc"
2184+ }
2185+ ],
2186+ "defaultContainer": "container-id"
2187+}

Subscribers

People subscribed via source and target branches