Closed Bug 1108310 Opened 10 years ago Closed 10 years ago

Remove deprecated for-each-in loop and let blocks and fix strict mode warnings in toolkit/mozapps/downloads

Categories

(Toolkit :: Downloads API, defect)

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla37

People

(Reporter: cpeterson, Assigned: cpeterson)

References

Details

Attachments

(2 files)

1. for-each-in loops and let blocks are a nonstandard JS features of SpiderMonkey and should be removed:

> toolkit/mozapps/downloads/content/downloads.js:414:  let (sb = document.getElementById("downloadStrings")) {
> toolkit/mozapps/downloads/content/downloads.js:976:      let (stateSize = {}) {
> toolkit/mozapps/downloads/content/downloads.js:1113:  let (empty = gDownloadsView.cloneNode(false)) {
> toolkit/mozapps/downloads/content/downloads.js:1175:    let (referrer = gStmt.getString(7)) {

2. Add "use strict" and fix strict mode warnings:

> JavaScript strict warning: resource://gre/modules/DownloadUtils.jsm, line 79: SyntaxError: applying the 'delete' operator to an unqualified name is deprecated
> JavaScript warning: resource://gre/modules/DownloadUtils.jsm, line 273: JavaScript 1.7's let blocks are deprecated
Attachment #8532876 - Flags: review?(paolo.mozmail)
Part 2: Remove deprecated for-each-in loop and let blocks and fix strict mode warnings in webapprt/content/downloads/downloads

> webapprt/content/downloads/downloads.js:357:        let (stateSize = {}) {
> webapprt/content/downloads/downloads.js:724:    let (empty = this.downloadView.cloneNode(false)) {
> webapprt/content/downloads/downloads.js:1112:  let (sb = document.getElementById("downloadStrings")) {
Attachment #8532877 - Flags: review?(paolo.mozmail)
Comment on attachment 8532876 [details] [diff] [review]
fix-downloads-js.patch

Review of attachment 8532876 [details] [diff] [review]:
-----------------------------------------------------------------

::: toolkit/mozapps/downloads/DownloadUtils.jsm
@@ +277,4 @@
>  
>        // If the new time is similar, reuse something close to the last seconds,
>        // but subtract a little to provide forward progress
> +      diff = aSeconds - aLastSec;

Can just remove this line now.
Attachment #8532876 - Flags: review?(paolo.mozmail) → review+
Attachment #8532877 - Flags: review?(paolo.mozmail) → review+
https://hg.mozilla.org/mozilla-central/rev/f12d02a53b0a
https://hg.mozilla.org/mozilla-central/rev/824d26fdcb28
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla37
This patch caused a regression in webapprt downloads, the patch in bug 1116769 fixes it.
(By partially backing out this patch)
Depends on: 1116769
Blocks: 1167029
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: