Skip to content

Commit bc34f16

Browse files
committed
0.4.1
1 parent ca09f0b commit bc34f16

File tree

7 files changed

+39
-32
lines changed

7 files changed

+39
-32
lines changed

dist/client-0.4.0.min.js

Lines changed: 0 additions & 11 deletions
This file was deleted.

dist/client-0.4.0.js renamed to dist/client-0.4.1.js

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* cross-storage - Cross domain local storage
33
*
4-
* @version 0.4.0
4+
* @version 0.4.1
55
* @link https://github.com/zendesk/cross-storage
66
* @author Daniel St. Jules <danielst.jules@gmail.com>
77
* @copyright Zendesk
@@ -252,7 +252,7 @@ CrossStorageClient.prototype._installListener = function() {
252252
var client = this;
253253

254254
this._listener = function(message) {
255-
var i, error;
255+
var i, error, response;
256256

257257
if (client._closed) return;
258258

@@ -286,7 +286,12 @@ CrossStorageClient.prototype._installListener = function() {
286286
if (message.data === 'ready') return;
287287

288288
// All other messages
289-
var response = JSON.parse(message.data);
289+
try {
290+
response = JSON.parse(message.data);
291+
} catch(e) {
292+
return;
293+
}
294+
290295
if (!response.id) return;
291296

292297
if (client._requests[response.id]) {
@@ -330,11 +335,13 @@ CrossStorageClient.prototype._poll = function() {
330335
* returns {HTMLIFrameElement} The iFrame element itself
331336
*/
332337
CrossStorageClient.prototype._createFrame = function(url) {
333-
var frame = window.document.createElement('iframe');
338+
var frame, key;
339+
340+
frame = window.document.createElement('iframe');
334341
frame.id = this._frameId;
335342

336343
// Style the iframe
337-
for (var key in CrossStorageClient.frameStyle) {
344+
for (key in CrossStorageClient.frameStyle) {
338345
if (CrossStorageClient.frameStyle.hasOwnProperty(key)) {
339346
frame.style[key] = CrossStorageClient.frameStyle[key];
340347
}
@@ -374,8 +381,10 @@ CrossStorageClient.prototype._request = function(method, params) {
374381
};
375382

376383
return new this._promise(function(resolve, reject) {
384+
var timeout, originalToJSON;
385+
377386
// Timeout if a response isn't received after 4s
378-
var timeout = setTimeout(function() {
387+
timeout = setTimeout(function() {
379388
if (!client._requests[req.id]) return;
380389

381390
delete client._requests[req.id];
@@ -391,8 +400,6 @@ CrossStorageClient.prototype._request = function(method, params) {
391400

392401
// In case we have a broken Array.prototype.toJSON, e.g. because of
393402
// old versions of prototype
394-
var originalToJSON;
395-
396403
if (Array.prototype.toJSON) {
397404
originalToJSON = Array.prototype.toJSON;
398405
Array.prototype.toJSON = null;

dist/client-0.4.1.min.js

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/hub-0.4.0.min.js

Lines changed: 0 additions & 11 deletions
This file was deleted.

dist/hub-0.4.0.js renamed to dist/hub-0.4.1.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* cross-storage - Cross domain local storage
33
*
4-
* @version 0.4.0
4+
* @version 0.4.1
55
* @link https://github.com/zendesk/cross-storage
66
* @author Daniel St. Jules <danielst.jules@gmail.com>
77
* @copyright Zendesk

dist/hub-0.4.1.min.js

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "cross-storage",
3-
"version": "0.4.0",
3+
"version": "0.4.1",
44
"description": "Cross domain local storage",
55
"keywords": [
66
"local",

0 commit comments

Comments
 (0)