Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent the development viewer, started with gulp server, from breaking completely in Private Browsing mode #9866

Merged

Conversation

Snuffleupagus
Copy link
Collaborator

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.

@Snuffleupagus Snuffleupagus changed the title Prevent the development viewer, started with gulp server, from breaing completely in Private Browsing mode Prevent the development viewer, started with gulp server, from breaking completely in Private Browsing mode Jul 2, 2018
@@ -110,5 +111,7 @@ exports.translate = function (load, opt) {
return translated;
});
});
Copy link
Contributor

@timvandermeij timvandermeij Jul 2, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it perhaps be more readable to add a catch handler at the end of the promise chain here so you don't have to repeat the binding and call below? It looks like the call itself succeeded, but the storeCache call didn't, so having the catch handler here might prevent a duplicate call to babel.translate.call if I'm reading the code correctly (but do correct me if I'm wrong here).

Copy link
Collaborator Author

@Snuffleupagus Snuffleupagus Jul 3, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I purposely added the catch at the very end, since this way it'll catch errors occurring at any point in the entire Promise chain. (Note also that the Private Browsing related error is thrown already in loadCache, so your suggestion wouldn't have have worked here).

The point of this patch was thus to not only fix the problem at hand, but to ensure that the code will always attempt to fallback no matter what (future) errors are encountered.
To avoid trying to re-parse the code when specifically babel.translate fails, which I gather you wanted to avoid, the patch now tracks that particular case separately.

…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.
@timvandermeij timvandermeij merged commit b39a2ba into mozilla:master Jul 4, 2018
@timvandermeij
Copy link
Contributor

Looks good now. Thank you!

@Snuffleupagus Snuffleupagus deleted the gulp-server-private-browsing branch July 5, 2018 06:41
movsb pushed a commit to movsb/pdf.js that referenced this pull request Jul 14, 2018
…e-browsing

Prevent the development viewer, started with `gulp server`, from breaking completely in Private Browsing mode
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants