Skip to content

Commit

Permalink
Merge pull request mozilla#9866 from Snuffleupagus/gulp-server-privat…
Browse files Browse the repository at this point in the history
…e-browsing

Prevent the development viewer, started with `gulp server`, from breaking completely in Private Browsing mode
  • Loading branch information
timvandermeij authored Jul 4, 2018
2 parents 42922c9 + 8f0cc07 commit b39a2ba
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 b39a2ba

Please sign in to comment.