-
Notifications
You must be signed in to change notification settings - Fork 10.2k
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
[Firefox addon] Convert the code to be ES6 friendly, in order to better agree with mozilla-central coding conventions (issue 7957) #7982
Conversation
/botio-linux preview |
From: Bot.io (Linux)ReceivedCommand cmd_preview from @Snuffleupagus received. Current queue size: 0 Live output at: http://107.21.233.14:8877/15484d25e96f49b/output.txt |
…er agree with mozilla-central coding conventions (issue 7957) *Please note: ignoring whitespace changes is most likely necessary for the diff to be readable.* This patch addresses all the current, in `mozilla-central`, linting failures in the addon. It should thus be possible to change the `.eslintignore` entry for PDF.js in `mozilla-central` from `browser/extensions/pdfjs/**` to `browser/extensions/pdfjs/build/**` and `browser/extensions/pdfjs/web/**` instead. Note that we cannot, for backwards compatibility reason of the general PDF.js library, at this time make similar changes for files residing in the `build` and `web` directories in `mozilla-central`. The main changes in this patch are that we now use [classes](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes) instead of our previous "class-like" functions, and also use the more compact [object shorthand notation](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Operators/Object_initializer#New_notations_in_ECMAScript_2015). A couple of functions were also converted to [arrow functions](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions), to reduced usages of `bind(this)` and `var self = this`. One caveat with ES6 classes is that it's not (yet) possible to define private constants/helper functions within them, which is why the `NetworkManagerClosure` was kept to not change the visibility of those constant/functions. Besides testing in Firefox Nightly 53, this patch has also been tested in Firefox ESR 45 and SeaMonkey 2.46. However, I'd gladly welcome help with testing the patch more, to ensure that nothing has gone wrong during the refactoring. Fixes the first bullet point of issue 7957.
From: Bot.io (Linux)SuccessFull output at http://107.21.233.14:8877/15484d25e96f49b/output.txt Total script time: 2.22 mins Published |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the patch.
/cc @rvandermeulen |
Thanks for the heads-up, I'll make sure to update .eslintrc on the mozilla-central side on the next update! |
[Firefox addon] Convert the code to be ES6 friendly, in order to better agree with mozilla-central coding conventions (issue 7957)
Please note: ignoring whitespace changes is most likely necessary for the diff to be readable:
https://github.com/mozilla/pdf.js/pull/7982/files?w=1
This patch addresses all the current, in
mozilla-central
, linting failures in the addon. It should thus be possible to change the.eslintignore
entry for PDF.js inmozilla-central
frombrowser/extensions/pdfjs/**
tobrowser/extensions/pdfjs/build/**
andbrowser/extensions/pdfjs/web/**
instead.Note that we cannot, for backwards compatibility reason of the general PDF.js library, at this time make similar changes for files residing in the
build
andweb
directories inmozilla-central
.The main changes in this patch are that we now use classes instead of our previous "class-like" functions, and also use the more compact object shorthand notation.
A couple of functions were also converted to arrow functions, to reduced usages of
bind(this)
andvar self = this
.One caveat with ES6 classes is that it's not (yet) possible to define private constants/helper functions within them, which is why the
NetworkManagerClosure
was kept to not change the visibility of those constant/functions.Besides testing in Firefox Nightly 53, this patch has also been tested in Firefox ESR 45 and SeaMonkey 2.46.
However, I'd gladly welcome help with testing the patch more, to ensure that nothing has gone wrong during the refactoring.
Fixes the first bullet point of #7957 (comment).