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
=== modified file 'src/Ubuntu/Browser/hyperlinks.js'
--- src/Ubuntu/Browser/hyperlinks.js 2013-06-07 16:17:37 +0000
+++ src/Ubuntu/Browser/hyperlinks.js 2013-06-17 17:05:31 +0000
@@ -28,7 +28,7 @@
28 if (node.hasAttribute('target')) {28 if (node.hasAttribute('target')) {
29 var target = node.getAttribute('target').toLowerCase();29 var target = node.getAttribute('target').toLowerCase();
30 if ((target == '_blank') || (target == '"_blank"')) {30 if ((target == '_blank') || (target == '"_blank"')) {
31 var link = {'event': 'newtab', 'url': node.getAttribute('href')};31 var link = {'event': 'newtab', 'url': node.href};
32 navigator.qt.postMessage(JSON.stringify(link));32 navigator.qt.postMessage(JSON.stringify(link));
33 }33 }
34 }34 }
3535
=== modified file 'tests/autopilot/webbrowser_app/tests/http_server.py'
--- tests/autopilot/webbrowser_app/tests/http_server.py 2013-06-07 17:14:39 +0000
+++ tests/autopilot/webbrowser_app/tests/http_server.py 2013-06-17 17:05:31 +0000
@@ -51,9 +51,8 @@
51 # and that requests opening another page in a new tab51 # and that requests opening another page in a new tab
52 self.send_response(200)52 self.send_response(200)
53 port = self.server.server_address[1]53 port = self.server.server_address[1]
54 url = 'http://localhost:%s/aleaiactaest' % port
55 html = '<html><body style="margin: 0">'54 html = '<html><body style="margin: 0">'
56 html += '<a href="%s" target="_blank">' % url55 html += '<a href="/aleaiactaest" target="_blank">'
57 html += '<div style="height: 100%"></div></a>'56 html += '<div style="height: 100%"></div></a>'
58 html += '</body></html>'57 html += '</body></html>'
59 self.send_html(html)58 self.send_html(html)

Subscribers

People subscribed via source and target branches

to status/vote changes: