Skip to content
This repository was archived by the owner on Oct 8, 2021. It is now read-only.

Navigation: Added support for authority-less URI schemes.#6597

Closed
datag wants to merge 1 commit intojquery-archive:masterfrom
datag:master
Closed

Navigation: Added support for authority-less URI schemes.#6597
datag wants to merge 1 commit intojquery-archive:masterfrom
datag:master

Conversation

@datag
Copy link

@datag datag commented Oct 11, 2013

For URI schemes like "qrc:" (Qt resource) which do not include an
authority but only a path the method $.mobile.path.getLocation()
incorrectly returns a URL with a double slash after the scheme name.

In a Qt Webkit ThinClient application this resulted in continuously
adding up slashes in front of the path (e.g. "qrc://////index.html").


Remark: Please note that I'm currently unable to test this modification (lack of a Qt ThinClient) and this change is untested in its current state. Just let me know whether you're able to reproduce and test or postpone this change until I'm able to do a final test myself.

For URI schemes like "qrc:" (Qt resource) which do not include an
authority but only a path the method $.mobile.path.getLocation()
incorrectly returns a URL with a double slash after the scheme name.

In a Qt Webkit ThinClient application this resulted in continuously
adding up slashes in front of the path (e.g. "qrc://////index.html").
@datag
Copy link
Author

datag commented Oct 11, 2013

Just for further clarification, here's my currently used and tested dirty fix for described issue with "qrc:" URI scheme in a Qt ThinClient application - it's not a proper fix for merge:

[PATCH] Navigation: Dirty hack for authority-less URI scheme "qrc:"

diff --git a/js/navigation/path.js b/js/navigation/path.js
--- a/js/navigation/path.js
+++ b/js/navigation/path.js
@@ -50,6 +50,11 @@ define([
                // mimic the browser with an empty string when the hash is empty
                hash = hash === "#" ? "" : hash;

+               // hack for Qt Webkit "qrc:"-scheme
+               if (uri.protocol === "qrc:") {
+                   return "qrc:" + uri.pathname + uri.search + hash;
+               }
+
                // Make sure to parse the url or the location object for the hash because using location.hash
                // is autodecoded in firefox, the rest of the url should be from the object (location unless
                // we're testing) to avoid the inclusion of the authority

@arschmitz
Copy link
Contributor

Can you please open an issue for this describing and reproducing the bug. were we can discuss the issue before deciding on how to fix this. Please see our contributing guidelines for a jsbin template to use to demonstrate. Even if you cant actually reproduce here because of use of thin client it gives us an easily copied and modifiable test page to use. Also not there are 5 failing navigation tests in your PR. were we can discuss the issue before deciding on how to fix this.

@datag
Copy link
Author

datag commented Oct 11, 2013

Yes, I will open a separate issue as soon as I've prepared a clean testcase. For the moment, one might have a look at a quick testcase simply testing whether jQuery mobile alters a "qrc:/index.html" URI incorrectly to "qrc:///index.html": http://jsbin.com/ukewu3/482

@arschmitz
Copy link
Contributor

thank you for that test can you please use the new jsbin test page out of our contributing guidelines https://github.com/jquery/jquery-mobile/blob/master/CONTRIBUTING.md /latest is no longer updated so that is old code now http://jsbin.com/ofuhaw/1/edit Thank you. Also if you have not already can you please sign our CLA http://contribute.jquery.org/CLA/

@gabrielschulhof
Copy link

x-wmapp0 and x-wmapp1 are also authority-less URL schemes ...

gabrielschulhof pushed a commit that referenced this pull request Mar 20, 2014
Note: this does indeed represent a fix for gh-6574, but only once a version of
Cordova sporting apache/cordova-wp8#30 is released.

Closes gh-6597
Fixes gh-6574
Fixes gh-6599
gabrielschulhof pushed a commit that referenced this pull request Apr 8, 2014
Note: this does indeed represent a fix for gh-6574, but only once a version of
Cordova sporting apache/cordova-wp8#30 is released.

Closes gh-6597
Fixes gh-6574
Fixes gh-6599
gabrielschulhof pushed a commit that referenced this pull request May 29, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants