[Pkg-javascript-commits] [sockjs-client] 105/350: Remove logs
tonnerre at ancient-solutions.com
tonnerre at ancient-solutions.com
Fri Aug 5 01:03:48 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 0904bc156de704d17ebef411b6ee9bb3719331ec
Author: Bryce Kahle <bkahle at gmail.com>
Date: Fri Oct 10 12:04:55 2014 -0400
Remove logs
---
lib/iframe-bootstrap.js | 21 +++++++++++----------
lib/transport/sender/jsonp.js | 3 +--
lib/utils/log.js | 9 ---------
3 files changed, 12 insertions(+), 21 deletions(-)
diff --git a/lib/iframe-bootstrap.js b/lib/iframe-bootstrap.js
index 2c67654..e289f44 100644
--- a/lib/iframe-bootstrap.js
+++ b/lib/iframe-bootstrap.js
@@ -1,6 +1,7 @@
'use strict';
-var utils = require('./utils')
+var originUtils = require('./utils/origin')
+ , eventUtils = require('./utils/event')
, JSON3 = require('json3')
, FacadeJS = require('./facade')
, InfoIframeFacade = require('./transport/facade/info-receiver-iframe')
@@ -16,6 +17,7 @@ module.exports = function (SockJS, facadeTransports) {
// hard-coded for the info iframe
// TODO see if we can make this more dynamic
transportMap[InfoIframeFacade.transportName] = InfoIframeFacade;
+ var parentOrigin;
/* eslint-disable camelcase */
SockJS.bootstrap_iframe = function() {
@@ -26,10 +28,10 @@ module.exports = function (SockJS, facadeTransports) {
if (e.source !== parent) {
return;
}
- if (typeof utils.parentOrigin === 'undefined') {
- utils.parentOrigin = e.origin;
+ if (typeof parentOrigin === 'undefined') {
+ parentOrigin = e.origin;
}
- if (e.origin !== utils.parentOrigin) {
+ if (e.origin !== parentOrigin) {
return;
}
@@ -48,17 +50,16 @@ module.exports = function (SockJS, facadeTransports) {
var baseUrl = p[3];
// change this to semver logic
if (version !== SockJS.version) {
- utils.log('Incompatibile SockJS! Main site uses:' +
+ throw new Error('Incompatibile SockJS! Main site uses:' +
' "' + version + '", the iframe:' +
' "' + SockJS.version + '".');
}
- if (!utils.isSameOriginUrl(transUrl, loc.href) ||
- !utils.isSameOriginUrl(baseUrl, loc.href)) {
- utils.log('Can\'t connect to different domain from within an ' +
+ if (!originUtils.isSameOriginUrl(transUrl, loc.href) ||
+ !originUtils.isSameOriginUrl(baseUrl, loc.href)) {
+ throw new Error('Can\'t connect to different domain from within an ' +
'iframe. (' + JSON3.stringify([global.location.href, transUrl, baseUrl]) +
')');
- return;
}
facade = new FacadeJS(new transportMap[transport](transUrl, baseUrl));
break;
@@ -74,7 +75,7 @@ module.exports = function (SockJS, facadeTransports) {
}
};
- utils.attachMessage(onMessage);
+ eventUtils.attachMessage(onMessage);
// Start
iframeUtils.postMessage('s');
diff --git a/lib/transport/sender/jsonp.js b/lib/transport/sender/jsonp.js
index 245ed46..f178f5d 100644
--- a/lib/transport/sender/jsonp.js
+++ b/lib/transport/sender/jsonp.js
@@ -1,7 +1,6 @@
'use strict';
var random = require('../../utils/random')
- , utils = require('../../utils/log')
;
module.exports = function (url, payload, callback) {
@@ -39,7 +38,7 @@ module.exports = function (url, payload, callback) {
try {
area.value = payload;
} catch(e) {
- utils.log('Your browser is seriously broken. Go home! ' + e.message);
+ // seriously broken browsers get here
}
form.submit();
diff --git a/lib/utils/log.js b/lib/utils/log.js
deleted file mode 100644
index a536915..0000000
--- a/lib/utils/log.js
+++ /dev/null
@@ -1,9 +0,0 @@
-'use strict';
-
-module.exports = {
- log: function() {
- if (global.console && console.log && console.log.apply) {
- console.log.apply(console, arguments);
- }
- }
-};
--
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