[Pkg-javascript-commits] [dojo] 05/16: Refs #8546, allow using protocol-relative URLs with xd loader (backport to 1.5 branch)
David Prévot
taffit at moszumanska.debian.org
Thu Aug 21 17:39:03 UTC 2014
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to annotated tag 1.5.3
in repository dojo.
commit 59d48c726c196cf88ba63fad136bfa32f22e922b
Author: James Burke <jrburke at gmail.com>
Date: Sat Sep 4 05:19:57 2010 +0000
Refs #8546, allow using protocol-relative URLs with xd loader (backport to 1.5 branch)
git-svn-id: http://svn.dojotoolkit.org/src/branches/1.5/dojo@22829 560b804f-0ae3-0310-86f3-f6aa0a117693
---
_base/_loader/loader_xd.js | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/_base/_loader/loader_xd.js b/_base/_loader/loader_xd.js
index f8dca7d..30f7c8c 100644
--- a/_base/_loader/loader_xd.js
+++ b/_base/_loader/loader_xd.js
@@ -161,19 +161,23 @@ dojo._xdIsXDomainPath = function(/*string*/relpath) {
var colonIndex = relpath.indexOf(":");
var slashIndex = relpath.indexOf("/");
- if(colonIndex > 0 && colonIndex < slashIndex){
+ if(colonIndex > 0 && colonIndex < slashIndex || relpath.indexOf("//") === 0){
return true;
}else{
//Is the base script URI-based URL a cross domain URL?
//If so, then the relpath will be evaluated relative to
//baseUrl, and therefore qualify as xdomain.
//Only treat it as xdomain if the page does not have a
- //host (file:// url) or if the baseUrl does not match the
- //current window's domain.
+ //host (file:// url), if the baseUrl does not match the
+ //current window's domain, or if the baseUrl starts with //.
+ //If baseUrl starts with // then it probably means that xdomain
+ //is wanted since it is such a specific path request. This is not completely robust,
+ //but something more robust would require normalizing the protocol on baseUrl and on the location
+ //to see if they differ. However, that requires more code, and // as a start path is unusual.
var url = dojo.baseUrl;
colonIndex = url.indexOf(":");
slashIndex = url.indexOf("/");
- if(colonIndex > 0 && colonIndex < slashIndex && (!location.host || url.indexOf("http://" + location.host) != 0)){
+ if(url.indexOf("//") === 0 || (colonIndex > 0 && colonIndex < slashIndex && (!location.host || url.indexOf("http://" + location.host) != 0))){
return true;
}
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/dojo.git
More information about the Pkg-javascript-commits
mailing list