mozilla / web-ext

A command line tool to help build, run, and test web extensions
Mozilla Public License 2.0
2.68k stars 338 forks source link

web-ext run doesn't clone the extensions folder in specified profile #1384

Open eight04 opened 5 years ago

eight04 commented 5 years ago

Is this a feature request or a bug?

bug.

What is the current behavior?

  1. Create a test profile.
  2. Run Firefox with the profile and install some extensions.
  3. Close Firefox.
  4. Run web-ext run --firefox-profile=test.
  5. The extensions folder in the temporary profile is empty.

What is the expected or desired behavior?

The extensions folder should contain the extension that was installed at step 2.

Version information (for bug reports)

node --version && npm --version && web-ext --version
v10.11.0
6.4.1
2.9.1
Verbose log and config ``` [program.js][info] Version: 2.9.1 [program.js][debug] Getting the version from package.json [program.js][debug] Discovering config files. Set --no-config-discovery to disab le [program.js][info] Applying config files: ~\.web-ext-config.js, .\package.json, .\web-ext-config.js [config.js][debug] Loading JS config file: "C:\Users\Owner\.web-ext-config.js" ( resolved to "C:\Users\Owner\.web-ext-config.js") [config.js][debug] Loading JS config file: "D:\Dev\image-picka\package.json" (re solved to "D:\Dev\image-picka\package.json") [config.js][debug] Looking for webExt key inside package.json file [config.js][debug] Config file D:\Dev\image-picka\package.json did not define an y options. Did you set module.exports = {...}? [config.js][debug] Loading JS config file: "D:\Dev\image-picka\web-ext-config.js " (resolved to "D:\Dev\image-picka\web-ext-config.js") [config.js][debug] Calling coerce() on configured value for sourceDir [cmd/run.js][info] Running web extension from D:\Dev\image-picka\extension [util/manifest.js][debug] Validating manifest at D:\Dev\image-picka\extension\ma nifest.json [extension-runners/firefox-desktop.js][debug] Copying Firefox profile from test [firefox/index.js][debug] Copying profile directory from "test" [firefox/index.js][debug] Running Firefox with profile at C:\Users\Owner\AppData \Local\Temp\cda68a24-9720-4b99-9dc4-d9d889f61887 [firefox/index.js][debug] Checking if remote Firefox port 6005 is available [firefox/remote.js][debug] Connecting to Firefox on port 6005 [firefox/index.js][debug] Executing Firefox binary: C:\Program Files\Firefox Dev eloper Edition\firefox.exe [firefox/index.js][debug] Firefox args: -start-debugger-server 6005 -foreground -no-remote -profile C:\Users\Owner\AppData\Local\Temp\cda68a24-9720-4b99-9dc4-d9 d889f61887 [firefox/index.js][info] Use --verbose or open Tools > Web Developer > Browser C onsole to see logging [firefox/remote.js][debug] Connecting to the remote Firefox debugger [firefox/remote.js][debug] Connecting to Firefox on port 6005 [firefox/remote.js][debug] Retrying Firefox (0); connection error: Error: connec t ECONNREFUSED 127.0.0.1:6005 [firefox/remote.js][debug] Connecting to Firefox on port 6005 [firefox/index.js][debug] Firefox stdout: 1540876166972 addons.webextension.scre enshots@mozilla.org WARN Loading extension 'screenshots@mozilla.org': Rea ding manifest: Invalid host permission: resource://pdf.js/ [firefox/index.js][debug] Firefox stdout: 1540876166972 addons.webextension.scre enshots@mozilla.org WARN Loading extension 'screenshots@mozilla.org': Rea ding manifest: Invalid host permission: about:reader* [firefox/remote.js][debug] Retrying Firefox (1); connection error: Error: connec t ECONNREFUSED 127.0.0.1:6005 [firefox/remote.js][debug] Connecting to Firefox on port 6005 [firefox/index.js][debug] Firefox stdout: Started debugger server on 6005 [firefox/remote.js][debug] Connected to the remote Firefox debugger on port 6005 [firefox/remote.js][debug] Received message from client: {"from":"root","type":" tabListChanged"} [firefox/remote.js][debug] installTemporaryAddon: {"addon":{"id":"image-picka@ei ght04.blogspot.com","actor":false},"from":"server1.conn0.addonsActor5"} [firefox/remote.js][info] Installed D:\Dev\image-picka\extension as a temporary add-on [cmd/run.js][info] The extension will reload if any source file changes [util/file-filter.js][debug] Resolved path **/*.xpi with sourceDir D:\Dev\image- picka\extension to D:\Dev\image-picka\extension\**\*.xpi [util/file-filter.js][debug] Resolved path **/*.zip with sourceDir D:\Dev\image- picka\extension to D:\Dev\image-picka\extension\**\*.zip [util/file-filter.js][debug] Resolved path **/.* with sourceDir D:\Dev\image-pic ka\extension to D:\Dev\image-picka\extension\**\.* [util/file-filter.js][debug] Resolved path **/.*/**/* with sourceDir D:\Dev\imag e-picka\extension to D:\Dev\image-picka\extension\**\.*\**\* [util/file-filter.js][debug] Resolved path **/node_modules with sourceDir D:\Dev \image-picka\extension to D:\Dev\image-picka\extension\**\node_modules [util/file-filter.js][debug] Resolved path **/node_modules/**/* with sourceDir D :\Dev\image-picka\extension to D:\Dev\image-picka\extension\**\node_modules\**\* [watcher.js][debug] Watching for file changes in D:\Dev\image-picka\extension [extension-runners/index.js][info] Press R to reload (and Ctrl-C to quit) [extension-runners/index.js][info] Exiting web-ext on user request [firefox/index.js][debug] Firefox closed ``` ```js module.exports = { run: { firefox: "C:\\Program Files\\Firefox Developer Edition\\firefox.exe", firefoxProfile: "test" } }; ```
rpl commented 5 years ago

@eight04 it sounds like this issue may be a duplicate of #1363, the extensions are not explicitly excluded by the "profile cloning" (the code that copy the profile is actually in the firefox-profile dependency, in particular this part https://github.com/saadtazi/firefox-profile-js/blob/4973491648b2c0994277c64b6abf29ca79219d7e/lib/firefox_profile.js#L163-L191, and it should only exclude the lock files).

do you mind to double-check if there are any suspicious errors in the Browser Console?

There may be some errors logged there that could help us to determine if Firefox is trying to loading the extensions installed in the source profile and it is failing because of the same underlying issue of #1363, or if there is a different kind of issue in this case.

eight04 commented 5 years ago

image

I stepped through firefox_profile.js and found the problem. I have a test folder in my project root (CWD). After copying is finished (https://github.com/saadtazi/firefox-profile-js/blob/4973491648b2c0994277c64b6abf29ca79219d7e/lib/firefox_profile.js#L189), I inspected the temporary profile and found that the content was copied from my test folder.

Extensions are correctly loaded after I renamed the test folder to something else.

eight04 commented 5 years ago

It only checks the profile name when test folder doesn't exist: https://github.com/mozilla/web-ext/blob/7d8b703e3741adc1b134b72ea7b7c40d97ac3678/src/firefox/index.js#L388-L401

I think we should check profile name first then fallback to the folder.

eight04 commented 5 years ago

At least, when profilePath is a relative path, we should check if it is a profile name first.