Closed Bug 1780543 Opened 2 years ago Closed 2 years ago

Audit eslint-env mozilla/frame-script consumer

Categories

(Developer Infrastructure :: Lint and Formatting, task)

Tracking

(firefox105 fixed)

RESOLVED FIXED
105 Branch
Tracking Status
firefox105 --- fixed

People

(Reporter: arai, Assigned: arai)

References

(Blocks 1 open bug)

Details

Attachments

(11 files)

(deleted), text/x-phabricator-request
Details
(deleted), text/x-phabricator-request
Details
(deleted), text/x-phabricator-request
Details
(deleted), text/x-phabricator-request
Details
(deleted), text/x-phabricator-request
Details
(deleted), text/x-phabricator-request
Details
(deleted), text/x-phabricator-request
Details
(deleted), text/x-phabricator-request
Details
(deleted), text/x-phabricator-request
Details
(deleted), text/x-phabricator-request
Details
(deleted), text/x-phabricator-request
Details

Frame scripts are supposed to have /* eslint-env mozilla/frame-script */ line, but there are 2 problematic cases:

  • the file is a frame script, but it doesn't have /* eslint-env mozilla/frame-script */ line
  • the file is not a frame script, but it has /* eslint-env mozilla/frame-script */ line

One case of the latter is remote page scripts, that has subset of frame-script environment this is unrelated environment.
We should add dedicate environment for it and use it instead.

https://searchfox.org/mozilla-central/rev/a352cc827575823676717d53766c39710b54201a/toolkit/components/remotepagemanager/RemotePageManagerChild.jsm#23-33

Cu.exportFunction(this.sendAsyncMessage.bind(this), window, {
  defineAs: "RPMSendAsyncMessage",
});
Cu.exportFunction(this.addMessageListener.bind(this), window, {
  defineAs: "RPMAddMessageListener",
  allowCallbacks: true,
});
Cu.exportFunction(this.removeMessageListener.bind(this), window, {
  defineAs: "RPMRemoveMessageListener",
  allowCallbacks: true,
});

looks like I misunderstood about RPM* propreties defined in frame-script.js.

mozilla/frame-script definition seems to have mix of frame script and remote pages,
and RPM* properties must be moved to remote page environment.

Depends on D152428

Thank you for working on this, it is really nice to have these split up into more meaningful names and scopes.

In addition to my document comments, please could you update this section of the docs? Probably pointing it to the environment page would be helpful.

Depends on D152432

Also define Components and Services, that's enabled by default on sandbox.

Depends on D152646

Also update the list of variables.

Depends on D152647

Depends on D152648

Pushed by arai_a@mac.com:
https://hg.mozilla.org/integration/autoland/rev/b3feda5b27e1
Part 1: Use eslint-env mozilla/frame-script consistently in frame script. r=Standard8,webdriver-reviewers,geckoview-reviewers,jdescottes,calu
https://hg.mozilla.org/integration/autoland/rev/ae908c7f89f2
Part 2: Use eslint-env mozilla/frame-script consistently in test frame script. r=Standard8,webdriver-reviewers,perftest-reviewers,sparky,jdescottes
https://hg.mozilla.org/integration/autoland/rev/e0ba4db5a86b
Part 3: Add mozilla/process-script environment as alias to frame-script. r=Standard8,perftest-reviewers,webcompat-reviewers,necko-reviewers,twisniewski,sparky,dragana
https://hg.mozilla.org/integration/autoland/rev/3b36e3518d0f
Part 4: Add mozilla/remote-page environment. r=Standard8
https://hg.mozilla.org/integration/autoland/rev/fe18343ba5e6
Part 5: Add mozilla/chrome-script environment. r=Standard8
https://hg.mozilla.org/integration/autoland/rev/d17b9468e8e1
Part 6: Stop using mozilla/frame-script in unrelated files. r=Standard8,necko-reviewers,dragana
https://hg.mozilla.org/integration/autoland/rev/6c9f57ac30c3
Part 7: Update frame-script and process-script environment. r=Standard8
https://hg.mozilla.org/integration/autoland/rev/2751a3bb2d57
Part 8: Remove unused eslint rule. r=Standard8,geckoview-reviewers,calu
https://hg.mozilla.org/integration/autoland/rev/54b6884df84e
Part 9: Move SpecialPowers sandbox global definition into separate file. r=Standard8
https://hg.mozilla.org/integration/autoland/rev/dda806f50320
Part 10: Use SpecialPowers sandbox definition in import-content-task-globals.js. r=Standard8
https://hg.mozilla.org/integration/autoland/rev/b1c809ded882
Part 11: Update document for environment. r=Standard8
Regressions: 1781186
No longer regressions: 1781186
Product: Firefox Build System → Developer Infrastructure
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: