[Pkg-javascript-commits] [sockjs-client] 163/350: Rename some utils. Remove need for url to test if a transport is enabled. Add proper enabled detection to htmlfile.

tonnerre at ancient-solutions.com tonnerre at ancient-solutions.com
Fri Aug 5 01:03:58 UTC 2016


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

tonnerre-guest pushed a commit to branch upstream
in repository sockjs-client.

commit d9baf70d56096a5529830edea3320fcb653ff99c
Author: Bryce Kahle <bkahle at gmail.com>
Date:   Fri Oct 17 11:31:39 2014 -0400

    Rename some utils. Remove need for url to test if a transport is enabled. Add proper enabled detection to htmlfile.
---
 lib/iframe-bootstrap.js            |  6 ++--
 lib/info-iframe.js                 |  4 +--
 lib/info-receiver.js               |  8 +++---
 lib/main.js                        |  9 +++---
 lib/sockjs.js                      |  4 +--
 lib/transport/htmlfile.js          |  4 +--
 lib/transport/iframe.js            | 14 +++-------
 lib/transport/lib/iframe-wrap.js   |  2 +-
 lib/transport/receiver/htmlfile.js | 29 ++++++++------------
 lib/transport/xdr-streaming.js     |  8 ++----
 lib/transport/xhr-polling.js       |  2 +-
 lib/transport/xhr-streaming.js     |  2 +-
 lib/utils/iframe.js                |  9 ++++++
 lib/utils/transport.js             |  4 +--
 lib/utils/{origin.js => url.js}    | 11 +++++---
 tests/lib/iframe.js                |  2 +-
 tests/lib/test-utils.js            |  4 +--
 tests/lib/transports.js            |  2 +-
 tests/lib/utils.js                 | 56 +++++++++++++++++++-------------------
 19 files changed, 90 insertions(+), 90 deletions(-)

diff --git a/lib/iframe-bootstrap.js b/lib/iframe-bootstrap.js
index 45b22b7..8d247d6 100644
--- a/lib/iframe-bootstrap.js
+++ b/lib/iframe-bootstrap.js
@@ -1,6 +1,6 @@
 'use strict';
 
-var originUtils = require('./utils/origin')
+var urlUtils = require('./utils/url')
   , eventUtils = require('./utils/event')
   , JSON3 = require('json3')
   , FacadeJS = require('./facade')
@@ -55,8 +55,8 @@ module.exports = function (SockJS, availableTransports) {
                     ' "' + SockJS.version + '".');
         }
 
