Closed Bug 1786885 Opened 2 years ago Closed 1 year ago

Remove OS.Constants.{libc,win,sys}.*

Categories

(Toolkit :: IOUtils and PathUtils, task, P2)

task

Tracking

()

RESOLVED FIXED
117 Branch
Tracking Status
firefox117 --- fixed

People

(Reporter: beth, Assigned: beth)

References

Details

Attachments

(2 files, 1 obsolete file)

We are eventually removing osfile.jsm, which means you won't be able to get OS.Constants imported by importing a JSM.

The current way to define OS.Constants in a namespace is by doing:

  Cc["@mozilla.org/net/osfileconstantsservice;1"]
    .getService(Ci.nsIOSFileConstantsService)
    .init();

This grabs the current JS global and defines an OS object onto it. This seems magical and may lead to confusion. It might be better if we have something like:

  const {OS} = Cc["@mozilla.org/net/osfileconstantsservice;1"]
    .getService(Ci.nsIOSFileConstantsService)
    .init();

// or

const {OS} = Services.osConstants.init();

or maybe better still, have it available on Services directly

Services.osConstants.libc.O_CREAT

This is also likely busted on ESMs since it is grabbing the this member which doesn't exist in ESMs.

Summary: Return an object from the nsIOSFileConstantsService → Remove usage of OS.File.Constants.{libc,win}.*
Blocks: 1737308
Summary: Remove usage of OS.File.Constants.{libc,win}.* → Remove usage of OS.File.Constants.{libc,win,sys}.*
Summary: Remove usage of OS.File.Constants.{libc,win,sys}.* → Remove usage of OS.Constants.{libc,win,sys}.*
Assignee: nobody → brennie
Status: NEW → ASSIGNED
Attachment #9330521 - Attachment is obsolete: true
No longer blocks: 1737308
Component: OS.File → IOUtils and PathUtils
Summary: Remove usage of OS.Constants.{libc,win,sys}.* → Remove OS.Constants.{libc,win,sys}.*
Depends on: 1832917
Depends on: 1832918
Depends on: 1832921
Depends on: 1832923
Depends on: 1832924
Assignee: brennie → nobody
Status: ASSIGNED → NEW

Depends on D179383

Assignee: nobody → brennie
Status: NEW → ASSIGNED

ChromeUtils::GetPlatformConstants() is a replacement for
nsIOSFileConstantsService providing OS.Consts.LIBC and OS.Consts.Win.

Attachment #9338120 - Attachment description: Bug 1786885 - Add ChromeUtils::GetPlatformConstants r?nika → Bug 1786885 - Add ChromeUtils::GetUnixPlatformConstants r?nika
Attachment #9338120 - Attachment description: Bug 1786885 - Add ChromeUtils::GetUnixPlatformConstants r?nika → Bug 1786885 - Add ChromeUtils::GetLibcConstants r?nika

I believe all the OS.* modules have been removed now, so I don't think this blocks esm-ification.

No longer blocks: esm-ification
Pushed by brennie@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/714fb5e0c999 Add ChromeUtils::GetLibcConstants r=nika

Backed out for causing bustages in ChromeUtils.webidl.

Flags: needinfo?(brennie)
Pushed by brennie@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/910d59989abb Add ChromeUtils::GetLibcConstants r=nika
Flags: needinfo?(brennie)
Keywords: leave-open
Flags: needinfo?(brennie)
Pushed by brennie@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/4d135b3bcfd8 Add ChromeUtils::GetLibcConstants r=nika
Keywords: leave-open
Status: ASSIGNED → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → 117 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: