mozilla / web-ext

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

When `keepProfileChanges` specified, the extension is unable to connect #3133

Open smac89 opened 2 months ago

smac89 commented 2 months ago

Is this a feature request or a bug?

bug

What is the current behavior?

Devtools fails to connect with the error:

Error: connect ECONNREFUSED 127.0.0.1:40911
    at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1595:16)
    at TCPConnectWrap.callbackTrampoline (node:internal/async_hooks:130:17)

Error code: ECONNREFUSED

With verbose logging enabled, I see the following message displayed 250 times:

[/home/nobleman/Dev/scheduler/extension/node_modules/.pnpm/web-ext@7.11.0/node_modules/web-ext/lib/firefox/remote.js][debug] Retrying Firefox (1); connection error: Error: connect ECONNREFUSED 127.0.0.1:35935

What is the expected or desired behavior?

Should be able to connect. This is my config:

module.exports = {
  run: {
    firefox: "deved",
    firefoxProfile: "web-ext",
    profileCreateIfMissing: true,
    keepProfileChanges: true,
    startUrl: ["https://app.joinhomebase.com/schedule_builder"],
  },
};

Removing keepProfileChanges: true,, allows it to work again

Version information (for bug reports)

v20.9.0
10.8.0
7.11.0
Rob--W commented 2 months ago

How did you create the profile directory?

What is the content of user.js and prefs.js within that directory?

smac89 commented 2 months ago

@Rob--W The profile was not created by me. I specified the option profileCreateIfMissing: true, and that's what it did; It created one within the current folder.

The folder created only contains a user.js file with the following:

user_pref("app.update.auto", false);
user_pref("app.update.enabled", false);
user_pref("browser.download.manager.showWhenStarting", false);
user_pref("browser.EULA.override", true);
user_pref("browser.EULA.3.accepted", true);
user_pref("browser.link.open_external", 2);
user_pref("browser.link.open_newwindow", 3);
user_pref("browser.offline", false);
user_pref("browser.safebrowsing.enabled", false);
user_pref("browser.search.update", false);
user_pref("extensions.blocklist.enabled", false);
user_pref("browser.sessionstore.resume_from_crash", false);
user_pref("browser.shell.checkDefaultBrowser", false);
user_pref("browser.tabs.warnOnClose", false);
user_pref("browser.tabs.warnOnOpen", false);
user_pref("browser.startup.page", 0);
user_pref("browser.safebrowsing.malware.enabled", false);
user_pref("startup.homepage_welcome_url", "about:blank");
user_pref("devtools.errorconsole.enabled", true);
user_pref("dom.disable_open_during_load", false);
user_pref("extensions.autoDisableScopes", 10);
user_pref("extensions.logging.enabled", false);
user_pref("extensions.update.enabled", false);
user_pref("extensions.update.notifyUser", false);
user_pref("network.manage-offline-status", false);
user_pref("network.http.max-connections-per-server", 10);
user_pref("network.http.phishy-userpass-length", 255);
user_pref("offline-apps.allow_by_default", true);
user_pref("prompts.tab_modal.enabled", false);
user_pref("security.fileuri.origin_policy", 3);
user_pref("security.fileuri.strict_origin_policy", false);
user_pref("security.warn_entering_secure", false);
user_pref("security.warn_entering_secure.show_once", false);
user_pref("security.warn_entering_weak", false);
user_pref("security.warn_entering_weak.show_once", false);
user_pref("security.warn_leaving_secure", false);
user_pref("security.warn_leaving_secure.show_once", false);
user_pref("security.warn_submit_insecure", false);
user_pref("security.warn_viewing_mixed", false);
user_pref("security.warn_viewing_mixed.show_once", false);
user_pref("signon.rememberSignons", false);
user_pref("toolkit.networkmanager.disable", true);
user_pref("toolkit.telemetry.enabled", false);
user_pref("toolkit.telemetry.prompted", 2);
user_pref("toolkit.telemetry.rejected", true);
user_pref("javascript.options.showInConsole", true);
user_pref("browser.dom.window.dump.enabled", true);
user_pref("webdriver_accept_untrusted_certs", true);
user_pref("webdriver_enable_native_events", true);
user_pref("webdriver_assume_untrusted_issuer", true);
user_pref("dom.max_script_run_time", 30);
user_pref("datareporting.policy.dataSubmissionEnabled", false);
user_pref("devtools.debugger.remote-enabled", true);
user_pref("devtools.debugger.prompt-connection", false);
user_pref("devtools.browserconsole.contentMessages", true);
user_pref("extensions.checkCompatibility.nightly", false);
user_pref("extensions.enabledScopes", 5);
user_pref("extensions.getAddons.cache.enabled", false);
user_pref("extensions.installDistroAddons", false);
user_pref("xpinstall.signatures.required", false);
user_pref("browser.startup.homepage", "about:blank");
user_pref("startup.homepage_welcome_url.additional", "");
user_pref("devtools.chrome.enabled", true);
user_pref("urlclassifier.updateinterval", 172800);
user_pref("browser.safebrowsing.provider.0.gethashURL", "http://localhost/safebrowsing-dummy/gethash");
user_pref("browser.safebrowsing.provider.0.keyURL", "http://localhost/safebrowsing-dummy/newkey");
user_pref("browser.safebrowsing.provider.0.updateURL", "http://localhost/safebrowsing-dummy/update");
user_pref("browser.selfsupport.url", "https://localhost/selfrepair");
user_pref("browser.reader.detectedFirstArticle", true);
user_pref("datareporting.policy.firstRunURL", "");
user_pref("devtools.toolbox.zoomValue", "1.30");
user_pref("browser.zoom.full", true);

Interestingly, today when I attempt to reproduce the bug, I still get the same issue, but with the added caveat that it pops up the "Choose User Profile" dialog. Upon creating a new profile within this dialog, and choosing to open Firefox with it, the problem I described in my previous bug report still persists. After a few minutes of doing nothing, the command exits with the aforementioned error.

I also added the following additional option to the run.pref key:

pref: ["devtools.toolbox.zoomValue=1.30", "browser.zoom.full=true"],