web-ext
web-ext copied to clipboard
chromium extension-runner reloadExtensionBySourceDir should be able to identify and reload the single target extension
As a followup to #1392, the chromium extension-runner should be able to map the extension's source dir with the assigned extension id, so that reloadExtensionBySourceDir can identify and reload only the extension installed from the given source dir (currently it reload all of installed extensions by internally calling reloadAllExtensions).
See https://github.com/mozilla/web-ext/pull/1392#discussion_r231535200 for additional details about how we may achieve the sourceDir <-> extensionId mapping for the chromium extension-runner.
I would like to work on this.
I was looking into the code, but not sure how to get the sourceDir <-> extensionId reference.
We load the extension passing sourceDir into --load-extension flag https://github.com/mozilla/web-ext/blob/master/src/extension-runners/chromium.js#L127, but never get the extensionId.
I was thinking to use chrome.management.getAll, but don't retrieve the sourceDir in the extension info. https://developer.chrome.com/extensions/management#type-ExtensionInfo
Do you have any thoughts?
The ID generation is deterministic. First the key from manifest.json is used, and if that doesn't exists, the file path. For the logic, see https://cs.chromium.org/Extension::InitExtensionID%20file:cc
Thanks, I will take a look on that