[Pkg-javascript-commits] [sockjs-client] 338/434: Cosmetic: rename isLocalUrl --> isSameOriginUrl

Tonnerre Lombard tonnerre-guest at moszumanska.debian.org
Wed Jan 8 00:47:23 UTC 2014


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

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

commit c29db92eddf58947ce3b5d1facfa199077776a23
Author: Marek Majkowski <majek04 at gmail.com>
Date:   Wed Feb 1 10:51:19 2012 +0000

    Cosmetic: rename isLocalUrl --> isSameOriginUrl
---
 lib/info.js                | 2 +-
 lib/trans-iframe-within.js | 3 ++-
 lib/utils.js               | 2 +-
 3 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/lib/info.js b/lib/info.js
index 6ed950e..a3543ae 100644
--- a/lib/info.js
+++ b/lib/info.js
@@ -75,7 +75,7 @@ var InfoReceiverFake = function() {
 InfoReceiverFake.prototype = new EventEmitter(['finish']);
 
 var createInfoReceiver = function(base_url) {
-    if (utils.isLocalUrl(base_url)) {
+    if (utils.isSameOriginUrl(base_url)) {
         // If, for some reason, we have SockJS locally - there's no
         // need to start up the complex machinery. Just use ajax.
         return new InfoReceiver(base_url, utils.XHRObject);
diff --git a/lib/trans-iframe-within.js b/lib/trans-iframe-within.js
index 4fb2319..0565747 100644
--- a/lib/trans-iframe-within.js
+++ b/lib/trans-iframe-within.js
@@ -43,7 +43,8 @@ SockJS.bootstrap_iframe = function() {
                           " \"" + version + "\", the iframe:" +
                           " \"" + SockJS.version + "\".");
             }
-            if (!utils.isLocalUrl(trans_url) || !utils.isLocalUrl(base_url)) {
+            if (!utils.isSameOriginUrl(trans_url) ||
+                !utils.isSameOriginUrl(base_url)) {
                 utils.log("Can't connect to different domain from within an " +
                           "iframe. (" + JSON.stringify([_window.location.href, trans_url, base_url]) +
                           ")");
diff --git a/lib/utils.js b/lib/utils.js
index 7e88083..865ce53 100644
--- a/lib/utils.js
+++ b/lib/utils.js
@@ -23,7 +23,7 @@ utils.getOrigin = function(url) {
     return parts.join('/');
 };
 
-utils.isLocalUrl = function(url) {
+utils.isSameOriginUrl = function(url) {
     // location.origin would do, but it's not available in some
     // browsers.
     var o = _window.location.href.split('/').slice(0,3).join('/');

-- 
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