Merge lp://staging/~rpadovani/webbrowser-app/data-address into lp://staging/webbrowser-app

Proposed by Riccardo Padovani
Status: Merged
Approved by: Olivier Tilloy
Approved revision: 974
Merged at revision: 1003
Proposed branch: lp://staging/~rpadovani/webbrowser-app/data-address
Merge into: lp://staging/webbrowser-app
Prerequisite: lp://staging/~osomon/webbrowser-app/about-blank
Diff against target: 77 lines (+15/-3)
3 files modified
src/app/webbrowser/AddressBar.qml (+1/-1)
src/app/webbrowser/urlManagement.js (+6/-1)
tests/unittests/qml/tst_AddressBar.qml (+8/-1)
To merge this branch: bzr merge lp://staging/~rpadovani/webbrowser-app/data-address
Reviewer Review Type Date Requested Status
Olivier Tilloy Approve
PS Jenkins bot continuous-integration Needs Fixing
Review via email: mp+256367@code.staging.launchpad.net

Commit message

Add support for data: URIs in the address bar, and remove length limitation for TLDs.

Description of the change

Fix bug #1377953 - data: URIs don't work

You can find some tests here: http://www-archive.mozilla.org/quality/networking/testing/datatests.html

They don't work all as expected (as described in the page), but they work as Chromium on vivid, so I think it's acceptable

Fix bug #1441281 - update looksLikeAUrl().

Remove .tdl regex length limitation (min 2, max *)

Based on lp:~osomon/webbrowser-app/about-blank

To post a comment you must log in.
969. By Riccardo Padovani

Update tests

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 :

8 + } else if (address.substr(0, 4).toLowerCase == "data:") {
9 + return address.substr(0, 4).toLowerCase + address.substr(5);

I’d suggest using a regexp instead of String.substr(…), and no need to do the substr() dance again if you know that the scheme in lowercase is "data":

    if (address.match(/^data:/i)) {
        return "data:" + address.substr(5)
    }

Note that the CI job failed because your changes break the existing unit tests, probably because the call to substr should have been with a length of 5, not 4.

review: Needs Fixing
970. By Riccardo Padovani

Use regex instead of substr

Revision history for this message
Riccardo Padovani (rpadovani) wrote :

Thanks for the feedback, you're totally right :-)

Fixed!

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

I’m still seeing unit test failures. To run the unit tests locally and fix them:

    ctest -V -R tst_QmlTests

review: Needs Fixing
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
971. By Riccardo Padovani

Fix data uri tests

972. By Riccardo Padovani

Merge from upstream

973. By Riccardo Padovani

Fix implementation of urlManagement for data: address

Revision history for this message
Riccardo Padovani (rpadovani) wrote :

Tests fail because my implementation was wrong :-)

So, the data: address could has space in the url, so I need to check if is a data: address before checking if there are space in the address.

Then, for tdl, I need to check if the tld is > 2 ({2,}) and not 2 ({2}). Now should be all ok!

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 :

There’s no new unit test for longer TLDs.
The changes otherwise look good.

review: Needs Fixing
974. By Riccardo Padovani

Add test for tld longer than 3 chars

Revision history for this message
Riccardo Padovani (rpadovani) wrote :

Right.

I used http://com.google because it's the only valid one I know, is it ok?

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 :

That looks good now, thanks!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.

Subscribers

People subscribed via source and target branches

to status/vote changes: