Merge lp:~abreu-alexandre/webbrowser-app/remove-qtwebkit-deps into lp:webbrowser-app

Proposed by David Barth
Status: Merged
Approved by: Olivier Tilloy
Approved revision: 957
Merged at revision: 963
Proposed branch: lp:~abreu-alexandre/webbrowser-app/remove-qtwebkit-deps
Merge into: lp:webbrowser-app
Diff against target: 1539 lines (+14/-1266)
20 files modified
debian/control (+1/-5)
src/Ubuntu/Components/Extras/Browser/ItemSelector01.qml (+0/-63)
src/Ubuntu/Components/Extras/Browser/UbuntuWebView01.qml (+0/-278)
src/Ubuntu/Components/Extras/Browser/UserAgent01.qml (+0/-90)
src/Ubuntu/Components/Extras/Browser/dummysingleton.qml (+0/-28)
src/Ubuntu/Components/Extras/Browser/hyperlinks.js (+0/-52)
src/Ubuntu/Components/Extras/Browser/qmldir (+0/-4)
src/Ubuntu/Components/Extras/Browser/selection01.js (+0/-200)
src/Ubuntu/Components/Extras/Browser/ua-overrides.js (+0/-115)
src/Ubuntu/Web/plugin.cpp (+0/-13)
src/app/BrowserWindow.qml (+0/-1)
src/app/PermissionRequest.qml (+0/-47)
src/app/webcontainer/WebApp.qml (+10/-21)
src/app/webcontainer/WebViewImplWebkit.qml (+0/-173)
src/app/webcontainer/WebappContainerWebview.qml (+1/-5)
src/app/webcontainer/webapp-container.cpp (+1/-38)
src/app/webcontainer/webapp-container.h (+0/-1)
src/app/webcontainer/webapp-container.qml (+1/-3)
tests/unittests/qml/tst_UbuntuWebView01.qml (+0/-46)
tests/unittests/qml/tst_UserAgent01.qml (+0/-83)
To merge this branch: bzr merge lp:~abreu-alexandre/webbrowser-app/remove-qtwebkit-deps
Reviewer Review Type Date Requested Status
Olivier Tilloy Approve
PS Jenkins bot continuous-integration Approve
David Barth (community) Needs Fixing
Timo Jyrinki Approve
Review via email: mp+254291@code.launchpad.net

Commit message

