Closed Bug 1321218 Opened 3 years ago Closed 3 years ago

Remove legacy generator from dom/.

Categories

(Core :: DOM: Core & HTML, defect)

defect
Not set

Tracking

()

RESOLVED FIXED
mozilla53
Tracking Status
firefox53 --- fixed

People

(Reporter: arai, Assigned: arai)

References

Details

Attachments

(1 file)

If the code fits into async function and also it's test code, replaced legacy generator with async function.
for other cases, just replaced legacy generator with ES6 generator.

some notes:
* dom/archivereader/test/helpers.js
  all testSteps can be normal function, not generator
  so just removed |testGenerator|

* dom/archivereader/test/test_basic.html
* dom/archivereader/test/test_nonUnicode.html
* dom/archivereader/test/test_zip_in_zip.html
  removed unnecessary |yield| to make it normal function

* dom/base/test/browser_use_counters.js
  Task.async can be rewritten with async simply, by replacing yield to await

* dom/base/test/referrer_helper.js
  ES6 generator doesn't throw StopIteration, so we can just remove final yield

* dom/base/test/test_bug544642.html
  ES6 generator doesn't have |send|, but |next| receives a value

* dom/base/test/test_bug682592.html
  ES6 generator returns object with done property is true when it returns
  so changed try-catch check to done property check

* dom/browser-element/mochitest/browserElement_ActiveStateChange.js
  this case |runTests| fits into async, since setCommand can return promise
  that is resolved when it's done

  not related to this bug tho, just changed removeEventListener to {once: true} parameter of addEventListener

* dom/html/test/test_anchor_ping.html
  all tests are generator, so we can just do |yield*|

* dom/tests/mochitest/general/test_domWindowUtils.html
  waiting for single shot eventlistener can be done by a Promise that resolves when the event is fired.
  so removed |next| function and just await for the promise.

  SimpleTest.executeSoon done at the 1st test looks like intended to wait between 2 tests, so moved it to runner.
Attachment #8815633 - Flags: review?(bugs)
Comment on attachment 8815633 [details] [diff] [review]
Remove legacy generator from dom/.

rs+
Make sure we run as many test assertions with and without this patch.
Attachment #8815633 - Flags: review?(bugs) → review+
https://hg.mozilla.org/mozilla-central/rev/4a8703321e8a
Status: ASSIGNED → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla53
Duplicate of this bug: 1226398
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.