-        if (!originUtils.isSameOriginUrl(transUrl, loc.href) ||
-            !originUtils.isSameOriginUrl(baseUrl, loc.href)) {
+        if (!urlUtils.isOriginEqual(transUrl, loc.href) ||
+            !urlUtils.isOriginEqual(baseUrl, loc.href)) {
           throw new Error('Can\'t connect to different domain from within an ' +
                     'iframe. (' + JSON3.stringify([loc.href, transUrl, baseUrl]) +
                     ')');
diff --git a/lib/info-iframe.js b/lib/info-iframe.js
index 67b69dd..77c8952 100644
--- a/lib/info-iframe.js
+++ b/lib/info-iframe.js
@@ -40,8 +40,8 @@ function InfoIframe(url) {
 
 util.inherits(InfoIframe, EventEmitter);
 
-InfoIframe.enabled = function (url) {
-  return IframeTransport.enabled(url);
+InfoIframe.enabled = function () {
+  return IframeTransport.enabled();
 };
 
 InfoIframe.prototype.close = function () {
diff --git a/lib/info-receiver.js b/lib/info-receiver.js
index 42ac813..c5fa93a 100644
--- a/lib/info-receiver.js
+++ b/lib/info-receiver.js
@@ -2,7 +2,7 @@
 
 var EventEmitter = require('events').EventEmitter
   , util = require('util')
-  , origin = require('./utils/origin')
+  , urlUtils = require('./utils/url')
   , loc = require('./polyfills/location')
   , XDR = require('./transport/sender/xdr')
   , XHRCors = require('./transport/sender/xhr-cors')
@@ -29,13 +29,13 @@ util.inherits(InfoReceiver, EventEmitter);
 
 InfoReceiver._getReceiver = function (baseUrl) {
   // determine method of CORS support (if needed)
-  if (origin.isSameOriginUrl(baseUrl, loc.href)) {
+  if (urlUtils.isOriginEqual(baseUrl, loc.href)) {
     return XHRLocal;
   } else if (XHRCors.enabled) {
     return XHRCors;
-  } else if (XDR.enabled && origin.isSameOriginScheme(baseUrl, loc.href)) {
+  } else if (XDR.enabled && urlUtils.isSchemeEqual(baseUrl, loc.href)) {
     return XDR;
-  } else if (InfoIframe.enabled(baseUrl)) {
+  } else if (InfoIframe.enabled()) {
     return null;
   }
   return XHRFake;
diff --git a/lib/main.js b/lib/main.js
index 95824c5..31dc59a 100644
--- a/lib/main.js
+++ b/lib/main.js
@@ -8,7 +8,7 @@ var u = require('url')
   , debug = require('debug')
   , random = require('./utils/random')
   , escape = require('./utils/escape')
-  , origin = require('./utils/origin')
+  , urlUtils = require('./utils/url')
   , eventUtils = require('./utils/event')
   , transport = require('./utils/transport')
   , SecurityError = require('./error/securityerror')
@@ -80,7 +80,7 @@ function SockJS(url, protocols, transportsWhitelist) {
   });
 
   // Step 6 - convert origin
-  var o = origin.getOrigin(loc.href);
+  var o = urlUtils.getOrigin(loc.href);
   this._origin = o ? o.toLowerCase() : null;
 
   // strip port numbers for 80 and 443 cases
@@ -167,10 +167,11 @@ SockJS.prototype._receiveInfo = function(info, rtt) {
   // allow server to override url used for the actual transport
   this._transUrl = info.base_url ? info.base_url : this.url;
   info.nullOrigin = global.document && !global.document.domain;
-  info.sameOrigin = origin.isSameOriginUrl(this.url, loc.href);
+  info.sameOrigin = urlUtils.isOriginEqual(this.url, loc.href);
+  info.sameScheme = urlUtils.isSchemeEqual(this.url, loc.href);
   debug('info: ', info);
   // determine list of desired and supported transports
-  var enabledTransports = transports.filterToEnabled(this.url, this._transportsWhitelist, info);
+  var enabledTransports = transports.filterToEnabled(this._transportsWhitelist, info);
   this._transports = enabledTransports.main;
   debug(this._transports.length + ' enabled transports');
 
diff --git a/lib/sockjs.js b/lib/sockjs.js
index 9ef0b59..2075bd6 100644
--- a/lib/sockjs.js
+++ b/lib/sockjs.js
@@ -295,8 +295,8 @@ SockJS.bootstrap_iframe = function() {
                 return;
             }
 
-            if (!utils.isSameOriginUrl(trans_url) ||
-                !utils.isSameOriginUrl(base_url)) {
+            if (!utils.isOriginEqual(trans_url) ||
+                !utils.isOriginEqual(base_url)) {
                 utils.log("Can't connect to different domain from within an " +
                           "iframe. (" + JSON3.stringify([window.location.href, trans_url, base_url]) +
                           ")");
diff --git a/lib/transport/htmlfile.js b/lib/transport/htmlfile.js
index f790eb4..add02d6 100644
--- a/lib/transport/htmlfile.js
+++ b/lib/transport/htmlfile.js
@@ -12,8 +12,8 @@ function HtmlFileTransport(transUrl) {
 
 util.inherits(HtmlFileTransport, AjaxBasedTransport);
 
-HtmlFileTransport.enabled = function (url, info) {
-  return info.sameOrigin;
+HtmlFileTransport.enabled = function (info) {
+  return HtmlfileReceiver.enabled && info.sameOrigin;
 };
 
 HtmlFileTransport.transportName = 'htmlfile';
diff --git a/lib/transport/iframe.js b/lib/transport/iframe.js
index 75a9187..31e53cc 100644
--- a/lib/transport/iframe.js
+++ b/lib/transport/iframe.js
@@ -12,7 +12,7 @@ var util = require('util')
   , JSON3 = require('json3')
   , EventEmitter = require('events').EventEmitter
   , version = require('../version')
-  , originUtils = require('../utils/origin')
+  , urlUtils = require('../utils/url')
   , iframeUtils = require('../utils/iframe')
   , eventUtils = require('../utils/event')
   , random = require('../utils/random')
@@ -25,7 +25,7 @@ function IframeTransport(transport, transUrl, baseUrl) {
   EventEmitter.call(this);
 
   var self = this;
-  this.origin = originUtils.getOrigin(baseUrl);
+  this.origin = urlUtils.getOrigin(baseUrl);
   this.baseUrl = baseUrl;
   this.transUrl = transUrl;
   this.transport = transport;
@@ -63,7 +63,7 @@ IframeTransport.prototype.close = function() {
 
 IframeTransport.prototype._message = function(e) {
   debug('message', e.data);
-  if (!originUtils.isSameOriginUrl(e.origin, this.origin)) {
+  if (!urlUtils.isOriginEqual(e.origin, this.origin)) {
     debug('not same origin', e.origin, this.origin);
     return;
   }
@@ -112,13 +112,7 @@ IframeTransport.prototype.send = function (message) {
 };
 
 IframeTransport.enabled = function() {
-  if (!global.document) {
-    return false;
-  }
-  // postMessage misbehaves in konqueror 4.6.5 - the messages are delivered with
-  // huge delay, or not at all.
-  return ((typeof global.postMessage === 'function' ||
-          typeof global.postMessage === 'object') && (!browser.isKonqueror()));
+  return iframeUtils.iframeEnabled;
 };
 
 IframeTransport.transportName = 'iframe';
diff --git a/lib/transport/lib/iframe-wrap.js b/lib/transport/lib/iframe-wrap.js
index a0b487b..a9b4575 100644
--- a/lib/transport/lib/iframe-wrap.js
+++ b/lib/transport/lib/iframe-wrap.js
@@ -20,7 +20,7 @@ module.exports = function (transport) {
 
     var iframeInfo = objectUtils.extend({}, info);
     iframeInfo.sameOrigin = true;
-    return transport.enabled(url, iframeInfo) && IframeTransport.enabled();
+    return transport.enabled(iframeInfo) && IframeTransport.enabled();
   };
 
   IframeWrapTransport.transportName = 'iframe-' + transport.transportName;
diff --git a/lib/transport/receiver/htmlfile.js b/lib/transport/receiver/htmlfile.js
index 281a690..f1edf97 100644
--- a/lib/transport/receiver/htmlfile.js
+++ b/lib/transport/receiver/htmlfile.js
@@ -7,21 +7,6 @@ var util = require('util')
   , debug = require('debug')('sockjs-client:receiver:htmlfile')
   ;
 
-var _isIeHtmlfileCapable;
-var isIeHtmlfileCapable = function() {
-  if (_isIeHtmlfileCapable === undefined) {
-    if ('ActiveXObject' in global) {
-      try {
-        _isIeHtmlfileCapable = !!new global.ActiveXObject('htmlfile');
-      } catch (x) {}
-    } else {
-      _isIeHtmlfileCapable = false;
-    }
-  }
-  return _isIeHtmlfileCapable;
-};
-
-
 function HtmlfileReceiver(url) {
   debug(url);
   EventEmitter.call(this);
@@ -32,8 +17,8 @@ function HtmlfileReceiver(url) {
   url += ((url.indexOf('?') === -1) ? '?' : '&') +
       'c=' + decodeURIComponent(iframeUtils.WPrefix + '.' + this.id);
 
-  debug('using htmlfile', _isIeHtmlfileCapable);
-  var constructor = isIeHtmlfileCapable() ?
+  debug('using htmlfile', HtmlfileReceiver.htmlfileEnabled);
+  var constructor = HtmlfileReceiver.htmlfileEnabled ?
       iframeUtils.createHtmlfile : iframeUtils.createIframe;
 
   global[iframeUtils.WPrefix][this.id] = {
@@ -81,4 +66,14 @@ HtmlfileReceiver.prototype._close = function (reason) {
   this.removeAllListeners();
 };
 
+HtmlfileReceiver.htmlfileEnabled = false;
+
+if ('ActiveXObject' in global) {
+  try {
+    HtmlfileReceiver.htmlfileEnabled = !!new global.ActiveXObject('htmlfile');
+  } catch (x) {}
+}
+
+HtmlfileReceiver.enabled = HtmlfileReceiver.htmlfileEnabled || iframeUtils.iframeEnabled;
+
 module.exports = HtmlfileReceiver;
diff --git a/lib/transport/xdr-streaming.js b/lib/transport/xdr-streaming.js
index 30d850f..b6a036e 100644
--- a/lib/transport/xdr-streaming.js
+++ b/lib/transport/xdr-streaming.js
@@ -4,8 +4,6 @@ var util = require('util')
   , AjaxBasedTransport = require('./lib/ajax-based')
   , XhrReceiver = require('./receiver/xhr')
   , XDRObject = require('./sender/xdr')
-  , origin = require('../utils/origin')
-  , loc = require('../polyfills/location')
   ;
 
 // According to:
@@ -18,11 +16,11 @@ function XdrStreamingTransport(transUrl) {
 
 util.inherits(XdrStreamingTransport, AjaxBasedTransport);
 
-XdrStreamingTransport.enabled = function(url, info) {
-  if (info && (info.cookie_needed || info.nullOrigin)) {
+XdrStreamingTransport.enabled = function(info) {
+  if (info.cookie_needed || info.nullOrigin) {
     return false;
   }
-  return XDRObject.enabled && origin.isSameOriginScheme(url, loc.href);
+  return XDRObject.enabled && info.sameScheme;
 };
 
 XdrStreamingTransport.transportName = 'xdr-streaming';
diff --git a/lib/transport/xhr-polling.js b/lib/transport/xhr-polling.js
index f89959d..b1b144a 100644
--- a/lib/transport/xhr-polling.js
+++ b/lib/transport/xhr-polling.js
@@ -13,7 +13,7 @@ function XhrPollingTransport(transUrl) {
 
 util.inherits(XhrPollingTransport, AjaxBasedTransport);
 
-XhrPollingTransport.enabled = function(url, info) {
+XhrPollingTransport.enabled = function(info) {
   if (info.nullOrigin) {
     return false;
   }
diff --git a/lib/transport/xhr-streaming.js b/lib/transport/xhr-streaming.js
index 6dea149..cab4942 100644
--- a/lib/transport/xhr-streaming.js
+++ b/lib/transport/xhr-streaming.js
@@ -14,7 +14,7 @@ function XhrStreamingTransport(transUrl) {
 
 util.inherits(XhrStreamingTransport, AjaxBasedTransport);
 
-XhrStreamingTransport.enabled = function(url, info) {
+XhrStreamingTransport.enabled = function(info) {
   if (info.nullOrigin) {
     return false;
   }
diff --git a/lib/utils/iframe.js b/lib/utils/iframe.js
index 670de81..4f13ad7 100644
--- a/lib/utils/iframe.js
+++ b/lib/utils/iframe.js
@@ -2,6 +2,7 @@
 
 var eventUtils = require('./event')
   , JSON3 = require('json3')
+  , browser = require('./browser')
   , debug = require('debug')('sockjs-client:utils:iframe')
   ;
 
@@ -163,3 +164,11 @@ module.exports = {
     };
   }
 };
+
+module.exports.iframeEnabled = false;
+if (global.document) {
+  // postMessage misbehaves in konqueror 4.6.5 - the messages are delivered with
+  // huge delay, or not at all.
+  module.exports.iframeEnabled = (typeof global.postMessage === 'function' ||
+    typeof global.postMessage === 'object') && (!browser.isKonqueror());
+}
diff --git a/lib/utils/transport.js b/lib/utils/transport.js
index 756249f..74d2578 100644
--- a/lib/utils/transport.js
+++ b/lib/utils/transport.js
@@ -4,7 +4,7 @@ var debug = require('debug')('sockjs-client:utils:transport');
 
 module.exports = function (availableTransports) {
   return {
-    filterToEnabled: function (url, transportsWhitelist, info) {
+    filterToEnabled: function (transportsWhitelist, info) {
       var transports = {
         main: []
       , facade: []
@@ -31,7 +31,7 @@ module.exports = function (availableTransports) {
           return;
         }
 
-        if (trans.enabled(url, info)) {
+        if (trans.enabled(info)) {
           debug('enabled', trans.transportName);
           transports.main.push(trans);
           if (trans.facadeTransport) {
diff --git a/lib/utils/origin.js b/lib/utils/url.js
similarity index 58%
rename from lib/utils/origin.js
rename to lib/utils/url.js
index 4501da7..13fdad8 100644
--- a/lib/utils/origin.js
+++ b/lib/utils/url.js
@@ -1,6 +1,7 @@
 'use strict';
 
 var u = require('url');
+var debug = require('debug')('sockjs-client:utils:url');
 
 module.exports = {
   getOrigin: function (url) {
@@ -21,11 +22,13 @@ module.exports = {
     return p.protocol + '//' + p.hostname + ':' + port;
   }
 
-, isSameOriginUrl: function(urlA, urlB) {
-    return this.getOrigin(urlA) === this.getOrigin(urlB);
+, isOriginEqual: function(a, b) {
+    var res = this.getOrigin(a) === this.getOrigin(b);
+    debug('same', a, b, res);
+    return res;
   }
 
-, isSameOriginScheme: function(urlA, urlB) {
-    return (urlA.split(':')[0] === urlB.split(':')[0]);
+, isSchemeEqual: function(a, b) {
+    return (a.split(':')[0] === b.split(':')[0]);
   }
 };
diff --git a/tests/lib/iframe.js b/tests/lib/iframe.js
index 4149887..e656f30 100644
--- a/tests/lib/iframe.js
+++ b/tests/lib/iframe.js
@@ -104,7 +104,7 @@ describe('iframe', function () {
 describe('Transports', function () {
   transportList.forEach(function (Trans) {
     describe(Trans.transportName, function () {
-      if (!Trans.enabled(testUtils.getUrl('/echo'), { cookie_needed: false, nullOrigin: false })) {
+      if (!Trans.enabled({ cookie_needed: false, nullOrigin: false, sameScheme: true, sameOrigin: true })) {
         return;
       }
 
diff --git a/tests/lib/test-utils.js b/tests/lib/test-utils.js
index 669242d..d9ddc1b 100644
--- a/tests/lib/test-utils.js
+++ b/tests/lib/test-utils.js
@@ -2,7 +2,7 @@
 
 var SockJS = require('../../lib/entry')
   , iframeUtils = require('../../lib/utils/iframe')
-  , origin = require('../../lib/utils/origin')
+  , urlUtils = require('../../lib/utils/url')
   , random = require('../../lib/utils/random')
   ;
 
@@ -11,7 +11,7 @@ var MPrefix = '_sockjs_global';
 module.exports = {
   getOriginUrl: function () {
     if (global.location) {
-      return origin.getOrigin(global.location.href);
+      return urlUtils.getOrigin(global.location.href);
     }
     return 'http://localhost:8081';
   }
diff --git a/tests/lib/transports.js b/tests/lib/transports.js
index cd716c4..e609d64 100644
--- a/tests/lib/transports.js
+++ b/tests/lib/transports.js
@@ -33,7 +33,7 @@ describe('Transports', function () {
         // TODO tests for event emitting
       });
 
-      if (!Trans.enabled(testUtils.getUrl('/echo'), { cookie_needed: false, nullOrigin: false })) {
+      if (!Trans.enabled({ cookie_needed: false, nullOrigin: false, sameScheme: true, sameOrigin: true })) {
         it('[unsupported]', function () { expect(true).to.be.ok(); });
         return;
       }
diff --git a/tests/lib/utils.js b/tests/lib/utils.js
index dd0fd4c..e5f0b63 100644
--- a/tests/lib/utils.js
+++ b/tests/lib/utils.js
@@ -31,39 +31,39 @@ describe('utils', function () {
     });
   });
 
-  describe('origin', function () {
-    var origin = require('../../lib/utils/origin');
+  describe('url', function () {
+    var urlUtils = require('../../lib/utils/url');
     it('getOrigin', function () {
-      expect(origin.getOrigin('http://a.b/')).to.equal('http://a.b:80');
-      expect(origin.getOrigin('http://a.b/c')).to.equal('http://a.b:80');
-      expect(origin.getOrigin('http://a.b:123/c')).to.equal('http://a.b:123');
-      expect(origin.getOrigin('https://a.b/')).to.equal('https://a.b:443');
-      expect(origin.getOrigin('file://a.b/')).to.equal(null);
+      expect(urlUtils.getOrigin('http://a.b/')).to.equal('http://a.b:80');
+      expect(urlUtils.getOrigin('http://a.b/c')).to.equal('http://a.b:80');
+      expect(urlUtils.getOrigin('http://a.b:123/c')).to.equal('http://a.b:123');
+      expect(urlUtils.getOrigin('https://a.b/')).to.equal('https://a.b:443');
+      expect(urlUtils.getOrigin('file://a.b/')).to.equal(null);
     });
 
-    it('isSameOriginUrl', function () {
-      expect(origin.isSameOriginUrl('http://localhost', 'http://localhost/')).to.be.ok();
-      expect(origin.isSameOriginUrl('http://localhost', 'http://localhost/abc')).to.be.ok();
-      expect(origin.isSameOriginUrl('http://localhost/', 'http://localhost')).to.be.ok();
-      expect(origin.isSameOriginUrl('http://localhost', 'http://localhost')).to.be.ok();
-      expect(origin.isSameOriginUrl('http://localhost', 'http://localhost:8080')).to.not.be.ok();
-      expect(origin.isSameOriginUrl('http://localhost:8080', 'http://localhost')).to.not.be.ok();
-      expect(origin.isSameOriginUrl('http://localhost:8080', 'http://localhost:8080/')).to.be.ok();
-      expect(origin.isSameOriginUrl('http://127.0.0.1:80/', 'http://127.0.0.1:80/a')).to.be.ok();
-      expect(origin.isSameOriginUrl('http://127.0.0.1:80', 'http://127.0.0.1:80/a')).to.be.ok();
-      expect(origin.isSameOriginUrl('http://localhost', 'http://localhost:80')).to.be.ok();
-      expect(origin.isSameOriginUrl('http://127.0.0.1/', 'http://127.0.0.1:80/a')).to.be.ok();
-      expect(origin.isSameOriginUrl('http://127.0.0.1:9', 'http://127.0.0.1:9999')).to.not.be.ok();
-      expect(origin.isSameOriginUrl('http://127.0.0.1:99', 'http://127.0.0.1:9999')).to.not.be.ok();
-      expect(origin.isSameOriginUrl('http://127.0.0.1:999', 'http://127.0.0.1:9999')).to.not.be.ok();
-      expect(origin.isSameOriginUrl('http://127.0.0.1:9999', 'http://127.0.0.1:9999')).to.be.ok();
-      expect(origin.isSameOriginUrl('http://127.0.0.1:99999', 'http://127.0.0.1:9999')).to.not.be.ok();
+    it('isOriginEqual', function () {
+      expect(urlUtils.isOriginEqual('http://localhost', 'http://localhost/')).to.be.ok();
+      expect(urlUtils.isOriginEqual('http://localhost', 'http://localhost/abc')).to.be.ok();
+      expect(urlUtils.isOriginEqual('http://localhost/', 'http://localhost')).to.be.ok();
+      expect(urlUtils.isOriginEqual('http://localhost', 'http://localhost')).to.be.ok();
+      expect(urlUtils.isOriginEqual('http://localhost', 'http://localhost:8080')).to.not.be.ok();
+      expect(urlUtils.isOriginEqual('http://localhost:8080', 'http://localhost')).to.not.be.ok();
+      expect(urlUtils.isOriginEqual('http://localhost:8080', 'http://localhost:8080/')).to.be.ok();
+      expect(urlUtils.isOriginEqual('http://127.0.0.1:80/', 'http://127.0.0.1:80/a')).to.be.ok();
+      expect(urlUtils.isOriginEqual('http://127.0.0.1:80', 'http://127.0.0.1:80/a')).to.be.ok();
+      expect(urlUtils.isOriginEqual('http://localhost', 'http://localhost:80')).to.be.ok();
+      expect(urlUtils.isOriginEqual('http://127.0.0.1/', 'http://127.0.0.1:80/a')).to.be.ok();
+      expect(urlUtils.isOriginEqual('http://127.0.0.1:9', 'http://127.0.0.1:9999')).to.not.be.ok();
+      expect(urlUtils.isOriginEqual('http://127.0.0.1:99', 'http://127.0.0.1:9999')).to.not.be.ok();
+      expect(urlUtils.isOriginEqual('http://127.0.0.1:999', 'http://127.0.0.1:9999')).to.not.be.ok();
+      expect(urlUtils.isOriginEqual('http://127.0.0.1:9999', 'http://127.0.0.1:9999')).to.be.ok();
+      expect(urlUtils.isOriginEqual('http://127.0.0.1:99999', 'http://127.0.0.1:9999')).to.not.be.ok();
     });
 
-    it('isSameOriginScheme', function () {
-      expect(origin.isSameOriginScheme('http://localhost', 'http://localhost/')).to.be.ok();
-      expect(origin.isSameOriginScheme('http://localhost', 'https://localhost/')).to.not.be.ok();
-      expect(origin.isSameOriginScheme('http://localhost', 'file://localhost/')).to.not.be.ok();
+    it('isSchemeEqual', function () {
+      expect(urlUtils.isSchemeEqual('http://localhost', 'http://localhost/')).to.be.ok();
+      expect(urlUtils.isSchemeEqual('http://localhost', 'https://localhost/')).to.not.be.ok();
+      expect(urlUtils.isSchemeEqual('http://localhost', 'file://localhost/')).to.not.be.ok();
     });
   });
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/sockjs-client.git



More information about the Pkg-javascript-commits mailing list