Closed Bug 1133185 Opened 9 years ago Closed 9 years ago

Remove nonstandard let blocks from toolkit/webapps

Categories

(Firefox Graveyard :: Web Apps, defect)

x86
macOS
defect
Not set
normal

Tracking

(firefox39 fixed)

RESOLVED FIXED
Firefox 39
Tracking Status
firefox39 --- fixed

People

(Reporter: cpeterson, Assigned: cpeterson)

References

Details

Attachments

(1 file)

let blocks are a nonstandard SpiderMonkey feature we would like to remove (in bug 1023609).
Attachment #8564495 - Flags: review?(myk)
Comment on attachment 8564495 [details] [diff] [review]
remove-let-blocks.patch

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

This is ok, but we used some of these blocks to limit the scope of same-named variables, and I would prefer to avoid mixing declaration/assignments with non-declaration/assignments of such variables, so I would replace the blocks that enclose them with non-let blocks, f.e.:

  {
    let deferred = Promise.defer();
    request.onerror = function() {
      deferred.reject(this.error.name);
    };
    request.onsuccess = deferred.resolve;
    yield deferred.promise;
  }

  let appObject = request.result;
  ok(appObject, "app is non-null");

  {
    let deferred = Promise.defer();
    appObject.ondownloaderror = function() {
      deferred.reject(appObject.downloadError.name);
    };
    appObject.ondownloadapplied = deferred.resolve;
    yield deferred.promise;
  }

(Alternately, you could give them unique names or declare them separately.)
Attachment #8564495 - Flags: review?(myk) → review+
Do you prefer the non-let blocks or unique names (like `deferred2`)? The non-let blocks would preserve the existing code indentation and variable names. The unique names are less ambiguous, but a little ugly.
Flags: needinfo?(myk)
(In reply to Chris Peterson [:cpeterson] from comment #2)
> Do you prefer the non-let blocks or unique names (like `deferred2`)? The
> non-let blocks would preserve the existing code indentation and variable
> names. The unique names are less ambiguous, but a little ugly.

I'm ok with either, but I would prefer the non-let blocks.
Flags: needinfo?(myk)
Thanks. I landed with the non-let blocks you suggested:

https://hg.mozilla.org/integration/mozilla-inbound/rev/a179c7531bca
https://hg.mozilla.org/mozilla-central/rev/a179c7531bca
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 39
Blocks: 1167029
Product: Firefox → Firefox Graveyard
You need to log in before you can comment on or make changes to this bug.