Closed Bug 1955612 Opened 5 months ago Closed 4 months ago

Explain more about the namespace object of the system modules?

Categories

(Developer Infrastructure :: Source Documentation, enhancement)

enhancement

Tracking

(firefox139 fixed)

RESOLVED FIXED
139 Branch
Tracking Status
firefox139 --- fixed

People

(Reporter: arai, Assigned: arai)

References

(Blocks 1 open bug)

Details

Attachments

(3 files)

https://searchfox.org/mozilla-central/source/docs/jsloader/system-modules.rst

The examples is specific for using single named export.

There seems to be multiple in-tree consumers of namespace objects, and it would be nice to explain more about the namespace object, and how it's actually working in the destructuring assignment and the lazy getters.

possible things to cover:

// Standard namespace import.
import * as ns from "URL";

// Standard namespace import with dynamic import.
const ns = await import("URL");

// System module variant of namespace import.
const ns = ChromeUtils.importESModule("URL");

// Possible workaround for lazy getter.
ChromeUtils.defineLazyGetter(lazy, "ns", () => ChromeUtils.importESModule("URL"));
Blocks: 1776174
Assignee: nobody → arai.unmht
Status: NEW → ASSIGNED
Attachment #9473986 - Attachment description: Bug 1955612 - Part 1: Use different names between the module filename and exported symbols. r?Standard8! → Bug 1955612 - Part 1: In system modules documentation, use different names between the module filename and exported symbols. r?Standard8!
Pushed by arai_a@mac.com: https://hg.mozilla.org/integration/autoland/rev/7253f24ed3c8 Part 1: In system modules documentation, use different names between the module filename and exported symbols. r=Standard8 https://hg.mozilla.org/integration/autoland/rev/85708ecb1bb0 Part 2: Add a section for the namespace object usage in the system modules. r=Standard8,julienw https://hg.mozilla.org/integration/autoland/rev/fd1beda69932 Part 3: Add a section for the global variable lifetime. r=Standard8
Status: ASSIGNED → RESOLVED
Closed: 4 months ago
Resolution: --- → FIXED
Target Milestone: --- → 139 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: