Skip to content

Commit

Permalink
Prevent the development viewer, started with gulp server, from brea…
Browse files Browse the repository at this point in the history
…king completely in Private Browsing mode

Since attempting to access `IndexedDB` in Private Browsing mode in Firefox will throw an error, see https://bugzilla.mozilla.org/show_bug.cgi?id=781982, the development viewer fails to load.
  • Loading branch information
Snuffleupagus committed Jul 3, 2018
1 parent 42922c9 commit 8f0cc07
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion external/systemjs/plugin-babel-cached.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ function getDb() {
resolve(db);
};
request.onerror = function () {
console.warn('getDb: ' + request.error);
reject(request.error);
};
});
Expand Down Expand Up @@ -95,7 +96,7 @@ function sha256(str) {
}

exports.translate = function (load, opt) {
var savedHashCode;
var savedHashCode, babelTranslateError;
return sha256(load.source).then(function (hashCode) {
savedHashCode = hashCode;
return loadCache(load.address, hashCode);
Expand All @@ -109,6 +110,13 @@ exports.translate = function (load, opt) {
translated, load.metadata.format).then(function () {
return translated;
});
}, function(reason) {
throw (babelTranslateError = reason);
});
}.bind(this)).catch(function(reason) {
if (babelTranslateError) {
throw babelTranslateError;
}
return babel.translate.call(this, load, opt);
}.bind(this));
};

0 comments on commit 8f0cc07

Please sign in to comment.