release: produce a versioned per-browser artifact and pin the Chrome extension id (closes #310)
manifest/chrome.json now carries a fixed public key, so the extension id and the chrome.storage.local partition holding the wallet stay stable across checkout moves and re-clones instead of being derived from the absolute path. A release entrypoint produces a self-contained versioned artifact per browser, including the files that sit at dist/ root outside both browser directories. One version source of truth, enforced: the build fails naming the culprit when the two manifests and package.json disagree, and BUILD_COMMIT now marks a dirty tree as dirty. Firefox ships an unsigned XPI; the README states that release Firefox and ESR refuse it, that Developer Edition or Unbranded is required, and that Remove is irreversible except from the recovery phrase, which is asserted by test.
This commit was merged in pull request #347.
This commit is contained in:
@@ -103,7 +103,13 @@ class Driver {
|
||||
|
||||
// ------------------------------------------------------------ setup
|
||||
|
||||
async newSession() {
|
||||
// `profileDir` reuses an existing profile directory in place instead of
|
||||
// letting geckodriver make a throwaway one. That is the only way to ask
|
||||
// what survives a browser RESTART, which for a Firefox add-on that can
|
||||
// only be installed temporarily is the question that decides whether the
|
||||
// extension is usable at all: a temporary add-on is unloaded when Firefox
|
||||
// exits, so every session begins by adding it again.
|
||||
async newSession(profileDir) {
|
||||
const prefs = {
|
||||
// See EXTENSION_UUID above. The pref is a string pref whose
|
||||
// value is itself JSON.
|
||||
@@ -132,26 +138,27 @@ class Driver {
|
||||
"extensions.openPopupWithoutUserGesture.enabled": false,
|
||||
};
|
||||
|
||||
const args = [
|
||||
"-headless",
|
||||
// Mandatory on Firefox 153: without it, navigating to
|
||||
// moz-extension:// and running chrome-context script both
|
||||
// fail with "unsupported operation".
|
||||
//
|
||||
// It grants the driver FULL CHROME PRIVILEGES over this
|
||||
// browser. Acceptable only because the browser is a
|
||||
// throwaway in a CI container; never point a session with
|
||||
// this flag at anything you care about.
|
||||
"-remote-allow-system-access",
|
||||
];
|
||||
if (profileDir) args.push("-profile", profileDir);
|
||||
|
||||
const value = await this.send("POST", "/session", {
|
||||
capabilities: {
|
||||
alwaysMatch: {
|
||||
browserName: "firefox",
|
||||
"moz:firefoxOptions": {
|
||||
binary: FIREFOX_BIN,
|
||||
args: [
|
||||
"-headless",
|
||||
// Mandatory on Firefox 153: without it,
|
||||
// navigating to moz-extension:// and running
|
||||
// chrome-context script both fail with
|
||||
// "unsupported operation".
|
||||
//
|
||||
// It grants the driver FULL CHROME PRIVILEGES
|
||||
// over this browser. Acceptable only because
|
||||
// the browser is a throwaway in a CI
|
||||
// container; never point a session with this
|
||||
// flag at anything you care about.
|
||||
"-remote-allow-system-access",
|
||||
],
|
||||
args,
|
||||
prefs,
|
||||
},
|
||||
},
|
||||
@@ -162,16 +169,30 @@ class Driver {
|
||||
return value;
|
||||
}
|
||||
|
||||
// Installs the unpacked MV2 build straight from a directory.
|
||||
// temporary:true bypasses signature checks, so no XPI and no signing
|
||||
// are involved, and the add-on dies with the profile.
|
||||
async installAddon(dir) {
|
||||
// Installs the MV2 build, either from an unpacked directory or from an
|
||||
// XPI file. temporary:true bypasses signature checks — which is the only
|
||||
// way an UNSIGNED xpi installs at all, and the reason README.md says
|
||||
// release Firefox will refuse the artifact this repo produces — and the
|
||||
// add-on dies with the profile.
|
||||
//
|
||||
// Returns the add-on id Firefox assigned, which is
|
||||
// browser_specific_settings.gecko.id from the manifest and is what
|
||||
// uninstallAddon() takes.
|
||||
async installAddon(pathToAddon) {
|
||||
return this.session("POST", "/moz/addon/install", {
|
||||
path: dir,
|
||||
path: pathToAddon,
|
||||
temporary: true,
|
||||
});
|
||||
}
|
||||
|
||||
// Removes an installed add-on, the way clicking Remove in about:addons
|
||||
// does. tests/e2e/firefox/reinstall.js uses it to ask the one question
|
||||
// that decides whether this extension can be used at all on Firefox: does
|
||||
// the vault survive being removed and added again.
|
||||
async uninstallAddon(id) {
|
||||
return this.session("POST", "/moz/addon/uninstall", { id });
|
||||
}
|
||||
|
||||
// Classic navigation on purpose. BiDi's browsingContext.navigate
|
||||
// refuses moz-extension:// URLs outright.
|
||||
async navigate(url) {
|
||||
|
||||
Reference in New Issue
Block a user