web-ext icon indicating copy to clipboard operation
web-ext copied to clipboard

chromium extension-runner reloadExtensionBySourceDir should be able to identify and reload the single target extension

Open rpl opened this issue 6 years ago • 3 comments

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.

rpl avatar Aug 27 '19 13:08 rpl

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?

ccarruitero avatar Feb 05 '20 18:02 ccarruitero

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

Rob--W avatar Feb 05 '20 18:02 Rob--W

Thanks, I will take a look on that

ccarruitero avatar Feb 06 '20 16:02 ccarruitero