[Pkg-javascript-commits] [node-stream-http] 157/208: Fix feature testing on IE

Bastien Roucariès rouca at moszumanska.debian.org
Sun Aug 13 13:39:39 UTC 2017


This is an automated email from the git hooks/post-receive script.

rouca pushed a commit to branch master
in repository node-stream-http.

commit 4e7103a5a985a0d75ecb97be46020246de426c3f
Author: John Hiesey <john at hiesey.com>
Date:   Thu Oct 27 20:03:14 2016 -0700

    Fix feature testing on IE
    
    The previous commit broke IE<=9, since xhr doesn't work cross-domain.
    When XDomainRequest is available, use the current page instead of
    example.com
---
 lib/capability.js | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/capability.js b/lib/capability.js
index fa464b5..4801c8d 100644
--- a/lib/capability.js
+++ b/lib/capability.js
@@ -7,9 +7,9 @@ try {
 } catch (e) {}
 
 var xhr = new global.XMLHttpRequest()
-// The previous heuristics for what host to use were fragile.
-// Hopefully this works better and doesn't cause problems.
-xhr.open('GET', 'https://example.com')
+// If XDomainRequest is available (ie only, where xhr might not work
+// cross domain), use the page location. Otherwise use example.com
+xhr.open('GET', global.XDomainRequest ? '/' : 'https://example.com')
 
 function checkTypeSupport (type) {
 	try {

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-stream-http.git



More information about the Pkg-javascript-commits mailing list