MessageHandler: Update module naming conventions
Categories
(Remote Protocol :: WebDriver BiDi, task)
Tracking
(Not tracked)
People
(Reporter: jdescottes, Unassigned)
References
(Blocks 1 open bug)
Details
In Bug 1713439, Modules are supposed to follow a strict naming conventions:
- the file name for the module should be {moduleName}.jsm
- the Module class should be exported as {moduleName} by the module
This is enforced by the following code https://searchfox.org/mozilla-central/rev/7b1de5e29d878cc163dec7beaf9b57a2f0f41aaa/remote/shared/messagehandler/ModuleCache.jsm#111,115
So typically, for a module called "MyModule", we would have:
- a file
${modulesRoot}/root/MyModule.jsm
- a file content such as:
const EXPORTED_SYMBOLS = ["MyModule"];
class MyModule {
constructor(messageHandler) {
this.messageHandler = messageHandler;
}
// ...
}
However, since in WebDriverBiDi, modules are usually lowercased (eg "session", "log"), following this convention strictly means we would have modules looking like:
class session {
// ...
}
Lowercase names for classes are not ideal, so the idea is to decouple the class name from the module name.
The file would still be named after the Module's name: {modulesRoot}/root/session.jsm
But the content would either use a hardcoded name, eg:
const EXPORTED_SYMBOLS = ["Module"];
class Session {
constructor(messageHandler) {
this.messageHandler = messageHandler;
}
// ...
}
const Module = Session;
or we could reuse the actual module name for the export:
const EXPORTED_SYMBOLS = ["session"];
class Session {
constructor(messageHandler) {
this.messageHandler = messageHandler;
}
// ...
}
const session = Session;
Reporter | ||
Updated•3 years ago
|
Comment 1•3 years ago
|
||
I'll take care of it when implementing our first module session
over on bug 1694144.
Reporter | ||
Updated•3 years ago
|
Updated•3 years ago
|
Reporter | ||
Comment 3•3 years ago
|
||
Will actually update existing test modules in Bug 1713442
Description
•