Skip to content
This repository has been archived by the owner on Apr 20, 2022. It is now read-only.

Commit

Permalink
Fix Error When Local Storage is disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
Ben Reeves committed Jan 28, 2013
1 parent e2fa84f commit 03be6d7
Show file tree
Hide file tree
Showing 10 changed files with 57 additions and 25 deletions.
17 changes: 11 additions & 6 deletions account.js
Expand Up @@ -113,19 +113,19 @@ var AccountSettings = new function() {
});
}

this.bind = function() {
this.bind = function(success, error) {
setDoubleEncryptionButton();

bindAccountButtons();

getAccountInfo();
getAccountInfo(success, error);
}

this.init = function(container, success, error) {
MyWallet.setLoadingText('Loading Account Settings');

if (!container.is(':empty')) {
AccountSettings.bind();
AccountSettings.bind(success, error);
success();
return;
}
Expand All @@ -138,7 +138,7 @@ var AccountSettings = new function() {
try {
container.html(html);

AccountSettings.bind();
AccountSettings.bind(success, error);

success();
} catch (e) {
Expand All @@ -156,7 +156,7 @@ var AccountSettings = new function() {
}

//Get email address, secret phrase, yubikey etc.
function getAccountInfo() {
function getAccountInfo(success, error) {

$('a[data-toggle="tab"]').unbind().on('show', function(e) {
$(e.target.hash).trigger('show');
Expand Down Expand Up @@ -386,7 +386,12 @@ var AccountSettings = new function() {
};

}, function(data) {
MyWallet.makeNotice('error', 'misc-error', data.responseText);
if (data.responseText)
MyWallet.makeNotice('error', 'misc-error', data.responseText);
else
MyWallet.makeNotice('error', 'misc-error', 'Error Downloading Account Settings');

if (error) error();
});
}

Expand Down
2 changes: 1 addition & 1 deletion account.min.js

Large diffs are not rendered by default.

5 changes: 4 additions & 1 deletion blockchainapi.js
Expand Up @@ -30,7 +30,10 @@ function _BlockchainAPI() {
}
},
error : function(data) {
MyWallet.makeNotice('error', 'misc-error', data.responseText);
if (data.responseText)
MyWallet.makeNotice('error', 'misc-error', data.responseText);
else
MyWallet.makeNotice('error', 'misc-error', 'Error Downloading Wallet Balance');

error();
}
Expand Down
2 changes: 1 addition & 1 deletion blockchainapi.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 7 additions & 4 deletions firefox.js
@@ -1,5 +1,6 @@

$(document).ready(function() {

$.ajax = function(obj) {
var requests = {};
var initd = false;
Expand All @@ -15,7 +16,7 @@ $(document).ready(function() {

obj.request_id = request_id;

document.body.setAttribute('data-ajax', JSON.stringify(obj));
document.body.setAttribute('data-ajax-request', JSON.stringify(obj));

document.body.dispatchEvent(customEvent);
}
Expand All @@ -24,7 +25,7 @@ $(document).ready(function() {
document.body.addEventListener('ajax_response', function() {
console.log('Received Response');

var obj = JSON.parse(document.body.getAttribute('data-ajax'));
var obj = JSON.parse(document.body.getAttribute('data-ajax-response'));

var request = requests[obj.request_id];
if (!request) {
Expand All @@ -41,6 +42,8 @@ $(document).ready(function() {
} else {
request.error({responseText : obj.response, status : obj.status});
}

delete requests[obj.request_id];
});

initd = true;
Expand All @@ -59,5 +62,5 @@ $(document).ready(function() {
if (data_resource)
resource = data_resource;

$.ajax({data : 'TEST'});
})
$('head').append('<style type="text/css">.external { background: url('+resource+'external.png); }\n span.qrcodeicon span { background: url("'+resource+'qrcode.png"); };</style>');
});
6 changes: 6 additions & 0 deletions respond.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 10 additions & 2 deletions shared.js
Expand Up @@ -506,8 +506,16 @@ function loadScript(src, success, error) {
s.type = "text/javascript";
s.async = true;
s.src = src;
s.addEventListener('error', function(e){ error_fired = true; if (error) error('Error Loading Script. Are You Offline?'); }, false);
s.addEventListener('load', function (e) { if (error_fired) return; success(); }, false);
try {
s.addEventListener('error', function(e){ error_fired = true; if (error) error('Error Loading Script. Are You Offline?'); }, false);
s.addEventListener('load', function (e) { if (!error_fired) success(); }, false);
} catch (e) {
//IE 7 & 8 Will throw an exception here
setTimeout(function() {
if (!error_fired) success();
}, 2000);
}

var head = document.getElementsByTagName('head')[0];
head.appendChild(s);
}
Expand Down

0 comments on commit 03be6d7

Please sign in to comment.