Skip to content

'Use strict' in pdfjs context only, compatibility.js #7307

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

Closed
McGiogen opened this issue May 10, 2016 · 3 comments
Closed

'Use strict' in pdfjs context only, compatibility.js #7307

McGiogen opened this issue May 10, 2016 · 3 comments

Comments

@McGiogen
Copy link
Contributor

McGiogen commented May 10, 2016

Hi,
We have a problem using compatibility.js caused by the absence of a local context to the file and by the use of 'use strict' directive.
The problem is really simple: the file starts with 'use strict' without creating a local context. In our application we minify all the external dependencies in a single file and because of compatibility.js every file minified after it is in its 'use strict' context.
This is not the correct behaviour (and, in our case, fires blocking exceptions) and has been already solved in the other js files of this repository (pdf.js, pdf.worker.js, pdf.combined.js, pdf_viewer.js) which starts with the following lines:

(function pdfjsWrapper() {
  // Use strict in our context only - users might not want it
  'use strict';

compatibility.js instead starts simply with:

'use strict';

So also compatibility.js should have a local context. I can do a pr if it helps.
Thanks,
McGio

@Snuffleupagus
Copy link
Collaborator

Please _do not_ post "+1" comments (and similar), since it generates a lot of unnecessary notifications for people. Instead, please use the GitHub reaction feature, see https://help.github.com/articles/about-discussions-in-issues-and-pull-requests/#reacting-to-ideas-in-issues-and-pull-requests and https://github.com/blog/2119-add-reactions-to-pull-requests-issues-and-comments.

@yurydelendik
Copy link
Contributor

So also compatibility.js should have a local context. I can do a pr if it helps.

@McGiogen yes please. There is no need in space/tab indenting of entire compatibility.js. You may need to modify jshint settings. See https://github.com/mozilla/pdf.js/wiki/Contributing prior submitting a PR.

@yurydelendik
Copy link
Contributor

Closed by #7315

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants