Closed Bug 1744809 Opened 2 years ago Closed 2 years ago

Remove boilerplate in IOUtils frontend methods

Categories

(Toolkit Graveyard :: OS.File, enhancement, P1)

enhancement

Tracking

(firefox97 fixed)

RESOLVED FIXED
97 Branch
Tracking Status
firefox97 --- fixed

People

(Reporter: barret, Assigned: barret)

Details

Attachments

(1 file)

IOUtils frontend methods all look like:

IOUtils::Method(GlobalObject& aGlobal, ...) {
  MOZ_DIAGNOSTIC_ASSERT(XRE_IsParentProcess());
  RefPtr<Promise> promise = CreateJSPromise(aGlobal);
  if (!promise) {
    return nullptr;
  }

  if (auto state = GetState()) {
    // Do actual unique work
  } else {
    RejectShuttingDown(promise);
  }
  return promise.forget();
}

which is a lot of boilerplate per method. We should remove this boilerplate if we can to make maintenance easier.

Pushed by brennie@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/dbbcea46c9d9
Reduce boilerplate in IOUtils frontend methods r=nika

Backed out 2 changesets (Bug 1744809, Bug 1744316) for causing xpcshell failures on marAppApplyDirLockedStageFailure_win.js.
Backout link
Push with failures
Failure Log

Flags: needinfo?(brennie)
Flags: needinfo?(brennie)

The failure was in the other patch. Going to land them separately.

Pushed by brennie@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/5fd7e5380524
Reduce boilerplate in IOUtils frontend methods r=nika
Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 97 Branch
Product: Toolkit → Toolkit Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: