Closed Bug 1765167 Opened 10 months ago Closed 9 months ago

Deprecate Cu.import

Categories

(Core :: XPConnect, task)

task

Tracking

()

RESOLVED FIXED
102 Branch
Tracking Status
firefox102 --- fixed

People

(Reporter: arai, Assigned: arai)

References

Details

Attachments

(13 files, 1 obsolete file)

48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review

Similar to bug 1765156

We have 2 ways to import JSM. ChromeUtils.import and Cu.import.

ChromeUtils.import returns exports object, but Cu.import returns global object.
The former supports lexical variables, but the latter doesn't have them, so
the latter requires variables defined on the JSM's global this property.

To achieve bug 1610653, we should replace Cu.import with ChromeUtils.import,
and then deprecate Cu.import, to avoid future confusion.

Depends on: 1765156
See Also: → 1758481

Depends on D144097

Depends on D144106

Depends on: 1765482

Some patch modifies sjs file, and ChromeUtils isn't available with the current hostutils that's from version 93.0.
will address it in bug 1765482

See Also: → 1548308

I'm assuming Cu.import will be removed completely in the future, so we'd like to port our autoconfig scripts. But ChromeUtils isn't available there. How should I proceed here?

(In reply to tobias from comment #16)

I'm assuming Cu.import will be removed completely in the future, so we'd like to port our autoconfig scripts. But ChromeUtils isn't available there. How should I proceed here?

I think CentralizedAdminPrefManagerInit and nsXPConnect::CreateSandbox needs to be modified to pass/receive extra option to define ChromeUtils, in the same way as Cu.Sandbox provides it

See Also: → 1766114
Component: General → XPConnect
Product: Firefox → Core
Attachment #9272968 - Attachment description: WIP: Bug 1765167 - Part 1: Stop using Cu.import in browser/. → Bug 1765167 - Part 1: Stop using Cu.import in browser/. r=Mossop
Attachment #9272969 - Attachment description: WIP: Bug 1765167 - Part 2: Stop using Cu.import in devtools/. → Bug 1765167 - Part 2: Stop using Cu.import in devtools/. r=Mossop
Attachment #9272970 - Attachment description: WIP: Bug 1765167 - Part 3: Stop using Cu.import in docshell/. → Bug 1765167 - Part 3: Stop using Cu.import in docshell/. r=Mossop
Attachment #9272971 - Attachment description: WIP: Bug 1765167 - Part 4: Stop using Cu.import in dom/. → Bug 1765167 - Part 4: Stop using Cu.import in dom/. r=Mossop
Attachment #9272972 - Attachment description: WIP: Bug 1765167 - Part 5: Stop using Cu.import in js/. → Bug 1765167 - Part 5: Stop using Cu.import in js/. r=Mossop
Attachment #9272973 - Attachment description: WIP: Bug 1765167 - Part 6: Stop using Cu.import in layout/. → Bug 1765167 - Part 6: Stop using Cu.import in layout/. r=Mossop
Attachment #9272974 - Attachment description: WIP: Bug 1765167 - Part 7: Stop using Cu.import in mobile/. → Bug 1765167 - Part 7: Stop using Cu.import in mobile/. r=Mossop
Attachment #9272975 - Attachment description: WIP: Bug 1765167 - Part 8: Stop using Cu.import in remote/. → Bug 1765167 - Part 8: Stop using Cu.import in remote/. r=Mossop
Attachment #9272976 - Attachment description: WIP: Bug 1765167 - Part 9: Stop using Cu.import in testing/. → Bug 1765167 - Part 9: Stop using Cu.import in testing/. r=Mossop
Attachment #9272977 - Attachment description: WIP: Bug 1765167 - Part 10: Stop using Cu.import in toolkit/. → Bug 1765167 - Part 10: Stop using Cu.import in toolkit/. r=Mossop
Attachment #9272978 - Attachment description: WIP: Bug 1765167 - Part 11: Stop using Cu.import in services/. → Bug 1765167 - Part 11: Stop using Cu.import in services/. r=Mossop
Blocks: 1548308
See Also: 1548308
Attachment #9272981 - Attachment is obsolete: true

Abandoned Part 14 for adding deprecation warning.
The runtime deprecation warning should be deferred at least until after the next ESR (102), and possibly until the transition finishes for all modules.
For in-tree consumers, ESLint rule should cover well.

Attachment #9272979 - Attachment description: WIP: Bug 1765167 - Part 12: Stop using Cu.import in EventUtils.js. → Bug 1765167 - Part 12: Stop using Cu.import in EventUtils.js. r=mossop
Attachment #9272980 - Attachment description: WIP: Bug 1765167 - Part 13: Fix eslint rule for Cu.import. → Bug 1765167 - Part 13: Fix eslint rule for Cu.import. r=mossop
Attachment #9272968 - Attachment description: Bug 1765167 - Part 1: Stop using Cu.import in browser/. r=Mossop → Bug 1765167 - Part 1: Stop using Cu.import in browser/. r=Mossop!
Attachment #9272969 - Attachment description: Bug 1765167 - Part 2: Stop using Cu.import in devtools/. r=Mossop → Bug 1765167 - Part 2: Stop using Cu.import in devtools/. r=Mossop!
Attachment #9272970 - Attachment description: Bug 1765167 - Part 3: Stop using Cu.import in docshell/. r=Mossop → Bug 1765167 - Part 3: Stop using Cu.import in docshell/. r=Mossop!
Attachment #9272971 - Attachment description: Bug 1765167 - Part 4: Stop using Cu.import in dom/. r=Mossop → Bug 1765167 - Part 4: Stop using Cu.import in dom/. r=Mossop!
Attachment #9272972 - Attachment description: Bug 1765167 - Part 5: Stop using Cu.import in js/. r=Mossop → Bug 1765167 - Part 5: Stop using Cu.import in js/. r=Mossop!
Attachment #9272973 - Attachment description: Bug 1765167 - Part 6: Stop using Cu.import in layout/. r=Mossop → Bug 1765167 - Part 6: Stop using Cu.import in layout/. r=Mossop!
Attachment #9272974 - Attachment description: Bug 1765167 - Part 7: Stop using Cu.import in mobile/. r=Mossop → Bug 1765167 - Part 7: Stop using Cu.import in mobile/. r=Mossop!
Attachment #9272975 - Attachment description: Bug 1765167 - Part 8: Stop using Cu.import in remote/. r=Mossop → Bug 1765167 - Part 8: Stop using Cu.import in remote/. r=Mossop!
Attachment #9272976 - Attachment description: Bug 1765167 - Part 9: Stop using Cu.import in testing/. r=Mossop → Bug 1765167 - Part 9: Stop using Cu.import in testing/. r=Mossop!
Attachment #9272977 - Attachment description: Bug 1765167 - Part 10: Stop using Cu.import in toolkit/. r=Mossop → Bug 1765167 - Part 10: Stop using Cu.import in toolkit/. r=Mossop!
Attachment #9272978 - Attachment description: Bug 1765167 - Part 11: Stop using Cu.import in services/. r=Mossop → Bug 1765167 - Part 11: Stop using Cu.import in services/. r=Mossop!
Attachment #9272979 - Attachment description: Bug 1765167 - Part 12: Stop using Cu.import in EventUtils.js. r=mossop → Bug 1765167 - Part 12: Stop using Cu.import in EventUtils.js. r=mossop!
Attachment #9272980 - Attachment description: Bug 1765167 - Part 13: Fix eslint rule for Cu.import. r=mossop → Bug 1765167 - Part 13: Fix eslint rule for Cu.import. r=mossop!
Pushed by arai_a@mac.com:
https://hg.mozilla.org/integration/autoland/rev/ebebbd0619bc
Part 1: Stop using Cu.import in browser/. r=mossop
https://hg.mozilla.org/integration/autoland/rev/3b192bbb9b92
Part 2: Stop using Cu.import in devtools/. r=mossop
https://hg.mozilla.org/integration/autoland/rev/9c24e578ed2d
Part 3: Stop using Cu.import in docshell/. r=mossop
https://hg.mozilla.org/integration/autoland/rev/57a5aee8b00c
Part 4: Stop using Cu.import in dom/. r=mossop
https://hg.mozilla.org/integration/autoland/rev/0c742b244e3a
Part 5: Stop using Cu.import in js/. r=mossop
https://hg.mozilla.org/integration/autoland/rev/ce0a760da775
Part 6: Stop using Cu.import in layout/. r=mossop
https://hg.mozilla.org/integration/autoland/rev/c981e6933171
Part 7: Stop using Cu.import in mobile/. r=geckoview-reviewers,agi
https://hg.mozilla.org/integration/autoland/rev/280fa8df0a72
Part 8: Stop using Cu.import in remote/. r=webdriver-reviewers,whimboo
https://hg.mozilla.org/integration/autoland/rev/6e8185f1cb48
Part 9: Stop using Cu.import in testing/. r=webdriver-reviewers,perftest-reviewers,whimboo,sparky,mossop
https://hg.mozilla.org/integration/autoland/rev/fcdfb914da44
Part 10: Stop using Cu.import in toolkit/. r=mossop
https://hg.mozilla.org/integration/autoland/rev/d0eb5c083472
Part 11: Stop using Cu.import in services/. r=mossop
https://hg.mozilla.org/integration/autoland/rev/9529d10d5b77
Part 12: Stop using Cu.import in EventUtils.js. r=mossop
https://hg.mozilla.org/integration/autoland/rev/ebcde663bae8
Part 13: Fix eslint rule for Cu.import. r=mossop
Blocks: 1767411
Depends on: 1774566
You need to log in before you can comment on or make changes to this bug.