remove qtwebkit deps (LP: #1362640)

Description of the change

remove qtwebkit deps

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Timo Jyrinki (timo-jyrinki) wrote :

You should not touch the debian/changelog, it will be automatically changed by CI Train based on what commit message you set here (currently empty, but I'll set it according the description).

review: Needs Fixing
Revision history for this message
Olivier Tilloy (osomon) wrote :

Looks good, thanks for doing this!
A few minor fixes:

 - as pointed by Timo, please revert the changes to debian/changelog

 - getQtWebkitDpr() should be removed from src/Ubuntu/Web/plugin.cpp

 - src/Ubuntu/Components/Extras/Browser/hyperlinks.js should be removed

 - src/Ubuntu/Components/Extras/Browser/ua-overrides.js should be removed

 - description of qtdeclarative5-ubuntu-ui-extras-browser-plugin in debian/control should be updated to remove the mention of version 0.1 of the module

 - currentArchitecturePathName() should be removed from src/app/webcontainer/webapp-container.cpp

review: Needs Fixing
Revision history for this message
Alexandre Abreu (abreu-alexandre) wrote :

updated

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Olivier Tilloy (osomon) wrote :

This looks good now.

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Timo Jyrinki (timo-jyrinki) :
review: Approve
948. By Launchpad Translations on behalf of phablet-team

Launchpad automatic translations update.

Revision history for this message
David Barth (dbarth) wrote :

There is still an error in /usr/share/webbrowser-app/webcontainer/webapp-container.qml line 241, where there is a reference to that 'oxide' variable that got removed.

review: Needs Fixing
949. By Olivier Tilloy

Use the new locationBarController API available in oxide 1.5 to control the position of the chrome. Fixes: #1365179, #1429132
Approved by: Alexandre Abreu

950. By Olivier Tilloy

Rewrite URLs with an uppercase scheme. Fixes: #1436312

951. By Olivier Tilloy

Remove two broken symlinks.

952. By Olivier Tilloy

Always initialize member attribute at construction time.

Not really an issue here, but flagged by coverity (https://scan.coverity.com/projects/4565), and easy enough to address.

953. By CI Train Bot Account

Releasing 0.23+15.04.20150331.2-0ubuntu1

954. By CI Train Bot Account

Resync trunk.

955. By Launchpad Translations on behalf of phablet-team

Launchpad automatic translations update.

Revision history for this message
Olivier Tilloy (osomon) wrote :

There is now a conflict when merging this branch into the latest trunk, can you please fix it?

Additionally, you’ll need to remove a bunch of references to 'webapp.oxide' from src/app/webcontainer/WebApp.qml.

And the following line can be removed from src/app/BrowserWindow.qml:

    ignoreUnknownSignals: true (line 42)

review: Needs Fixing
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Olivier Tilloy (osomon) wrote :

972 - topMargin: (webapp.oxide || webapp.chromeless) ? 0 : chromeLoader.item.height
973 + topMargin: webapp.chromeless ? 0 : chromeLoader.item.height

The above change is incorrect, the top margin should now always be 0. So the line can be removed altogether.

The ChromeController instance doesn’t need to be inside a Loader any longer, as it’s always instantiated anyway.

review: Needs Fixing
Revision history for this message
Alexandre Abreu (abreu-alexandre) wrote :

> 972 - topMargin: (webapp.oxide || webapp.chromeless) ? 0 :
> chromeLoader.item.height
> 973 + topMargin: webapp.chromeless ? 0 :
> chromeLoader.item.height
>
> The above change is incorrect, the top margin should now always be 0. So the
> line can be removed altogether.
>
>
> The ChromeController instance doesn’t need to be inside a Loader any longer,
> as it’s always instantiated anyway.

good catch, updated

956. By Alexandre Abreu

Remove qtwebkit dependencies

Revision history for this message
Olivier Tilloy (osomon) wrote :

One more file can be removed, as it’s not referenced anywhere any longer: src/app/PermissionRequest.qml.

Other than that, all looks good now.

review: Needs Fixing
957. By Alexandre Abreu

remove trailing file

Revision history for this message
Olivier Tilloy (osomon) wrote :

Looks good now, thanks!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/control'
2--- debian/control 2015-04-07 17:10:56 +0000
3+++ debian/control 2015-04-09 13:12:19 +0000
4@@ -12,7 +12,6 @@
5 python3-all,
6 qml-module-qtquick2 (>= 5.4) | qtdeclarative5-qtquick2-plugin (>= 5.4),
7 qml-module-qttest | qtdeclarative5-test-plugin,
8- qml-module-qtwebkit,
9 qt5-default,
10 qt5-qmake,
11 qtbase5-dev (>= 5.4),
12@@ -63,7 +62,6 @@
13 libqt5sql5-sqlite,
14 qml-module-qtquick2 | qtdeclarative5-qtquick2-plugin,
15 qml-module-qtquick-window2 | qtdeclarative5-window-plugin,
16- qml-module-qtwebkit,
17 qtdeclarative5-accounts-plugin,
18 qtdeclarative5-ubuntu-ui-extras-browser-plugin (= ${binary:Version}),
19 qtdeclarative5-ubuntu-web-plugin (= ${binary:Version}),
20@@ -83,15 +81,13 @@
21 ${shlibs:Depends},
22 qml-module-qtquick2 | qtdeclarative5-qtquick2-plugin,
23 qml-module-qtquick-window2 | qtdeclarative5-window-plugin,
24- qml-module-qtwebkit,
25 qtdeclarative5-ubuntu-ui-toolkit-plugin,
26 qtdeclarative5-ubuntu-web-plugin (= ${binary:Version}),
27 Replaces: webbrowser-app (<< 0.21)
28 Breaks: webbrowser-app (<< 0.21)
29 Description: Ubuntu web QML plugin
30 A standalone QML plugin that contains the UbuntuWebView component
31- (versions 0.1 based on WebKit and 0.2 based on Oxide), in the
32- Ubuntu.Components.Extras.Browser module.
33+ , in the Ubuntu.Components.Extras.Browser module.
34
35 Package: qtdeclarative5-ubuntu-web-plugin
36 Architecture: any
37
38=== removed file 'src/Ubuntu/Components/Extras/Browser/ItemSelector01.qml'
39--- src/Ubuntu/Components/Extras/Browser/ItemSelector01.qml 2014-07-29 21:51:07 +0000
40+++ src/Ubuntu/Components/Extras/Browser/ItemSelector01.qml 1970-01-01 00:00:00 +0000
41@@ -1,63 +0,0 @@
42-/*
43- * Copyright 2013-2014 Canonical Ltd.
44- *
45- * This file is part of webbrowser-app.
46- *
47- * webbrowser-app is free software; you can redistribute it and/or modify
48- * it under the terms of the GNU General Public License as published by
49- * the Free Software Foundation; version 3.
50- *
51- * webbrowser-app is distributed in the hope that it will be useful,
52- * but WITHOUT ANY WARRANTY; without even the implied warranty of
53- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
54- * GNU General Public License for more details.
55- *
56- * You should have received a copy of the GNU General Public License
57- * along with this program. If not, see <http://www.gnu.org/licenses/>.
58- */
59-
60-import QtQuick 2.0
61-import Ubuntu.Components 1.1
62-import Ubuntu.Components.ListItems 1.0 as ListItem
63-import Ubuntu.Components.Popups 1.0
64-
65-Popover {
66- id: itemSelector
67-
68- property QtObject selectorModel: model
69-
70- caller: parent
71- contentWidth: Math.min(parent.width - units.gu(10), units.gu(40))
72- property real listContentHeight: 0 // intermediate property to avoid binding loop
73- contentHeight: Math.min(parent.height - units.gu(10), listContentHeight)
74-
75- ListView {
76- clip: true
77- width: itemSelector.contentWidth
78- height: itemSelector.contentHeight
79-
80- model: selectorModel.items
81-
82- delegate: ListItem.Standard {
83- text: model.text
84- enabled: model.enabled
85- selected: model.selected
86- onClicked: selectorModel.accept(model.index)
87- }
88-
89- section.property: "group"
90- section.delegate: ListItem.Header {
91- text: section
92- }
93-
94- onContentHeightChanged: itemSelector.listContentHeight = contentHeight
95- }
96-
97- Component.onCompleted: show()
98-
99- onVisibleChanged: {
100- if (!visible) {
101- selectorModel.reject()
102- }
103- }
104-}
105
106=== removed file 'src/Ubuntu/Components/Extras/Browser/UbuntuWebView01.qml'
107--- src/Ubuntu/Components/Extras/Browser/UbuntuWebView01.qml 2014-07-29 21:51:07 +0000
108+++ src/Ubuntu/Components/Extras/Browser/UbuntuWebView01.qml 1970-01-01 00:00:00 +0000
109@@ -1,278 +0,0 @@
110-/*
111- * Copyright 2013-2014 Canonical Ltd.
112- *
113- * This file is part of webbrowser-app.
114- *
115- * webbrowser-app is free software; you can redistribute it and/or modify
116- * it under the terms of the GNU General Public License as published by
117- * the Free Software Foundation; version 3.
118- *
119- * webbrowser-app is distributed in the hope that it will be useful,
120- * but WITHOUT ANY WARRANTY; without even the implied warranty of
121- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
122- * GNU General Public License for more details.
123- *
124- * You should have received a copy of the GNU General Public License
125- * along with this program. If not, see <http://www.gnu.org/licenses/>.
126- */
127-
128-import QtQuick 2.0
129-import QtWebKit 3.1
130-import QtWebKit.experimental 1.0
131-import Ubuntu.Components 1.1
132-import Ubuntu.Components.Extras.Browser 0.1
133-import Ubuntu.Components.Popups 1.0
134-
135-/*!
136- \qmltype MainView
137- \inqmlmodule Ubuntu.Components.Extras.Browser 0.1
138- \obsolete
139- \brief Custom Ubuntu WebView extending QtWebKit’s WebView
140-
141- This version of UbuntuWebView is deprecated and shouldn’t be used in new
142- code. Use version 0.2 or higher instead.
143-*/
144-WebView {
145- id: _webview
146-
147- signal newTabRequested(url url)
148-
149- QtObject {
150- property real devicePixelRatio: QtWebKitDPR
151- onDevicePixelRatioChanged: {
152- // Do not make this patch to QtWebKit a hard requirement.
153- if (_webview.experimental.hasOwnProperty('devicePixelRatio')) {
154- _webview.experimental.devicePixelRatio = devicePixelRatio
155- }
156- }
157- }
158-
159- interactive: !selection.visible
160- maximumFlickVelocity: height * 5
161-
162- /**
163- * Client overridable function called before the default treatment of a
164- * valid navigation request. This function can stop the navigation request
165- * if it sets the 'action' field of the request to IgnoreRequest.
166- *
167- */
168- function navigationRequestedDelegate(request) { }
169-
170- UserAgent01 {
171- id: userAgent
172- }
173-
174- /**
175- * This function can be overridden by client applications that embed an
176- * UbuntuWebView to provide a static overridden UA string.
177- * If not overridden, the default UA string and the default override
178- * mechanism will be used.
179- */
180- function getUAString() {
181- // Note that this function used to accept a 'url' parameter to allow
182- // embedders to implement a custom override mechanism. It was removed
183- // after observing that no application was using it, and to simplify
184- // the API. Embedders willing to provide a custom override mechanism
185- // can always override (at their own risk) the onNavigationRequested
186- // slot.
187- return undefined
188- }
189- experimental.userAgent: (_webview.getUAString() === undefined) ? userAgent.defaultUA : _webview.getUAString()
190- onNavigationRequested: {
191- request.action = WebView.AcceptRequest;
192-
193- navigationRequestedDelegate (request);
194- if (request.action === WebView.IgnoreRequest)
195- return;
196-
197- var staticUA = _webview.getUAString()
198- if (staticUA === undefined) {
199- _webview.experimental.userAgent = userAgent.getUAString(request.url)
200- } else {
201- _webview.experimental.userAgent = staticUA
202- }
203- }
204-
205- experimental.preferences.navigatorQtObjectEnabled: true
206- experimental.userScripts: [Qt.resolvedUrl("hyperlinks.js"),
207- Qt.resolvedUrl("selection01.js")]
208- experimental.onMessageReceived: {
209- var data = null
210- try {
211- data = JSON.parse(message.data)
212- } catch (error) {
213- console.debug('DEBUG:', message.data)
214- return
215- }
216- if ('event' in data) {
217- if (data.event === 'longpress') {
218- if (('img' in data) || ('href' in data)) {
219- contextualData.clear()
220- if ('img' in data) {
221- contextualData.img = data.img
222- }
223- if ('href' in data) {
224- contextualData.href = data.href
225- contextualData.title = data.title
226- }
227- if (contextualActions != null) {
228- for (var i = 0; i < contextualActions.actions.length; ++i) {
229- if (contextualActions.actions[i].enabled) {
230- contextualRectangle.position(data)
231- PopupUtils.open(contextualPopover, contextualRectangle)
232- return
233- }
234- }
235- }
236- }
237- }
238- if ((data.event === 'longpress') || (data.event === 'selectionadjusted')) {
239- selection.clearData()
240- selection.createData()
241- if ('html' in data) {
242- selection.mimedata.html = data.html
243- }
244- // FIXME: push the text and image data in the order
245- // they appear in the selected block.
246- if ('text' in data) {
247- selection.mimedata.text = data.text
248- }
249- if ('images' in data) {
250- // TODO: download and cache the images locally
251- // (grab them from the webview’s cache, if possible),
252- // and forward local URLs.
253- selection.mimedata.urls = data.images
254- }
255- selection.show(data.left, data.top, data.width, data.height)
256- } else if (data.event === 'newtab') {
257- newTabRequested(data.url)
258- }
259- }
260- }
261-
262- experimental.itemSelector: ItemSelector01 {}
263-
264- property alias selection: selection
265- property ActionList selectionActions
266- Selection {
267- id: selection
268-
269- anchors.fill: parent
270- visible: false
271-
272- property Item __popover: null
273- property var mimedata: null
274-
275- Component {
276- id: selectionPopover
277- ActionSelectionPopover {
278- grabDismissAreaEvents: false
279- actions: selectionActions
280- }
281- }
282-
283- function createData() {
284- if (mimedata === null) {
285- mimedata = Clipboard.newData()
286- }
287- }
288-
289- function clearData() {
290- if (mimedata !== null) {
291- delete mimedata
292- mimedata = null
293- }
294- }
295-
296- function actionTriggered() {
297- selection.visible = false
298- }
299-
300- function __showPopover() {
301- __popover = PopupUtils.open(selectionPopover, selection.rect)
302- var actions = __popover.actions.actions
303- for (var i in actions) {
304- actions[i].onTriggered.connect(actionTriggered)
305- }
306- }
307-
308- function show(x, y, width, height) {
309- var scale = _webview.experimental.test.contentsScale * _webview.experimental.test.devicePixelRatio
310- rect.x = x * scale + _webview.contentX
311- rect.y = y * scale + _webview.contentY
312- rect.width = width * scale
313- rect.height = height * scale
314- visible = true
315- __showPopover()
316- }
317-
318- onVisibleChanged: {
319- if (!visible && (__popover != null)) {
320- PopupUtils.close(__popover)
321- __popover = null
322- }
323- }
324-
325- onResized: {
326- var message = new Object
327- message.query = 'adjustselection'
328- var rect = selection.rect
329- var scale = _webview.experimental.test.contentsScale * _webview.experimental.test.devicePixelRatio
330- message.left = (rect.x - _webview.contentX) / scale
331- message.right = (rect.x + rect.width - _webview.contentX) / scale
332- message.top = (rect.y - _webview.contentY) / scale
333- message.bottom = (rect.y + rect.height - _webview.contentY) / scale
334- _webview.experimental.postMessage(JSON.stringify(message))
335- }
336-
337- function copy() {
338- Clipboard.push(mimedata)
339- clearData()
340- }
341- }
342-
343- Item {
344- id: contextualRectangle
345-
346- visible: false
347-
348- function position(data) {
349- var scale = _webview.experimental.test.contentsScale * _webview.experimental.test.devicePixelRatio
350- x = data.left * scale
351- y = data.top * scale
352- width = data.width * scale
353- height = data.height * scale
354- }
355- }
356- property QtObject contextualData: QtObject {
357- property url href
358- property string title
359- property url img
360-
361- function clear() {
362- href = ''
363- title = ''
364- img = ''
365- }
366- }
367-
368- property ActionList contextualActions
369- Component {
370- id: contextualPopover
371- ActionSelectionPopover {
372- actions: contextualActions
373- }
374- }
375-
376- Scrollbar {
377- parent: _webview.parent
378- flickableItem: _webview
379- align: Qt.AlignTrailing
380- }
381-
382- Scrollbar {
383- parent: _webview.parent
384- flickableItem: _webview
385- align: Qt.AlignBottom
386- }
387-}
388
389=== removed file 'src/Ubuntu/Components/Extras/Browser/UserAgent01.qml'
390--- src/Ubuntu/Components/Extras/Browser/UserAgent01.qml 2014-07-29 21:51:07 +0000
391+++ src/Ubuntu/Components/Extras/Browser/UserAgent01.qml 1970-01-01 00:00:00 +0000
392@@ -1,90 +0,0 @@
393-/*
394- * Copyright 2013-2014 Canonical Ltd.
395- *
396- * This file is part of webbrowser-app.
397- *
398- * webbrowser-app is free software; you can redistribute it and/or modify
399- * it under the terms of the GNU General Public License as published by
400- * the Free Software Foundation; version 3.
401- *
402- * webbrowser-app is distributed in the hope that it will be useful,
403- * but WITHOUT ANY WARRANTY; without even the implied warranty of
404- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
405- * GNU General Public License for more details.
406- *
407- * You should have received a copy of the GNU General Public License
408- * along with this program. If not, see <http://www.gnu.org/licenses/>.
409- */
410-
411-import QtQuick 2.0
412-import QtQuick.Window 2.0
413-import Ubuntu.Components 1.1
414-import "ua-overrides.js" as Overrides
415-
416-/*
417- * Useful documentation:
418- * http://en.wikipedia.org/wiki/User_agent#Format
419- * https://developer.mozilla.org/en-US/docs/Gecko_user_agent_string_reference
420- * https://wiki.mozilla.org/B2G/User_Agent
421- * https://github.com/mozilla-b2g/gaia/blob/master/build/ua-override-prefs.js
422- * https://developers.google.com/chrome/mobile/docs/user-agent
423- */
424-
425-// This is an Item, not a QtObject, because it needs information about the Screen.
426-Item {
427- // %1: form factor (Mobile, Tablet, Desktop)
428- // %2: WebKit version
429- readonly property string _template: "Mozilla/5.0 (Ubuntu; %1) WebKit/%2"
430-
431- // See Source/WebCore/Configurations/Version.xcconfig in QtWebKit’s source tree
432- // TODO: determine this value at runtime
433- readonly property string _webkitVersion: "537.21"
434-
435- // FIXME: this is a quick hack that will become increasingly unreliable
436- // as we support more devices, so we need a better solution for this
437- // FIXME: only handling phone and tablet for now, need to handle desktop too
438- readonly property string _formFactor: (Screen.width >= units.gu(60)) ? "Tablet" : "Mobile"
439-
440- property string defaultUA: _template.arg(_formFactor).arg(_webkitVersion)
441-
442- property var overrides: Overrides.overrides
443-
444- function getDomain(url) {
445- var domain = url.toString()
446- var indexOfScheme = domain.indexOf("://")
447- if (indexOfScheme !== -1) {
448- domain = domain.slice(indexOfScheme + 3)
449- }
450- var indexOfPath = domain.indexOf("/")
451- if (indexOfPath !== -1) {
452- domain = domain.slice(0, indexOfPath)
453- }
454- return domain
455- }
456-
457- function getDomains(domain) {
458- var components = domain.split(".")
459- var domains = []
460- for (var i = 0; i < components.length; i++) {
461- domains.push(components.slice(i).join("."))
462- }
463- return domains
464- }
465-
466- function getUAString(url) {
467- var ua = defaultUA
468- var domains = getDomains(getDomain(url))
469- for (var i = 0; i < domains.length; i++) {
470- var domain = domains[i]
471- if (domain in overrides) {
472- var form = overrides[domain]
473- if (typeof form == "string") {
474- return form
475- } else if (typeof form == "object") {
476- return ua.replace(form[0], form[1])
477- }
478- }
479- }
480- return ua
481- }
482-}
483
484=== removed file 'src/Ubuntu/Components/Extras/Browser/dummysingleton.qml'
485--- src/Ubuntu/Components/Extras/Browser/dummysingleton.qml 2014-04-16 13:24:56 +0000
486+++ src/Ubuntu/Components/Extras/Browser/dummysingleton.qml 1970-01-01 00:00:00 +0000
487@@ -1,28 +0,0 @@
488-/*
489- * Copyright 2014 Canonical Ltd.
490- *
491- * This file is part of webbrowser-app.
492- *
493- * webbrowser-app is free software; you can redistribute it and/or modify
494- * it under the terms of the GNU General Public License as published by
495- * the Free Software Foundation; version 3.
496- *
497- * webbrowser-app is distributed in the hope that it will be useful,
498- * but WITHOUT ANY WARRANTY; without even the implied warranty of
499- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
500- * GNU General Public License for more details.
501- *
502- * You should have received a copy of the GNU General Public License
503- * along with this program. If not, see <http://www.gnu.org/licenses/>.
504- */
505-
506-// This file is not really used, but without it importing version 0.1 of
507-// Ubuntu.Components.Extras.Browser fails because the QML engine requests type
508-// UbuntuSharedWebContext, despite it being specific to version 0.2 of the
509-// module.
510-
511-pragma Singleton
512-
513-import QtQml 2.0
514-
515-QtObject {}
516
517=== removed file 'src/Ubuntu/Components/Extras/Browser/hyperlinks.js'
518--- src/Ubuntu/Components/Extras/Browser/hyperlinks.js 2013-06-17 16:50:17 +0000
519+++ src/Ubuntu/Components/Extras/Browser/hyperlinks.js 1970-01-01 00:00:00 +0000
520@@ -1,52 +0,0 @@
521-/*
522- * Copyright 2013 Canonical Ltd.
523- *
524- * This file is part of ubuntu-browser.
525- *
526- * ubuntu-browser is free software; you can redistribute it and/or modify
527- * it under the terms of the GNU General Public License as published by
528- * the Free Software Foundation; version 3.
529- *
530- * ubuntu-browser is distributed in the hope that it will be useful,
531- * but WITHOUT ANY WARRANTY; without even the implied warranty of
532- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
533- * GNU General Public License for more details.
534- *
535- * You should have received a copy of the GNU General Public License
536- * along with this program. If not, see <http://www.gnu.org/licenses/>.
537- */
538-
539-function handleClickEvent(event) {
540- var node = event.target;
541- while (node) {
542- if (node.nodeName.toLowerCase() == 'a') {
543- // Using event delegation to work around the lack of support for
544- // handling hyperlinks with a target attribute set to '_blank' in
545- // QtWebKit. See related upstream bug reports:
546- // https://bugs.webkit.org/show_bug.cgi?id=76416
547- // https://bugs.webkit.org/show_bug.cgi?id=91779
548- if (node.hasAttribute('target')) {
549- var target = node.getAttribute('target').toLowerCase();
550- if ((target == '_blank') || (target == '"_blank"')) {
551- var link = {'event': 'newtab', 'url': node.href};
552- navigator.qt.postMessage(JSON.stringify(link));
553- }
554- }
555- break;
556- }
557- node = node.parentNode;
558- }
559-}
560-
561-var doc = document.documentElement;
562-doc.addEventListener('click', handleClickEvent);
563-
564-var frames = doc.getElementsByTagName('iframe');
565-for (var i = 0; i < frames.length; i++) {
566- frames[i].addEventListener('load', function() {
567- var doc = this.contentDocument;
568- if (doc) {
569- doc.documentElement.addEventListener('click', handleClickEvent);
570- }
571- });
572-}
573
574=== modified file 'src/Ubuntu/Components/Extras/Browser/qmldir'
575--- src/Ubuntu/Components/Extras/Browser/qmldir 2014-05-29 15:30:11 +0000
576+++ src/Ubuntu/Components/Extras/Browser/qmldir 2015-04-09 13:12:19 +0000
577@@ -1,10 +1,6 @@
578 module Ubuntu.Components.Extras.Browser
579 plugin ubuntu-ui-extras-browser-plugin
580-UbuntuWebView 0.1 UbuntuWebView01.qml
581 UbuntuWebView 0.2 UbuntuWebView02.qml
582 singleton UbuntuSharedWebContext 0.2 UbuntuSharedWebContext.qml
583 singleton SharedWebContext 0.2 UbuntuSharedWebContext.qml
584 UbuntuWebContext 0.2 UbuntuWebContext.qml
585-# Without the following lines, importing version 0.1 of the module fails
586-singleton UbuntuSharedWebContext 0.1 dummysingleton.qml
587-singleton SharedWebContext 0.1 dummysingleton.qml
588
589=== removed file 'src/Ubuntu/Components/Extras/Browser/selection01.js'
590--- src/Ubuntu/Components/Extras/Browser/selection01.js 2015-01-23 13:26:40 +0000
591+++ src/Ubuntu/Components/Extras/Browser/selection01.js 1970-01-01 00:00:00 +0000
592@@ -1,200 +0,0 @@
593-/*
594- * Copyright 2013-2014 Canonical Ltd.
595- *
596- * This file is part of webbrowser-app.
597- *
598- * webbrowser-app is free software; you can redistribute it and/or modify
599- * it under the terms of the GNU General Public License as published by
600- * the Free Software Foundation; version 3.
601- *
602- * webbrowser-app is distributed in the hope that it will be useful,
603- * but WITHOUT ANY WARRANTY; without even the implied warranty of
604- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
605- * GNU General Public License for more details.
606- *
607- * You should have received a copy of the GNU General Public License
608- * along with this program. If not, see <http://www.gnu.org/licenses/>.
609- */
610-
611-// List of domains known to interfere with touch events listeners
612-var blacklist = [
613- "m.8tracks.com", // http://pad.lv/1279903
614-];
615-if (blacklist.indexOf(document.domain) === -1) {
616-
617- function elementContainedInBox(element, box) {
618- var rect = element.getBoundingClientRect();
619- return ((box.left <= rect.left) && (box.right >= rect.right) &&
620- (box.top <= rect.top) && (box.bottom >= rect.bottom));
621- }
622-
623- function getImgFullUri(uri) {
624- if ((uri.slice(0, 7) === 'http://') ||
625- (uri.slice(0, 8) === 'https://') ||
626- (uri.slice(0, 7) === 'file://') ||
627- (uri.slice(0, 5) === 'data:')) {
628- return uri;
629- } else if (uri.slice(0, 1) === '/') {
630- var docuri = document.documentURI;
631- var firstcolon = docuri.indexOf('://');
632- var protocol = 'http://';
633- if (firstcolon !== -1) {
634- protocol = docuri.slice(0, firstcolon + 3);
635- }
636- if (uri.slice(0, 2) === '//') {
637- // URLs beginning with a // should just inherit the protocol
638- // from the current page
639- return protocol + uri.slice(2);
640- } else {
641- return protocol + document.domain + uri;
642- }
643- } else {
644- var base = document.baseURI;
645- var lastslash = base.lastIndexOf('/');
646- if (lastslash === -1) {
647- return base + '/' + uri;
648- } else {
649- return base.slice(0, lastslash + 1) + uri;
650- }
651- }
652- }
653-
654- function getSelectedData(element) {
655- var node = element;
656- var data = new Object;
657-
658- var nodeName = node.nodeName.toLowerCase();
659- if (nodeName === 'img') {
660- data.img = getImgFullUri(node.getAttribute('src'));
661- } else if (nodeName === 'a') {
662- data.href = node.href;
663- data.title = node.title;
664- }
665-
666- // If the parent tag is a hyperlink, we want it too.
667- var parent = node.parentNode;
668- if ((nodeName !== 'a') && parent && (parent.nodeName.toLowerCase() === 'a')) {
669- data.href = parent.href;
670- data.title = parent.title;
671- node = parent;
672- }
673-
674- var boundingRect = node.getBoundingClientRect();
675- data.left = boundingRect.left;
676- data.top = boundingRect.top;
677- data.width = boundingRect.width;
678- data.height = boundingRect.height;
679-
680- node = node.cloneNode(true);
681- // filter out script nodes
682- var scripts = node.getElementsByTagName('script');
683- while (scripts.length > 0) {
684- var scriptNode = scripts[0];
685- if (scriptNode.parentNode) {
686- scriptNode.parentNode.removeChild(scriptNode);
687- }
688- }
689- data.html = node.outerHTML;
690- data.nodeName = node.nodeName.toLowerCase();
691- // FIXME: extract the text and images in the order they appear in the block,
692- // so that this order is respected when the data is pushed to the clipboard.
693- data.text = node.textContent;
694- var images = [];
695- var imgs = node.getElementsByTagName('img');
696- for (var i = 0; i < imgs.length; i++) {
697- images.push(getImgFullUri(imgs[i].getAttribute('src')));
698- }
699- if (images.length > 0) {
700- data.images = images;
701- }
702-
703- return data;
704- }
705-
706- function adjustSelection(selection) {
707- // FIXME: allow selecting two consecutive blocks, instead of
708- // interpolating to the containing block.
709- var centerX = (selection.left + selection.right) / 2;
710- var centerY = (selection.top + selection.bottom) / 2;
711- var element = document.elementFromPoint(centerX, centerY);
712- var parent = element;
713- while (elementContainedInBox(parent, selection)) {
714- parent = parent.parentNode;
715- }
716- element = parent;
717- return getSelectedData(element);
718- }
719-
720- function distance(touch1, touch2) {
721- return Math.sqrt(Math.pow(touch2.clientX - touch1.clientX, 2) +
722- Math.pow(touch2.clientY - touch1.clientY, 2));
723- }
724-
725- navigator.qt.onmessage = function(message) {
726- var data = null;
727- try {
728- data = JSON.parse(message.data);
729- } catch (error) {
730- return;
731- }
732- if ('query' in data) {
733- if (data.query === 'adjustselection') {
734- var selection = adjustSelection(data);
735- selection.event = 'selectionadjusted';
736- navigator.qt.postMessage(JSON.stringify(selection));
737- }
738- }
739- }
740-
741- var longpressObserver = -1;
742- var currentTouch = null;
743- var longpressDetected = false;
744-
745- function longPressDetected(x, y) {
746- longpressDetected = true;
747- var element = document.elementFromPoint(x, y);
748- var data = getSelectedData(element);
749- data.event = 'longpress';
750- navigator.qt.postMessage(JSON.stringify(data));
751- }
752-
753- function clearLongpressTimeout() {
754- clearTimeout(longpressObserver);
755- longpressObserver = -1;
756- currentTouch = null;
757- }
758-
759- var doc = document.documentElement;
760-
761- doc.addEventListener('touchstart', function(event) {
762- if (event.touches.length == 1) {
763- currentTouch = event.touches[0];
764- longpressObserver = setTimeout(longPressDetected, 800, currentTouch.clientX, currentTouch.clientY);
765- }
766- });
767-
768- doc.addEventListener('touchend', function(event) {
769- if (longpressDetected) {
770- longpressDetected = false;
771- event.preventDefault();
772- }
773- clearLongpressTimeout();
774- });
775-
776- doc.addEventListener('touchmove', function(event) {
777- if (!currentTouch) {
778- return;
779- }
780- if ((event.changedTouches.length > 1) || (distance(event.changedTouches[0], currentTouch) > 3)) {
781- clearLongpressTimeout();
782- }
783- });
784-
785- doc.addEventListener('touchcancel', function(event) {
786- if (longpressDetected) {
787- longpressDetected = false;
788- }
789- clearLongpressTimeout();
790- });
791-
792-}
793
794=== removed file 'src/Ubuntu/Components/Extras/Browser/ua-overrides.js'
795--- src/Ubuntu/Components/Extras/Browser/ua-overrides.js 2013-11-19 18:09:46 +0000
796+++ src/Ubuntu/Components/Extras/Browser/ua-overrides.js 1970-01-01 00:00:00 +0000
797@@ -1,115 +0,0 @@
798-/*
799- * Copyright 2013 Canonical Ltd.
800- *
801- * This file is part of webbrowser-app.
802- *
803- * webbrowser-app is free software; you can redistribute it and/or modify
804- * it under the terms of the GNU General Public License as published by
805- * the Free Software Foundation; version 3.
806- *
807- * webbrowser-app is distributed in the hope that it will be useful,
808- * but WITHOUT ANY WARRANTY; without even the implied warranty of
809- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
810- * GNU General Public License for more details.
811- *
812- * You should have received a copy of the GNU General Public License
813- * along with this program. If not, see <http://www.gnu.org/licenses/>.
814- */
815-
816-.pragma library
817-
818-// B2G’s list of overrides: https://hg.mozilla.org/mozilla-central/raw-file/tip/b2g/app/ua-update.json.in
819-
820-// List of user agent string overrides in the form of an object.
821-// Each key is a domain name for which the default user agent string doesn’t
822-// work well enough. Values can either be a string (full override) or an array
823-// containing two values that are passed to the String.replace method (the
824-// first value may be either a string or a regular expression, the second value
825-// must be a string).
826-
827-// Examples of valid entries:
828-// "example.org": "full override"
829-// "example.com": ["Ubuntu", "Ubuntu Edge"]
830-// "google.com": [/mobi/i, "b"]
831-
832-// The original list was initially built from the top 100 entries
833-// at http://www.alexa.com/topsites (2013-08-16), using Chrome on
834-// Android as a reference.
835-
836-var overrides = {
837- // Google+ is special, scroll doesn't work with an AppleWebkit personality
838- "plus.google.com": ["Mobile", "Android; Mobile"],
839-
840- "google.com": [/Mobile\) WebKit\/[.0-9]*/, "Android 4.3) AppleWebKit Mobile Safari"],
841- "google.co.in": [/Mobile\) WebKit\/[.0-9]*/, "Android 4.3) AppleWebKit Mobile Safari"],
842- "google.de": [/Mobile\) WebKit\/[.0-9]*/, "Android 4.3) AppleWebKit Mobile Safari"],
843- "google.co.uk": [/Mobile\) WebKit\/[.0-9]*/, "Android 4.3) AppleWebKit Mobile Safari"],
844- "google.fr": [/Mobile\) WebKit\/[.0-9]*/, "Android 4.3) AppleWebKit Mobile Safari"],
845- "google.com.br": [/Mobile\) WebKit\/[.0-9]*/, "Android 4.3) AppleWebKit Mobile Safari"],
846- "google.co.jp": [/Mobile\) WebKit\/[.0-9]*/, "Android 4.3) AppleWebKit Mobile Safari"],
847- "google.com.hk": [/Mobile\) WebKit\/[.0-9]*/, "Android 4.3) AppleWebKit Mobile Safari"],
848- "google.ru": [/Mobile\) WebKit\/[.0-9]*/, "Android 4.3) AppleWebKit Mobile Safari"],
849- "google.it": [/Mobile\) WebKit\/[.0-9]*/, "Android 4.3) AppleWebKit Mobile Safari"],
850- "google.es": [/Mobile\) WebKit\/[.0-9]*/, "Android 4.3) AppleWebKit Mobile Safari"],
851- "google.com.mx": [/Mobile\) WebKit\/[.0-9]*/, "Android 4.3) AppleWebKit Mobile Safari"],
852- "google.ca": [/Mobile\) WebKit\/[.0-9]*/, "Android 4.3) AppleWebKit Mobile Safari"],
853- "google.com.tr": [/Mobile\) WebKit\/[.0-9]*/, "Android 4.3) AppleWebKit Mobile Safari"],
854- "google.com.au": [/Mobile\) WebKit\/[.0-9]*/, "Android 4.3) AppleWebKit Mobile Safari"],
855- "google.pl": [/Mobile\) WebKit\/[.0-9]*/, "Android 4.3) AppleWebKit Mobile Safari"],
856-
857- "youtube.com": [/Mobile\) WebKit\/([.0-9]*)/, "Linux) WebKit/$1 (like Android 4.3) Ubuntu Mobile"],
858-
859- "twitter.com": ["Mobile)", "Mobile) Firefox"],
860-
861- // while this issue gets resolved (https://bugs.launchpad.net/ubuntu/+source/ubuntu-keyboard/+bug/1233207)
862- "login.ubuntu.com": [/Mobile\) WebKit\/[.0-9]*/, "Android 4.3) AppleWebKit Mobile Safari"],
863-
864- "yahoo.com": ["Mobile", "Android; Mobile"],
865- "baidu.com": ["Mobile", "Android; Mobile"],
866- "qq.com": [/WebKit\/[.0-9]*/, "Apple$& Mobile"],
867- "amazon.com": ["Mobile", "Android; Mobile"],
868- "linkedin.com": ["Mobile", "Android; Mobile"],
869- "blogspot.com": ["Mobile", "Android; Mobile"],
870- "taobao.com": ["Mobile", "Android; Mobile"],
871- "bing.com": ["Mobile", "Android; Mobile"],
872- "yahoo.co.jp": ["Ubuntu", "Linux; Android 4; Galaxy Build/"],
873- "yandex.ru": ["Mobile", "Android; Mobile"],
874- "sina.com.cn": ["Mobile", "Android; Mobile"],
875- "ebay.com": ["Mobile", "Android; Mobile"],
876- "tumblr.com": ["Mobile", "Android; Mobile"],
877- "msn.com": ["Mobile", "Android; Mobile"],
878- "mail.ru": ["Ubuntu", "Linux; Android 4; Galaxy Build/"],
879- "hao123.com": ["Mobile", "Android; Mobile"],
880- "ask.com": ["Mobile", "Android; Mobile"],
881- "blogger.com": ["Mobile", "Android; Mobile"],
882- "imdb.com": ["Mobile", "Android; Mobile"],
883- "amazon.co.jp": ["Mobile", "Android; Mobile"],
884- "tmall.com": ["Mobile", "Android; Mobile"],
885- "fc2.com": ["Mobile", "Android; Mobile"],
886- "soso.com": ["Mobile", "Android; Mobile"],
887- "delta-search.com": ["Mobile", "Android; Mobile"],
888- "odnoklassniki.ru": ["Mobile", "Android; Mobile"],
889- "alibaba.com": ["Mobile", "Android; Mobile"],
890- "flickr.com": ["Mobile", "Android; Mobile"],
891- "amazon.de": ["Mobile", "Android; Mobile"],
892- "blogspot.in": ["Mobile", "Android; Mobile"],
893- "ifeng.com": ["Mobile", "Android; Mobile"],
894- "360.cn": ["Mobile", "Android; Mobile"],
895- "youku.com": ["Mobile", "Android; Mobile"],
896- "ebay.de": ["Mobile", "Android; Mobile"],
897- "uol.com.br": ["Mobile", "Android; Mobile"],
898- "aol.com": ["Mobile", "Android; Mobile"],
899- "alipay.com": ["Mobile", "Android; Mobile"],
900- "dailymotion.com": ["Mobile", "Android; Mobile Safari"],
901- "amazon.co.uk": ["Mobile", "Android; Mobile"],
902- "ebay.co.uk": ["Mobile", "Android; Mobile"],
903-
904- "facebook.com": [/Mobile\) WebKit\/([.0-9]*)/, "Linux) WebKit/$1 (like Android 4.3) AppleWebKit/$1 Ubuntu Mobile"],
905- // Akamai serves images for Facebook
906- "akamaihd.net": [/Mobile\) WebKit\/([.0-9]*)/, "Linux) WebKit/$1 (like Android 4.3) AppleWebKit/$1 Ubuntu Mobile"],
907-
908- "nytimes.com": ["Mobile", "Android; Mobile Safari"],
909-
910- // http://pad.lv/1223937
911- "huffpost.com": ["Mobile)", "Mobile) Firefox"],
912-};
913
914=== modified file 'src/Ubuntu/Web/plugin.cpp'
915--- src/Ubuntu/Web/plugin.cpp 2015-02-27 10:08:05 +0000
916+++ src/Ubuntu/Web/plugin.cpp 2015-04-09 13:12:19 +0000
917@@ -181,14 +181,6 @@
918 return m_devtoolsPort;
919 }
920
921-static float getQtWebkitDpr()
922-{
923- QByteArray stringValue = qgetenv("QTWEBKIT_DPR");
924- bool ok = false;
925- float value = stringValue.toFloat(&ok);
926- return ok ? value : 1.0;
927-}
928-
929 void UbuntuBrowserPlugin::initializeEngine(QQmlEngine* engine, const char* uri)
930 {
931 Q_UNUSED(uri);
932@@ -196,11 +188,6 @@
933 QQmlContext* context = engine->rootContext();
934 context->setContextObject(new UbuntuWebPluginContext(context));
935
936- if (uri == QLatin1String("Ubuntu.Components.Extras.Browser")) {
937- // Set the desired pixel ratio (not needed once we use Qt’s way of
938- // calculating the proper pixel ratio by device/screen).
939- context->setContextProperty("QtWebKitDPR", getQtWebkitDpr());
940- }
941 }
942
943 void UbuntuBrowserPlugin::registerTypes(const char* uri)
944
945=== modified file 'src/app/BrowserWindow.qml'
946--- src/app/BrowserWindow.qml 2015-03-25 08:51:42 +0000
947+++ src/app/BrowserWindow.qml 2015-04-09 13:12:19 +0000
948@@ -39,7 +39,6 @@
949
950 Connections {
951 target: window.currentWebview
952- ignoreUnknownSignals: true
953 onFullscreenChanged: {
954 if (!window.forceFullscreen) {
955 if (window.currentWebview.fullscreen) {
956
957=== removed file 'src/app/PermissionRequest.qml'
958--- src/app/PermissionRequest.qml 2014-07-29 21:51:07 +0000
959+++ src/app/PermissionRequest.qml 1970-01-01 00:00:00 +0000
960@@ -1,47 +0,0 @@
961-/*
962- * Copyright 2013-2014 Canonical Ltd.
963- *
964- * This file is part of webbrowser-app.
965- *
966- * webbrowser-app is free software; you can redistribute it and/or modify
967- * it under the terms of the GNU General Public License as published by
968- * the Free Software Foundation; version 3.
969- *
970- * webbrowser-app is distributed in the hope that it will be useful,
971- * but WITHOUT ANY WARRANTY; without even the implied warranty of
972- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
973- * GNU General Public License for more details.
974- *
975- * You should have received a copy of the GNU General Public License
976- * along with this program. If not, see <http://www.gnu.org/licenses/>.
977- */
978-
979-import QtQuick 2.0
980-import Ubuntu.Components 1.1
981-import Ubuntu.Components.Popups 1.0
982-
983-Dialog {
984- id: dialog
985-
986- property QtObject permission: null
987-
988- title: i18n.tr("Permission Request")
989-
990- Button {
991- text: i18n.tr("Deny")
992- color: UbuntuColors.warmGrey
993- onClicked: {
994- permission.allow = false
995- PopupUtils.close(dialog)
996- }
997- }
998-
999- Button {
1000- text: i18n.tr("Allow")
1001- color: UbuntuColors.orange
1002- onClicked: {
1003- permission.allow = true
1004- PopupUtils.close(dialog)
1005- }
1006- }
1007-}
1008
1009=== modified file 'src/app/webcontainer/WebApp.qml'
1010--- src/app/webcontainer/WebApp.qml 2015-03-31 14:57:20 +0000
1011+++ src/app/webcontainer/WebApp.qml 2015-04-09 13:12:19 +0000
1012@@ -33,7 +33,6 @@
1013
1014 property string webappModelSearchPath: ""
1015
1016- property alias oxide: webview.withOxide
1017 property alias webappName: webview.webappName
1018 property alias webappUrlPatterns: webview.webappUrlPatterns
1019 property alias popupRedirectionUrlPrefixPattern: webview.popupRedirectionUrlPrefixPattern
1020@@ -73,7 +72,6 @@
1021 left: parent.left
1022 right: parent.right
1023 top: parent.top
1024- topMargin: (webapp.oxide || webapp.chromeless) ? 0 : chromeLoader.item.height
1025 }
1026 height: parent.height - osk.height
1027 developerExtrasEnabled: webapp.developerExtrasEnabled
1028@@ -82,7 +80,7 @@
1029 Loader {
1030 anchors {
1031 fill: webview
1032- topMargin: (webapp.oxide && !webapp.chromeless && chromeLoader.item.state == "shown") ? chromeLoader.item.height : 0
1033+ topMargin: (!webapp.chromeless && chromeLoader.item.state == "shown") ? chromeLoader.item.height : 0
1034 }
1035 sourceComponent: ErrorSheet {
1036 visible: webview.currentWebview && webview.currentWebview.lastLoadFailed
1037@@ -118,7 +116,7 @@
1038 right: parent.right
1039 }
1040 height: units.gu(6)
1041- y: (webapp.oxide && webapp.currentWebview) ? webview.currentWebview.locationBarController.offset : 0
1042+ y: webapp.currentWebview ? webview.currentWebview.locationBarController.offset : 0
1043 }
1044 }
1045
1046@@ -138,32 +136,23 @@
1047 }
1048
1049 Binding {
1050- when: webapp.oxide && webapp.currentWebview && !webapp.chromeless
1051- target: (webapp.oxide && webapp.currentWebview) ? webapp.currentWebview.locationBarController : null
1052+ when: webapp.currentWebview && !webapp.chromeless
1053+ target: webapp.currentWebview ? webapp.currentWebview.locationBarController : null
1054 property: 'height'
1055 value: webapp.currentWebview.visible ? chromeLoader.item.height : 0
1056 }
1057
1058- Loader {
1059+ ChromeController {
1060 id: oxideChromeController
1061-
1062- sourceComponent: webapp.oxide ? oxideChromeControllerComponent : undefined
1063-
1064- Component {
1065- id: oxideChromeControllerComponent
1066-
1067- ChromeController {
1068- webview: webapp.currentWebview
1069- forceHide: webapp.chromeless
1070- }
1071- }
1072+ webview: webapp.currentWebview
1073+ forceHide: webapp.chromeless
1074 }
1075
1076 Binding {
1077- when: webapp.oxide && webapp.currentWebview
1078- target: (webapp.oxide && webapp.currentWebview) ? webapp.currentWebview.locationBarController : null
1079+ when: webapp.currentWebview
1080+ target: webapp.currentWebview ? webapp.currentWebview.locationBarController : null
1081 property: 'mode'
1082- value: webapp.oxide ? oxideChromeController.item.mode : 0
1083+ value: oxideChromeController.mode
1084 }
1085 }
1086
1087
1088=== removed file 'src/app/webcontainer/WebViewImplWebkit.qml'
1089--- src/app/webcontainer/WebViewImplWebkit.qml 2015-01-23 15:13:04 +0000
1090+++ src/app/webcontainer/WebViewImplWebkit.qml 1970-01-01 00:00:00 +0000
1091@@ -1,173 +0,0 @@
1092-/*
1093- * Copyright 2013-2014 Canonical Ltd.
1094- *
1095- * This file is part of webbrowser-app.
1096- *
1097- * webbrowser-app is free software; you can redistribute it and/or modify
1098- * it under the terms of the GNU General Public License as published by
1099- * the Free Software Foundation; version 3.
1100- *
1101- * webbrowser-app is distributed in the hope that it will be useful,
1102- * but WITHOUT ANY WARRANTY; without even the implied warranty of
1103- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1104- * GNU General Public License for more details.
1105- *
1106- * You should have received a copy of the GNU General Public License
1107- * along with this program. If not, see <http://www.gnu.org/licenses/>.
1108- */
1109-
1110-import QtQuick 2.0
1111-import QtWebKit 3.1
1112-import QtWebKit.experimental 1.0
1113-import Ubuntu.Components 1.1
1114-import Ubuntu.Components.Extras.Browser 0.1
1115-import Ubuntu.UnityWebApps 0.1 as UnityWebApps
1116-import Ubuntu.Components.Popups 1.0
1117-import "../actions" as Actions
1118-import ".."
1119-
1120-UbuntuWebView {
1121- id: webview
1122-
1123- property bool developerExtrasEnabled: false
1124- property var currentWebview: webview
1125- property string webappName: ""
1126- property var webappUrlPatterns: null
1127- property string localUserAgentOverride: ""
1128- property string popupRedirectionUrlPrefixPattern: ""
1129- property url dataPath // unused
1130- property bool runningLocalApplication: false
1131-
1132- function getUAString() {
1133- return webview.localUserAgentOverride.length === 0 ? undefined : webview.localUserAgentOverride
1134- }
1135-
1136- experimental.certificateVerificationDialog: CertificateVerificationDialog {}
1137- experimental.authenticationDialog: AuthenticationDialog {}
1138- experimental.proxyAuthenticationDialog: ProxyAuthenticationDialog {}
1139- experimental.alertDialog: AlertDialog {}
1140- experimental.confirmDialog: ConfirmDialog {}
1141- experimental.promptDialog: PromptDialog {}
1142-
1143- selectionActions: ActionList {
1144- Actions.Copy {
1145- onTriggered: selection.copy()
1146- }
1147- }
1148-
1149- StateSaver.properties: "url"
1150- StateSaver.enabled: true
1151-
1152- property bool lastLoadFailed: false
1153- onLoadingChanged: {
1154- lastLoadFailed = (loadRequest.status === WebView.LoadFailedStatus)
1155- }
1156-
1157- experimental.preferences.developerExtrasEnabled: developerExtrasEnabled
1158-
1159- experimental.onPermissionRequested: {
1160- if (permission.type === PermissionRequest.Geolocation) {
1161- var text = i18n.tr("This page wants to know your device’s location.")
1162- PopupUtils.open(Qt.resolvedUrl("../PermissionRequest.qml"),
1163- webview.currentWebview,
1164- {"permission": permission, "text": text})
1165- }
1166- // TODO: handle other types of permission requests
1167- // TODO: we might want to store the answer to avoid requesting
1168- // the permission everytime the user visits this site.
1169- }
1170-
1171- contextualActions: ActionList {
1172- Actions.CopyLink {
1173- enabled: webview.contextualData.href.toString()
1174- onTriggered: Clipboard.push([webview.contextualData.href])
1175- }
1176- Actions.CopyImage {
1177- enabled: webview.contextualData.img.toString()
1178- onTriggered: Clipboard.push([webview.contextualData.img])
1179- }
1180- }
1181-
1182- function isRunningAsANamedWebapp() {
1183- return webview.webappName && typeof(webview.webappName) === 'string' && webview.webappName.length != 0
1184- }
1185-
1186- function haveValidUrlPatterns() {
1187- return webappUrlPatterns && webappUrlPatterns.length !== 0
1188- }
1189-
1190- function shouldAllowNavigationTo(url) {
1191- // The list of url patterns defined by the webapp takes precedence over command line
1192- if (isRunningAsANamedWebapp()) {
1193- if (unityWebapps.model.exists(unityWebapps.name) &&
1194- unityWebapps.model.doesUrlMatchesWebapp(unityWebapps.name, url)) {
1195- return true;
1196- }
1197- }
1198-
1199- // We still take the possible additional patterns specified in the command line
1200- // (the in the case of finer grained ones specifically for the container and not
1201- // as an 'install source' for the webapp).
1202- if (webappUrlPatterns && webappUrlPatterns.length !== 0) {
1203- for (var i = 0; i < webappUrlPatterns.length; ++i) {
1204- var pattern = webappUrlPatterns[i]
1205- if (url.match(pattern)) {
1206- return true;
1207- }
1208- }
1209- }
1210-
1211- return false;
1212- }
1213-
1214- function navigationRequestedDelegate(request) {
1215- if (!request.isMainFrame) {
1216- request.action = WebView.AcceptRequest
1217- return
1218- }
1219-
1220- // Pass-through if we are not running as a named webapp (--webapp='Gmail')
1221- // or if we dont have a list of url patterns specified to filter the
1222- // browsing actions
1223- if ( ! haveValidUrlPatterns() && ! isRunningAsANamedWebapp()) {
1224- request.action = WebView.AcceptRequest
1225- return
1226- }
1227-
1228- var action = WebView.IgnoreRequest
1229- var url = request.url.toString()
1230-
1231- if (shouldAllowNavigationTo(url)) {
1232- request.action = WebView.AcceptRequest
1233- return;
1234- }
1235-
1236- request.action = action
1237- if (action === WebView.IgnoreRequest) {
1238- console.debug('Opening: ' + url + ' in the browser window.')
1239- Qt.openUrlExternally(url)
1240- }
1241- }
1242-
1243- onNewTabRequested: Qt.openUrlExternally(url)
1244-
1245- // Small shim needed when running as a webapp to wire-up connections
1246- // with the webview (message received, etc…).
1247- // This is being called (and expected) internally by the webapps
1248- // component as a way to bind to a webview lookalike without
1249- // reaching out directly to its internals (see it as an interface).
1250- function getUnityWebappsProxies() {
1251- var eventHandlers = {
1252- onAppRaised: function () {
1253- if (webbrowserWindow) {
1254- try {
1255- webbrowserWindow.raise();
1256- } catch (e) {
1257- console.debug('Error while raising: ' + e);
1258- }
1259- }
1260- }
1261- };
1262- return UnityWebAppsUtils.makeProxiesForQtWebViewBindee(webview, eventHandlers)
1263- }
1264-}
1265
1266=== modified file 'src/app/webcontainer/WebappContainerWebview.qml'
1267--- src/app/webcontainer/WebappContainerWebview.qml 2014-11-25 15:00:45 +0000
1268+++ src/app/webcontainer/WebappContainerWebview.qml 2015-04-09 13:12:19 +0000
1269@@ -27,7 +27,6 @@
1270 id: containerWebview
1271
1272 property string url: ""
1273- property bool withOxide: false
1274 property bool developerExtrasEnabled: false
1275 property string webappName: ""
1276 property url dataPath
1277@@ -50,10 +49,7 @@
1278 onUrlChanged: if (webappContainerWebViewLoader.item) webappContainerWebViewLoader.item.url = url
1279
1280 Component.onCompleted: {
1281- var webappEngineSource =
1282- withOxide ?
1283- Qt.resolvedUrl("WebViewImplOxide.qml")
1284- : Qt.resolvedUrl("WebViewImplWebkit.qml");
1285+ var webappEngineSource = Qt.resolvedUrl("WebViewImplOxide.qml");
1286
1287 // This is an experimental, UNSUPPORTED, API
1288 // It loads an alternative webview, adjusted for a specific webapp
1289
1290=== modified file 'src/app/webcontainer/webapp-container.cpp'
1291--- src/app/webcontainer/webapp-container.cpp 2015-02-27 09:28:41 +0000
1292+++ src/app/webcontainer/webapp-container.cpp 2015-04-09 13:12:19 +0000
1293@@ -75,33 +75,6 @@
1294 }
1295 }
1296
1297-static QString currentArchitecturePathName()
1298-{
1299-#if defined(Q_PROCESSOR_X86_32)
1300- return QLatin1String("i386-linux-gnu");
1301-#elif defined(Q_PROCESSOR_X86_64)
1302- return QLatin1String("x86_64-linux-gnu");
1303-#elif defined(Q_PROCESSOR_ARM)
1304- return QLatin1String("arm-linux-gnueabihf");
1305-#else
1306-#error Unable to determine target architecture
1307-#endif
1308-}
1309-
1310-static bool canUseOxide()
1311-{
1312- // Use a runtime hint to transparently know if oxide
1313- // can be used as a backend without the user/dev having
1314- // to update its app or change something in the Exec args.
1315- // Version 1.1 of ubuntu apparmor policy allows this file to
1316- // be accessed whereas v1.0 only knows about qtwebkit.
1317- QString oxideHintLocation =
1318- QString("/usr/lib/%1/oxide-qt/oxide-renderer")
1319- .arg(currentArchitecturePathName());
1320-
1321- return QFile(oxideHintLocation).open(QIODevice::ReadOnly);
1322-}
1323-
1324 }
1325
1326 const QString WebappContainer::URL_PATTERN_SEPARATOR = ",";
1327@@ -110,7 +83,6 @@
1328
1329 WebappContainer::WebappContainer(int& argc, char** argv):
1330 BrowserApplication(argc, argv),
1331- m_withOxide(canUseOxide()),
1332 m_storeSessionCookies(false),
1333 m_backForwardButtonsVisible(false),
1334 m_addressBarVisible(false),
1335@@ -146,9 +118,6 @@
1336 m_window->setProperty("chromeVisible", m_addressBarVisible);
1337 m_window->setProperty("accountProvider", m_accountProvider);
1338
1339- qDebug() << "Using" << (m_withOxide ? "Oxide" : "QtWebkit") << "as the web engine backend";
1340- m_window->setProperty("oxide", m_withOxide);
1341-
1342 m_window->setProperty("webappUrlPatterns", m_webappUrlPatterns);
1343 QQmlContext* context = m_engine->rootContext();
1344 if (m_storeSessionCookies) {
1345@@ -310,13 +279,7 @@
1346 void WebappContainer::parseCommandLine()
1347 {
1348 Q_FOREACH(const QString& argument, m_arguments) {
1349- if (argument == "--webkit") {
1350- // force webkit
1351- m_withOxide = false;
1352- } else if (argument == "--oxide") {
1353- // force oxide
1354- m_withOxide = true;
1355- } else if (argument.startsWith("--webappModelSearchPath=")) {
1356+ if (argument.startsWith("--webappModelSearchPath=")) {
1357 m_webappModelSearchPath = argument.split("--webappModelSearchPath=")[1];
1358 } else if (argument.startsWith("--webapp=")) {
1359 // We use the name as a reference instead of the URL with a subsequent step to match it with a webapp.
1360
1361=== modified file 'src/app/webcontainer/webapp-container.h'
1362--- src/app/webcontainer/webapp-container.h 2015-01-26 14:53:18 +0000
1363+++ src/app/webcontainer/webapp-container.h 2015-04-09 13:12:19 +0000
1364@@ -60,7 +60,6 @@
1365 QString m_webappModelSearchPath;
1366 QStringList m_webappUrlPatterns;
1367 QString m_accountProvider;
1368- bool m_withOxide;
1369 bool m_storeSessionCookies;
1370 bool m_backForwardButtonsVisible;
1371 bool m_addressBarVisible;
1372
1373=== modified file 'src/app/webcontainer/webapp-container.qml'
1374--- src/app/webcontainer/webapp-container.qml 2015-02-02 13:55:49 +0000
1375+++ src/app/webcontainer/webapp-container.qml 2015-04-09 13:12:19 +0000
1376@@ -37,7 +37,6 @@
1377 property string webappName: ""
1378 property string webappModelSearchPath: ""
1379 property var webappUrlPatterns
1380- property bool oxide: false
1381 property string accountProvider: ""
1382 property string popupRedirectionUrlPrefixPattern: ""
1383 property url webviewOverrideFile: ""
1384@@ -82,7 +81,6 @@
1385 chromeVisible: root.chromeVisible
1386 backForwardButtonsVisible: root.backForwardButtonsVisible
1387 developerExtrasEnabled: root.developerExtrasEnabled
1388- oxide: root.oxide
1389 webappModelSearchPath: root.webappModelSearchPath
1390 webappUrlPatterns: root.webappUrlPatterns
1391 blockOpenExternalUrls: root.blockOpenExternalUrls
1392@@ -240,7 +238,7 @@
1393
1394 // check if we are to display the login view
1395 // or directly switch to the webapp view
1396- if (accountProvider.length !== 0 && oxide) {
1397+ if (accountProvider.length !== 0) {
1398 loadLoginView();
1399 } else {
1400 loadWebAppView();
1401
1402=== removed file 'tests/unittests/qml/tst_UbuntuWebView01.qml'
1403--- tests/unittests/qml/tst_UbuntuWebView01.qml 2014-03-17 10:16:11 +0000
1404+++ tests/unittests/qml/tst_UbuntuWebView01.qml 1970-01-01 00:00:00 +0000
1405@@ -1,46 +0,0 @@
1406-/*
1407- * Copyright 2013 Canonical Ltd.
1408- *
1409- * This file is part of webbrowser-app.
1410- *
1411- * webbrowser-app is free software; you can redistribute it and/or modify
1412- * it under the terms of the GNU General Public License as published by
1413- * the Free Software Foundation; version 3.
1414- *
1415- * webbrowser-app is distributed in the hope that it will be useful,
1416- * but WITHOUT ANY WARRANTY; without even the implied warranty of
1417- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1418- * GNU General Public License for more details.
1419- *
1420- * You should have received a copy of the GNU General Public License
1421- * along with this program. If not, see <http://www.gnu.org/licenses/>.
1422- */
1423-
1424-import QtQuick 2.0
1425-import QtTest 1.0
1426-import Ubuntu.Components.Extras.Browser 0.1
1427-
1428-TestCase {
1429- name: "UbuntuWebView"
1430-
1431- function test_custom_UA_override() {
1432- compare(webview1.getUAString(), undefined)
1433- // passing a 'url' parameter to getUAString()
1434- // (as was the API before) shouldn’t hurt:
1435- compare(webview1.getUAString("http://example.com"), undefined)
1436- verify(webview1.experimental.userAgent !== undefined)
1437- compare(webview2.experimental.userAgent, "custom UA")
1438- }
1439-
1440- UbuntuWebView {
1441- id: webview1
1442- }
1443-
1444- UbuntuWebView {
1445- id: webview2
1446-
1447- function getUAString(url) {
1448- return "custom UA"
1449- }
1450- }
1451-}
1452
1453=== removed file 'tests/unittests/qml/tst_UserAgent01.qml'
1454--- tests/unittests/qml/tst_UserAgent01.qml 2014-11-11 17:50:16 +0000
1455+++ tests/unittests/qml/tst_UserAgent01.qml 1970-01-01 00:00:00 +0000
1456@@ -1,83 +0,0 @@
1457-/*
1458- * Copyright 2013 Canonical Ltd.
1459- *
1460- * This file is part of webbrowser-app.
1461- *
1462- * webbrowser-app is free software; you can redistribute it and/or modify
1463- * it under the terms of the GNU General Public License as published by
1464- * the Free Software Foundation; version 3.
1465- *
1466- * webbrowser-app is distributed in the hope that it will be useful,
1467- * but WITHOUT ANY WARRANTY; without even the implied warranty of
1468- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1469- * GNU General Public License for more details.
1470- *
1471- * You should have received a copy of the GNU General Public License
1472- * along with this program. If not, see <http://www.gnu.org/licenses/>.
1473- */
1474-
1475-import QtQuick 2.0
1476-import QtTest 1.0
1477-
1478-TestCase {
1479- name: "UserAgent"
1480-
1481- function test_get_domain_data() {
1482- return [
1483- {url: "http://ubuntu.com", domain: "ubuntu.com"},
1484- {url: "http://www.ubuntu.com", domain: "www.ubuntu.com"},
1485- {url: "http://ubuntu.com/", domain: "ubuntu.com"},
1486- {url: "http://www.ubuntu.com/", domain: "www.ubuntu.com"},
1487- {url: "ubuntu.com", domain: "ubuntu.com"},
1488- {url: "ubuntu.com/", domain: "ubuntu.com"},
1489- {url: "ubuntu.com/phone", domain: "ubuntu.com"},
1490- {url: "http://ubuntu.com/phone", domain: "ubuntu.com"},
1491- {url: "www.ubuntu.com/phone", domain: "www.ubuntu.com"},
1492- {url: "http://ubuntu.com/phone/index.html", domain: "ubuntu.com"},
1493- {url: "ubuntu.com/phone/index.html", domain: "ubuntu.com"},
1494- {url: "www.ubuntu.com/phone/index.html", domain: "www.ubuntu.com"},
1495- {url: "http://ubuntu.com/phone/index.html?foo=bar&baz=bleh", domain: "ubuntu.com"},
1496- ]
1497- }
1498- function test_get_domain(data) {
1499- compare(userAgent.getDomain(data.url), data.domain)
1500- }
1501-
1502- function test_get_domains_data() {
1503- return [
1504- {domain: "ubuntu.com", domains: ["ubuntu.com", "com"]},
1505- {domain: "test.example.org", domains: ["test.example.org", "example.org", "org"]},
1506- ]
1507- }
1508- function test_get_domains(data) {
1509- compare(userAgent.getDomains(data.domain), data.domains)
1510- }
1511-
1512- function test_get_ua_string_data() {
1513- return [
1514- {url: "http://ubuntu.com", ua: userAgent.defaultUA},
1515- {url: "http://example.org", ua: "full override"},
1516- {url: "http://example.com/test", ua: "Mozilla/5.0 (Ubuntu Edge; Mobile) WebKit/537.21"},
1517- {url: "http://www.google.com/", ua: "Mozilla/5.0 (Ubuntu; ble) WebKit/537.21"},
1518- {url: "https://mail.google.com/", ua: "Mozilla/5.0 (Ubuntu; Touch) WebKit/537.21"},
1519- ]
1520- }
1521- function test_get_ua_string(data) {
1522- compare(userAgent.getUAString(data.url), data.ua)
1523- }
1524-
1525- readonly property Item userAgent: loader.item
1526- Loader {
1527- id: loader
1528- source: Qt.resolvedUrl("../../../src/Ubuntu/Components/Extras/Browser/UserAgent01.qml")
1529- onLoaded : {
1530- item.defaultUA = "Mozilla/5.0 (Ubuntu; Mobile) WebKit/537.21"
1531- item.overrides = {
1532- "example.org": "full override",
1533- "example.com": ["Ubuntu", "Ubuntu Edge"],
1534- "google.com": [/mobi/i, "b"],
1535- "mail.google.com": [/mobile/i, "Touch"],
1536- }
1537- }
1538- }
1539-}

Subscribers

People subscribed via source and target branches

to status/vote changes: