Merge lp:~osomon/webbrowser-app/target-blank-relative into lp:webbrowser-app

Proposed by Olivier Tilloy
Status: Merged
Approved by: Olivier Tilloy
Approved revision: 189
Merged at revision: 189
Proposed branch: lp:~osomon/webbrowser-app/target-blank-relative
Merge into: lp:webbrowser-app
Diff against target: 27 lines (+2/-3)
2 files modified
src/Ubuntu/Browser/hyperlinks.js (+1/-1)
tests/autopilot/webbrowser_app/tests/http_server.py (+1/-2)
To merge this branch: bzr merge lp:~osomon/webbrowser-app/target-blank-relative
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Approve
Ugo Riboni (community) Approve
Review via email: mp+169854@code.launchpad.net

Commit message

When redirecting a link with target="_blank" to a new tab, use the computed value of the href to ensure the path is absolute.

To post a comment you must log in.
Revision history for this message
Ugo Riboni (uriboni) wrote :

Code looks sane to me. Let's see what jenkins says.

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/Ubuntu/Browser/hyperlinks.js'
2--- src/Ubuntu/Browser/hyperlinks.js 2013-06-07 16:17:37 +0000
3+++ src/Ubuntu/Browser/hyperlinks.js 2013-06-17 17:05:31 +0000
4@@ -28,7 +28,7 @@
5 if (node.hasAttribute('target')) {
6 var target = node.getAttribute('target').toLowerCase();
7 if ((target == '_blank') || (target == '"_blank"')) {
8- var link = {'event': 'newtab', 'url': node.getAttribute('href')};
9+ var link = {'event': 'newtab', 'url': node.href};
10 navigator.qt.postMessage(JSON.stringify(link));
11 }
12 }
13
14=== modified file 'tests/autopilot/webbrowser_app/tests/http_server.py'
15--- tests/autopilot/webbrowser_app/tests/http_server.py 2013-06-07 17:14:39 +0000
16+++ tests/autopilot/webbrowser_app/tests/http_server.py 2013-06-17 17:05:31 +0000
17@@ -51,9 +51,8 @@
18 # and that requests opening another page in a new tab
19 self.send_response(200)
20 port = self.server.server_address[1]
21- url = 'http://localhost:%s/aleaiactaest' % port
22 html = '<html><body style="margin: 0">'
23- html += '<a href="%s" target="_blank">' % url
24+ html += '<a href="/aleaiactaest" target="_blank">'
25 html += '<div style="height: 100%"></div></a>'
26 html += '</body></html>'
27 self.send_html(html)

Subscribers

People subscribed via source and target branches

to status/vote changes: