-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Conversation
@Hainish Do we target a specific version of JavaScript? |
@jeremyn We target browsers, not JS versions. |
@jeremyn Here are the targeted versions. My changes only affect the WebExtensions one. Please note that legacy Firefox version will be removed soon. WebExtensions: Legacy Firefox: |
You yourself framed this PR as an ES6 rewrite. Firefox and Chrome both understand I'm not saying your changes are bad by the way, I just want to make sure we're consistent across the codebase, including the stuff in |
@jeremyn https://wesbos.com/let-vs-const/ |
I think ES6 features are neat, I'm not disagreeing with you there. But it's possible that @Hainish and/or the EFF target ES5 in which case we shouldn't update stuff to ES6 even if we think it's better. |
@jeremyn The code already had |
See also #10813. |
@yfdyh000 We already had |
See also #10864. |
Thanks, @koops76. I agree, since we already have |
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.
Otherwise LGTM
chromium/background.js
Outdated
port.onDisconnect.addListener(port => { | ||
log(DBUG, "Devtools window for tab " + tabId + " closed, clearing data."); | ||
disableSwitchPlannerFor(tabId); | ||
}); |
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.
Fix indentation here
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.
@Hainish Done.
@@ -1,7 +1,7 @@ | |||
var storage = chrome.storage.local; | |||
const storage = chrome.storage.local; | |||
if (chrome.storage.sync) { | |||
storage = chrome.storage.sync; |
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.
TypeError: invalid assignment to const 'storage'
I also see other errors during testing. Please test and submit fixes.
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.
@yfdyh000 Can you send me all errors?
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.
@koops76 Do you ever build and tested it?
https://www.dropbox.com/s/0g4i050j2ivdwv3/https-everywhere-2017.7.5~pre.crx?dl=0
Errors in Chrome 59:
storage.js:3 Uncaught TypeError: Assignment to constant variable.
at storage.js:3
util.js:1 Uncaught SyntaxError: Identifier 'VERB' has already been declared
at util.js:1
rules.js:220 Uncaught TypeError: Cannot use 'in' operator to search for 'www.miit.gov.cn' in undefined
at RuleSets.addUserRule (rules.js:220)
at loadStoredUserRules (background.js:93)
at background.js:98
background.js:11 [Deprecation] Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience. For more help, check https://xhr.spec.whatwg.org/.
loadExtensionFile @ background.js:11
_generated_background_page.html:1 Error in response to tabs.query: ReferenceError: activeRulesets is not defined
at Object.chrome.tabs.query.tabs [as callback] (chrome-extension://pdnbogcodofhjeppkgbjpdmjbjcpbdfd/background.js:112:36)
at updateState (chrome-extension://pdnbogcodofhjeppkgbjpdmjbjcpbdfd/background.js:108:15)
at Object.storage.get.item [as callback] (chrome-extension://pdnbogcodofhjeppkgbjpdmjbjcpbdfd/background.js:52:3)
_generated_background_page.html:1 Error in response to tabs.query: ReferenceError: activeRulesets is not defined
at Object.chrome.tabs.query.tabs [as callback] (chrome-extension://pdnbogcodofhjeppkgbjpdmjbjcpbdfd/background.js:112:36)
at updateState (chrome-extension://pdnbogcodofhjeppkgbjpdmjbjcpbdfd/background.js:108:15)
at updateEnabledDisabledUI (chrome-extension://pdnbogcodofhjeppkgbjpdmjbjcpbdfd/popup.js:109:18)
at HTMLDocument.<anonymous> (chrome-extension://pdnbogcodofhjeppkgbjpdmjbjcpbdfd/popup.js:159:3)
2_generated_background_page.html:1 Error in response to tabs.query: ReferenceError: activeRulesets is not defined
at Object.chrome.tabs.query.tabs [as callback] (chrome-extension://pdnbogcodofhjeppkgbjpdmjbjcpbdfd/background.js:112:36)
at updateState (chrome-extension://pdnbogcodofhjeppkgbjpdmjbjcpbdfd/background.js:108:15)
at chrome.windows.onFocusChanged.addListener (chrome-extension://pdnbogcodofhjeppkgbjpdmjbjcpbdfd/background.js:68:3)
an piece errors in Firefox (Nightly) 56a1:
TypeError: invalid assignment to const `storage' storage.js:3:3
SyntaxError: redeclaration of const VERB util.js:1:1
invalid 'in' operand this.active_tab_rules background.js:197
invalid 'in' operand this.active_tab_rules background.js:197
It is easy to see from https://github.com/koops76/https-everywhere/blob/931d729eb68723de824fb8f400f4f7798f4db8e8/chromium/storage.js , particularly const storage = chrome.storage.local;
if (chrome.storage.sync) {
storage = chrome.storage.sync;
} that there is a problem, declaring Also, am I reading it correctly that 931d729 was merged with failing Travis build https://travis-ci.org/EFForg/https-everywhere/builds/250627648 ? Maybe we might want to
|
@jeremyn I don't think we should simply roll the changes back, we should certainly do 2 and 3. I will make two follow-up PRs, one fixing the errors, the other adding ESLint. |
@jeremyn https://travis-ci.org/EFForg/https-everywhere/builds/250627648 was not my fault. Look carefully at the errors. |
I take responsibility here. All tests were passing last night when I merged. These were merged in after the |
@koops76 are you working on a partial reversion? If not I can start working on this. |
@koops76 The argument for rolling back is that it's hard to understand the implications of some of these changes. For example in Moving ES6 changes into linting and requiring it to be done slowly over time makes it so that the ES6 changes will be done by someone who is, presumably, already looking at some specific piece of code and has an active, current understanding of what it does. (None of this is to blame you by the way, I just think it's safer to spread changes like this out, especially given the various problems that @yfdyh000 has found so far.) |
@jeremyn OK, I will revert the changes that may have unexpected results, like |
@jeremyn These changes should still be rigorously tested, but let's not just roll all of them back simply because they may introduce yet unknown bugs. We can always fix them, and I hope any code is rigorously tested before being introduced into the release. |
@koops76 I suspect this will cause a lot of work to merge into the webextensions branch, and I'd prefer the ES6 changes be rebased from that. Reverting this PR at the moment will fix the problem at hand and give us time to do a more thorough job on ES6 for webextensions, which has changed the chromium/ codebase significantly. |
@Hainish Maybe you'll create a branch for these changes? Or should they stay in my repo? |
So, I think the consensus is that this PR should be reverted from master at least until #10845 is done. Is that correct? |
@koops76 was there a reason you didn't revert the |
@koops76 I see, thanks. I'll revert all changes except that one. |
Reversion: 9a770ca |
* ES6 rewrite * for...of support came only in Chromium 51 https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for...of#Chrome_note_3 * Update background.js
No description provided.