Closed Bug 1723591 Opened 3 years ago Closed 3 years ago

MessageHandler: Update module naming conventions

Categories

(Remote Protocol :: WebDriver BiDi, task)

task

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 1713442

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;
Summary: MessageHandler: Update module name conventions → MessageHandler: Update module naming conventions
Blocks: 1713438

I'll take care of it when implementing our first module session over on bug 1694144.

Depends on: 1694144
Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → DUPLICATE
Whiteboard: [webdriver:triage]

Will actually update existing test modules in Bug 1713442

You need to log in before you can comment on or make changes to this bug.