From e5290d2fd4aa5c892f5d3515bdc6510b10c12758 Mon Sep 17 00:00:00 2001 From: "Dominik D. Geyer" Date: Fri, 11 Oct 2013 16:29:41 +0200 Subject: [PATCH] Navigation: Added support for authority-less URI schemes. 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"). --- js/navigation/path.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/js/navigation/path.js b/js/navigation/path.js index 2aef38ca07d..480d2ee0903 100644 --- a/js/navigation/path.js +++ b/js/navigation/path.js @@ -50,10 +50,15 @@ define([ // mimic the browser with an empty string when the hash is empty hash = hash === "#" ? "" : 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 - return uri.protocol + "//" + uri.host + uri.pathname + uri.search + hash; + if (!uri.doubleSlash) { + // 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 + return uri.protocol + "//" + uri.host + uri.pathname + uri.search + hash; + } else { + // support URI schemes which contain only a path and no authority (e.g. "qrc:") + return uri.protocol + uri.pathname + uri.search + hash; + } }, //return the original document url