diff --git a/.circleci/config.yml b/.circleci/config.yml
index 3c1ae3dfa2b6..f4b824285a19 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -118,6 +118,9 @@ workflows:
- prep-build:
requires:
- prep-deps
+ - prep-build-mv2:
+ requires:
+ - prep-deps
- prep-build-desktop:
filters:
branches:
@@ -127,18 +130,24 @@ workflows:
- prep-build-flask:
requires:
- prep-deps
+ - prep-build-flask-mv2:
+ requires:
+ - prep-deps
- prep-build-test:
requires:
- prep-deps
- - prep-build-multichain-test:
+ - prep-build-test-mv2:
requires:
- prep-deps
- - prep-build-test-mv3:
+ - prep-build-multichain-test:
requires:
- prep-deps
- prep-build-test-flask:
requires:
- prep-deps
+ - prep-build-test-flask-mv2:
+ requires:
+ - prep-deps
- prep-build-test-mmi:
requires:
- prep-deps
@@ -170,7 +179,7 @@ workflows:
- prep-build-multichain-test
- test-e2e-firefox:
requires:
- - prep-build-test
+ - prep-build-test-mv2
- test-e2e-chrome-rpc:
requires:
- prep-build-test
@@ -182,7 +191,7 @@ workflows:
- prep-build-test-flask
- test-e2e-firefox-flask:
requires:
- - prep-build-test-flask
+ - prep-build-test-flask-mv2
- test-e2e-chrome-mmi:
requires:
- prep-build-test-mmi
@@ -192,9 +201,6 @@ workflows:
- test-e2e-chrome-rpc-mmi:
requires:
- prep-build-test-mmi
- - test-e2e-chrome-mv3:
- requires:
- - prep-build-test-mv3
- test-e2e-chrome-vault-decryption:
filters:
branches:
@@ -227,6 +233,9 @@ workflows:
- validate-source-maps:
requires:
- prep-build
+ - validate-source-maps-mv2:
+ requires:
+ - prep-build-mv2
- validate-source-maps-beta:
requires:
- trigger-beta-build
@@ -242,10 +251,13 @@ workflows:
- validate-source-maps-flask:
requires:
- prep-build-flask
- - test-mozilla-lint:
+ - validate-source-maps-flask-mv2:
+ requires:
+ - prep-build-flask-mv2
+ - test-mozilla-lint-mv2:
requires:
- prep-deps
- - prep-build
+ - prep-build-mv2
- test-mozilla-lint-desktop:
filters:
branches:
@@ -253,10 +265,10 @@ workflows:
requires:
- prep-deps
- prep-build-desktop
- - test-mozilla-lint-flask:
+ - test-mozilla-lint-flask-mv2:
requires:
- prep-deps
- - prep-build-flask
+ - prep-build-flask-mv2
- all-tests-pass:
requires:
- test-deps-depcheck
@@ -277,9 +289,9 @@ workflows:
- validate-source-maps-desktop
- validate-source-maps-flask
- validate-source-maps-mmi
- - test-mozilla-lint
+ - test-mozilla-lint-mv2
- test-mozilla-lint-desktop
- - test-mozilla-lint-flask
+ - test-mozilla-lint-flask-mv2
- test-e2e-chrome
- test-e2e-chrome-multichain
- test-e2e-chrome-multiple-providers
@@ -298,18 +310,19 @@ workflows:
- prep-build-test
- stats-module-load-init:
requires:
- - prep-build-test-mv3
+ - prep-build-test
- job-publish-prerelease:
requires:
- prep-deps
- prep-build
+ - prep-build-mv2
- trigger-beta-build
- prep-build-desktop
- prep-build-mmi
- prep-build-flask
+ - prep-build-flask-mv2
- prep-build-storybook
- prep-build-ts-migration-dashboard
- - prep-build-test-mv3
- benchmark
- user-actions-benchmark
- stats-module-load-init
@@ -321,9 +334,11 @@ workflows:
requires:
- prep-deps
- prep-build
+ - prep-build-mv2
- prep-build-desktop
- prep-build-mmi
- prep-build-flask
+ - prep-build-flask-mv2
- all-tests-pass
- job-publish-storybook:
filters:
@@ -561,6 +576,48 @@ jobs:
- dist
- builds
+ prep-build-mv2:
+ executor: node-browsers-medium-plus
+ steps:
+ - run: *shallow-git-clone
+ - attach_workspace:
+ at: .
+ - when:
+ condition:
+ not:
+ matches:
+ pattern: /^master$/
+ value: << pipeline.git.branch >>
+ steps:
+ - run:
+ name: build:dist
+ command: ENABLE_MV3=false yarn build dist
+ - when:
+ condition:
+ matches:
+ pattern: /^master$/
+ value: << pipeline.git.branch >>
+ steps:
+ - run:
+ name: build:prod
+ command: ENABLE_MV3=false yarn build prod
+ - run:
+ name: build:debug
+ command: find dist/ -type f -exec md5sum {} \; | sort -k 2
+ - run:
+ name: Move mmi build to 'dist-mv2' to avoid conflict with production build
+ command: mv ./dist ./dist-mv2
+ - run:
+ name: Move mmi zips to 'builds-mv2' to avoid conflict with production build
+ command: mv ./builds ./builds-mv2
+ - store_artifacts:
+ path: builds-mv2
+ - persist_to_workspace:
+ root: .
+ paths:
+ - dist-mv2
+ - builds-mv2
+
prep-build-desktop:
executor: node-browsers-medium-plus
steps:
@@ -668,6 +725,46 @@ jobs:
- dist-flask
- builds-flask
+ prep-build-flask-mv2:
+ executor: node-browsers-medium-plus
+ steps:
+ - run: *shallow-git-clone
+ - attach_workspace:
+ at: .
+ - when:
+ condition:
+ not:
+ matches:
+ pattern: /^master$/
+ value: << pipeline.git.branch >>
+ steps:
+ - run:
+ name: build:dist
+ command: ENABLE_MV3=false yarn build --build-type flask dist
+ - when:
+ condition:
+ matches:
+ pattern: /^master$/
+ value: << pipeline.git.branch >>
+ steps:
+ - run:
+ name: build:prod
+ command: yarn build --build-type flask prod
+ - run:
+ name: build:debug
+ command: find dist/ -type f -exec md5sum {} \; | sort -k 2
+ - run:
+ name: Move flask build to 'dist-flask' to avoid conflict with production build
+ command: mv ./dist ./dist-flask-mv2
+ - run:
+ name: Move flask zips to 'builds-flask' to avoid conflict with production build
+ command: mv ./builds ./builds-flask-mv2
+ - persist_to_workspace:
+ root: .
+ paths:
+ - dist-flask-mv2
+ - builds-flask-mv2
+
prep-build-test-flask:
executor: node-browsers-medium-plus
steps:
@@ -689,6 +786,27 @@ jobs:
- dist-test-flask
- builds-test-flask
+ prep-build-test-flask-mv2:
+ executor: node-browsers-medium-plus
+ steps:
+ - run: *shallow-git-clone
+ - attach_workspace:
+ at: .
+ - run:
+ name: Build extension for testing
+ command: yarn build:test:flask:mv2
+ - run:
+ name: Move test build to 'dist-test-flask' to avoid conflict with production build
+ command: mv ./dist ./dist-test-flask-mv2
+ - run:
+ name: Move test zips to 'builds-test-flask' to avoid conflict with production build
+ command: mv ./builds ./builds-test-flask-mv2
+ - persist_to_workspace:
+ root: .
+ paths:
+ - dist-test-flask-mv2
+ - builds-test-flask-mv2
+
prep-build-test-mmi:
executor: node-browsers-medium-plus
steps:
@@ -738,28 +856,30 @@ jobs:
path: builds-test-mmi-playwright
destination: builds-test-mmi-playwright
- prep-build-test-mv3:
+ prep-build-test:
executor: node-browsers-medium-plus
steps:
- run: *shallow-git-clone
- attach_workspace:
at: .
- run:
- name: Build extension in mv3 for testing
- command: yarn build:test:mv3
+ name: Build extension for testing
+ command: yarn build:test
- run:
name: Move test build to 'dist-test' to avoid conflict with production build
- command: mv ./dist ./dist-test-mv3
+ command: mv ./dist ./dist-test
- run:
- name: Move test zips to 'builds-test-mv3' to avoid conflict with production build
- command: mv ./builds ./builds-test-mv3
+ name: Move test zips to 'builds-test' to avoid conflict with production build
+ command: mv ./builds ./builds-test
+ - store_artifacts:
+ path: builds-test
- persist_to_workspace:
root: .
paths:
- - dist-test-mv3
- - builds-test-mv3
+ - dist-test
+ - builds-test
- prep-build-test:
+ prep-build-test-mv2:
executor: node-browsers-medium-plus
steps:
- run: *shallow-git-clone
@@ -767,20 +887,20 @@ jobs:
at: .
- run:
name: Build extension for testing
- command: yarn build:test
+ command: yarn build:test:mv2
- run:
- name: Move test build to 'dist-test' to avoid conflict with production build
- command: mv ./dist ./dist-test
+ name: Move test build to 'dist-test-mv2' to avoid conflict with production build
+ command: mv ./dist ./dist-test-mv2
- run:
- name: Move test zips to 'builds-test' to avoid conflict with production build
- command: mv ./builds ./builds-test
+ name: Move test zips to 'builds-test-mv2' to avoid conflict with production build
+ command: mv ./builds ./builds-test-mv2
- store_artifacts:
- path: builds-test
+ path: builds-test-mv2
- persist_to_workspace:
root: .
paths:
- - dist-test
- - builds-test
+ - dist-test-mv2
+ - builds-test-mv2
prep-build-multichain-test:
executor: node-browsers-medium-plus
@@ -991,33 +1111,6 @@ jobs:
- store_test_results:
path: test/test-results/e2e
- test-e2e-chrome-mv3:
- executor: node-browsers-medium-plus
- parallelism: 16
- steps:
- - run: *shallow-git-clone
- - attach_workspace:
- at: .
- - run:
- name: Move test build to dist
- command: mv ./dist-test-mv3 ./dist
- - run:
- name: Move test zips to builds
- command: mv ./builds-test-mv3 ./builds
- - run:
- name: test:e2e:chrome
- command: |
- export ENABLE_MV3=true
- if .circleci/scripts/test-run-e2e.sh; then
- timeout 20m yarn test:e2e:chrome --retries 2
- fi
- no_output_timeout: 5m
- - store_artifacts:
- path: test-artifacts
- destination: test-artifacts
- - store_test_results:
- path: test/test-results/e2e
-
test-e2e-chrome-rpc:
executor: node-browsers-medium
parallelism: 1
@@ -1122,13 +1215,14 @@ jobs:
at: .
- run:
name: Move test build to dist
- command: mv ./dist-test-flask ./dist
+ command: mv ./dist-test-flask-mv2 ./dist
- run:
name: Move test zips to builds
- command: mv ./builds-test-flask ./builds
+ command: mv ./builds-test-flask-mv2 ./builds
- run:
name: test:e2e:firefox:flask
command: |
+ export ENABLE_MV3=false
if .circleci/scripts/test-run-e2e.sh
then
timeout 20m yarn test:e2e:firefox:flask --retries 2
@@ -1244,13 +1338,14 @@ jobs:
at: .
- run:
name: Move test build to dist
- command: mv ./dist-test ./dist
+ command: mv ./dist-test-mv2 ./dist
- run:
name: Move test zips to builds
- command: mv ./builds-test ./builds
+ command: mv ./builds-test-mv2 ./builds
- run:
name: test:e2e:firefox
command: |
+ export ENABLE_MV3=false
if .circleci/scripts/test-run-e2e.sh
then
timeout 20m yarn test:e2e:firefox --retries 2
@@ -1316,21 +1411,21 @@ jobs:
at: .
- run:
name: Move test build to dist
- command: mv ./dist-test-mv3 ./dist
+ command: mv ./dist-test ./dist
- run:
name: Move test zips to builds
- command: mv ./builds-test-mv3 ./builds
+ command: mv ./builds-test ./builds
- run:
name: Run page load benchmark
command: |
- mkdir -p test-artifacts/chrome/mv3
- cp -R development/charts/flamegraph test-artifacts/chrome/mv3/initialisation
- cp -R development/charts/flamegraph/chart test-artifacts/chrome/mv3/initialisation/background
- cp -R development/charts/flamegraph/chart test-artifacts/chrome/mv3/initialisation/ui
- cp -R development/charts/table test-artifacts/chrome/mv3/load_time
+ mkdir -p test-artifacts/chrome/
+ cp -R development/charts/flamegraph test-artifacts/chrome/initialisation
+ cp -R development/charts/flamegraph/chart test-artifacts/chrome/initialisation/background
+ cp -R development/charts/flamegraph/chart test-artifacts/chrome/initialisation/ui
+ cp -R development/charts/table test-artifacts/chrome/load_time
- run:
name: Run page load benchmark
- command: yarn mv3:stats:chrome --out test-artifacts/chrome/mv3
+ command: yarn mv3:stats:chrome --out test-artifacts/chrome
- run:
name: Install jq
command: sudo apt install jq -y
@@ -1372,9 +1467,15 @@ jobs:
- store_artifacts:
path: builds-flask
destination: builds-flask
+ - store_artifacts:
+ path: builds-flask-mv2
+ destination: builds-flask-mv2
- store_artifacts:
path: builds-mmi
destination: builds-mmi
+ - store_artifacts:
+ path: builds-mv2
+ destination: builds-mv2
- store_artifacts:
path: builds-test
- store_artifacts:
@@ -1601,12 +1702,50 @@ jobs:
name: Validate source maps
command: yarn validate-source-maps
- test-mozilla-lint:
+ validate-source-maps-flask-mv2:
+ executor: node-browsers-small
+ steps:
+ - run: *shallow-git-clone
+ - attach_workspace:
+ at: .
+ - run:
+ name: Move flask build to dist
+ command: mv ./dist-flask-mv2 ./dist
+ - run:
+ name: Move flask zips to builds
+ command: mv ./builds-flask-mv2 ./builds
+ - run:
+ name: Validate source maps
+ command: yarn validate-source-maps
+
+ validate-source-maps-mv2:
+ executor: node-browsers-small
+ steps:
+ - run: *shallow-git-clone
+ - attach_workspace:
+ at: .
+ - run:
+ name: Move flask build to dist
+ command: mv ./dist-mv2 ./dist
+ - run:
+ name: Move flask zips to builds
+ command: mv ./builds-mv2 ./builds
+ - run:
+ name: Validate source maps
+ command: yarn validate-source-maps
+
+ test-mozilla-lint-mv2:
executor: node-browsers-medium
steps:
- run: *shallow-git-clone
- attach_workspace:
at: .
+ - run:
+ name: Move flask build to dist
+ command: mv ./dist-mv2 ./dist
+ - run:
+ name: Move flask zips to builds
+ command: mv ./builds-mv2 ./builds
- run:
name: test:mozilla-lint
command: yarn mozilla-lint
@@ -1627,7 +1766,7 @@ jobs:
name: test:mozilla-lint
command: yarn mozilla-lint
- test-mozilla-lint-flask:
+ test-mozilla-lint-flask-mv2:
executor: node-browsers-medium
steps:
- run: *shallow-git-clone
@@ -1635,10 +1774,10 @@ jobs:
at: .
- run:
name: Move flask build to dist
- command: mv ./dist-flask ./dist
+ command: mv ./dist-flask-mv2 ./dist
- run:
name: Move flask zips to builds
- command: mv ./builds-flask ./builds
+ command: mv ./builds-flask-mv2 ./builds
- run:
name: test:mozilla-lint
command: yarn mozilla-lint
diff --git a/README.md b/README.md
index 67d5e9654b76..c6b4cec0fb51 100644
--- a/README.md
+++ b/README.md
@@ -120,11 +120,11 @@ Before running e2e tests, ensure you've run `yarn install` to download dependenc
- `yarn build:test` for main build
- `yarn build:test:flask` for flask build
- `yarn build:test:mmi` for mmi build
- - `yarn build:test:mv3` for mv3 build
+ - `yarn build:test:mv2` for mv2 build
3. Start a test build with live changes: `yarn start:test` is particularly useful for development. It starts a test build that automatically recompiles application code upon changes. This option is ideal for iterative testing and development. This command also allows you to generate test builds for various types, including:
- `yarn start:test` for main build
- `yarn start:test:flask` for flask build
- - `yarn start:test:mv3` for mv3 build
+ - `yarn start:test:mv2` for mv2 build
Note: The `yarn start:test` command (which initiates the testDev build type) has LavaMoat disabled for both the build system and the application, offering a streamlined testing experience during development. On the other hand, `yarn build:test` enables LavaMoat for enhanced security in both the build system and application, mirroring production environments more closely.
@@ -180,7 +180,7 @@ Different build types have different e2e tests sets. In order to run them look i
```console
"test:e2e:chrome:mmi": "SELENIUM_BROWSER=chrome node test/e2e/run-all.js --mmi",
"test:e2e:chrome:snaps": "SELENIUM_BROWSER=chrome node test/e2e/run-all.js --snaps",
- "test:e2e:chrome:mv3": "ENABLE_MV3=true SELENIUM_BROWSER=chrome node test/e2e/run-all.js",
+ "test:e2e:firefox": "ENABLE_MV3=false SELENIUM_BROWSER=firefox node test/e2e/run-all.js",
```
#### Note: Running MMI e2e tests
diff --git a/builds.yml b/builds.yml
index a38eeaca6527..2d71a15ce019 100644
--- a/builds.yml
+++ b/builds.yml
@@ -189,8 +189,7 @@ env:
- SUPPORT_REQUEST_LINK: https://metamask.zendesk.com/hc/en-us
- SKIP_BACKGROUND_INITIALIZATION: false
- # TODO(ritave): Move ManifestV3 into a feature?
- - ENABLE_MV3: false
+ - ENABLE_MV3: true
# These are exclusively used for MV3
- APPLY_LAVAMOAT
- FILE_NAMES
diff --git a/development/build/manifest.js b/development/build/manifest.js
index a12f1c455558..c15107564c9a 100644
--- a/development/build/manifest.js
+++ b/development/build/manifest.js
@@ -3,7 +3,10 @@ const path = require('path');
const childProcess = require('child_process');
const { mergeWith, cloneDeep } = require('lodash');
-const baseManifest = process.env.ENABLE_MV3
+const IS_MV3_ENABLED =
+ process.env.ENABLE_MV3 === 'true' || process.env.ENABLE_MV3 === undefined;
+
+const baseManifest = IS_MV3_ENABLED
? require('../../app/manifest/v3/_base.json')
: require('../../app/manifest/v2/_base.json');
const { loadBuildTypesConfig } = require('../lib/build-type');
@@ -32,7 +35,7 @@ function createManifestTasks({
'..',
'..',
'app',
- process.env.ENABLE_MV3 ? 'manifest/v3' : 'manifest/v2',
+ IS_MV3_ENABLED ? 'manifest/v3' : 'manifest/v2',
`${platform}.json`,
),
);
@@ -136,7 +139,7 @@ function createManifestTasks({
buildType,
applyLavaMoat,
shouldIncludeSnow,
- shouldIncludeMV3: process.env.ENABLE_MV3,
+ shouldIncludeMV3: IS_MV3_ENABLED,
});
manifest.description = `${environment} build from git id: ${gitRevisionStr}`;
diff --git a/development/build/scripts.js b/development/build/scripts.js
index 476e4974df71..b83a438063f7 100644
--- a/development/build/scripts.js
+++ b/development/build/scripts.js
@@ -1,5 +1,4 @@
// TODO(ritave): Remove switches on hardcoded build types
-
const { callbackify } = require('util');
const path = require('path');
const { writeFileSync, readFileSync, unlinkSync } = require('fs');
@@ -53,6 +52,9 @@ const {
createRemoveFencedCodeTransform,
} = require('./transforms/remove-fenced-code');
+const isEnableMV3 =
+ process.env.ENABLE_MV3 === 'true' || process.env.ENABLE_MV3 === undefined;
+
// map dist files to bag of needed native APIs against LM scuttling
const scuttlingConfigBase = {
'scripts/sentry-install.js': {
@@ -186,7 +188,7 @@ function createScriptTasks({
// In MV3 we will need to build our offscreen entry point bundle and any
// entry points for iframes that we want to lockdown with LavaMoat.
- if (process.env.ENABLE_MV3 === 'true') {
+ if (isEnableMV3) {
standardEntryPoints.push('offscreen');
}
@@ -345,7 +347,7 @@ function createScriptTasks({
() => {
// MV3 injects inpage into the tab's main world, but in MV2 we need
// to do it manually:
- if (process.env.ENABLE_MV3) {
+ if (isEnableMV3) {
return;
}
// stringify scripts/inpage.js into itself, and then make it inject itself into the page
@@ -689,7 +691,7 @@ function createFactoredBuild({
applyLavaMoat,
destinationFileName: 'load-background.js',
});
- if (process.env.ENABLE_MV3) {
+ if (isEnableMV3) {
const jsBundles = [
...commonSet.values(),
...groupSet.values(),
@@ -991,7 +993,9 @@ function setupMinification(buildConfiguration) {
function setupScuttlingWrapping(buildConfiguration, applyLavaMoat, envVars) {
const scuttlingConfig =
- envVars.ENABLE_MV3 === 'true'
+ envVars.ENABLE_MV3 === 'true' ||
+ envVars.ENABLE_MV3 === undefined ||
+ envVars.ENABLE_MV3 === true
? mv3ScuttlingConfig
: standardScuttlingConfig;
const { events } = buildConfiguration;
diff --git a/development/build/static.js b/development/build/static.js
index f6abf7b488de..6469d9737995 100644
--- a/development/build/static.js
+++ b/development/build/static.js
@@ -208,7 +208,11 @@ function getCopyTargets(
allCopyTargets.push({
src: getPathInsideNodeModules('@blockaid/ppom_release', '/'),
pattern: '*.wasm',
- dest: process.env.ENABLE_MV3 ? 'scripts/' : '',
+ dest:
+ process.env.ENABLE_MV3 === 'true' ||
+ process.env.ENABLE_MV3 === undefined
+ ? 'scripts/'
+ : '',
});
}
diff --git a/development/metamaskbot-build-announce.js b/development/metamaskbot-build-announce.js
index e49bd848ca55..f85d64faa887 100755
--- a/development/metamaskbot-build-announce.js
+++ b/development/metamaskbot-build-announce.js
@@ -68,14 +68,20 @@ async function start() {
const platforms = ['chrome', 'firefox'];
const buildLinks = platforms
.map((platform) => {
- const url = `${BUILD_LINK_BASE}/builds/metamask-${platform}-${VERSION}.zip`;
+ const url =
+ platform === 'firefox'
+ ? `${BUILD_LINK_BASE}/builds-mv2/metamask-${platform}-${VERSION}.zip`
+ : `${BUILD_LINK_BASE}/builds/metamask-${platform}-${VERSION}.zip`;
return `${platform}`;
})
.join(', ');
const betaBuildLinks = `chrome`;
const flaskBuildLinks = platforms
.map((platform) => {
- const url = `${BUILD_LINK_BASE}/builds-flask/metamask-flask-${platform}-${VERSION}-flask.0.zip`;
+ const url =
+ platform === 'firefox'
+ ? `${BUILD_LINK_BASE}/builds-flask-mv2/metamask-flask-${platform}-${VERSION}-flask.0.zip`
+ : `${BUILD_LINK_BASE}/builds-flask/metamask-flask-${platform}-${VERSION}-flask.0.zip`;
return `${platform}`;
})
.join(', ');
@@ -87,13 +93,19 @@ async function start() {
.join(', ');
const testBuildLinks = platforms
.map((platform) => {
- const url = `${BUILD_LINK_BASE}/builds-test/metamask-${platform}-${VERSION}.zip`;
+ const url =
+ platform === 'firefox'
+ ? `${BUILD_LINK_BASE}/builds-test-mv2/metamask-${platform}-${VERSION}.zip`
+ : `${BUILD_LINK_BASE}/builds-test/metamask-${platform}-${VERSION}.zip`;
return `${platform}`;
})
.join(', ');
const testFlaskBuildLinks = platforms
.map((platform) => {
- const url = `${BUILD_LINK_BASE}/builds-test-flask/metamask-flask-${platform}-${VERSION}-flask.0.zip`;
+ const url =
+ platform === 'firefox'
+ ? `${BUILD_LINK_BASE}/builds-test-flask-mv2/metamask-flask-${platform}-${VERSION}-flask.0.zip`
+ : `${BUILD_LINK_BASE}/builds-test-flask/metamask-flask-${platform}-${VERSION}-flask.0.zip`;
return `${platform}`;
})
.join(', ');
@@ -144,13 +156,13 @@ async function start() {
// links to bundle browser builds
const depVizUrl = `${BUILD_LINK_BASE}/build-artifacts/build-viz/index.html`;
const depVizLink = `Build System`;
- const moduleInitStatsBackgroundUrl = `${BUILD_LINK_BASE}/test-artifacts/chrome/mv3/initialisation/background/index.html`;
+ const moduleInitStatsBackgroundUrl = `${BUILD_LINK_BASE}/test-artifacts/chrome/initialisation/background/index.html`;
const moduleInitStatsBackgroundLink = `Background Module Init Stats`;
- const moduleInitStatsUIUrl = `${BUILD_LINK_BASE}/test-artifacts/chrome/mv3/initialisation/ui/index.html`;
+ const moduleInitStatsUIUrl = `${BUILD_LINK_BASE}/test-artifacts/chrome/initialisation/ui/index.html`;
const moduleInitStatsUILink = `UI Init Stats`;
- const moduleLoadStatsUrl = `${BUILD_LINK_BASE}/test-artifacts/chrome/mv3/load_time/index.html`;
+ const moduleLoadStatsUrl = `${BUILD_LINK_BASE}/test-artifacts/chrome/load_time/index.html`;
const moduleLoadStatsLink = `Module Load Stats`;
- const bundleSizeStatsUrl = `${BUILD_LINK_BASE}/test-artifacts/chrome/mv3/bundle_size.json`;
+ const bundleSizeStatsUrl = `${BUILD_LINK_BASE}/test-artifacts/chrome/bundle_size.json`;
const bundleSizeStatsLink = `Bundle Size Stats`;
const userActionsStatsUrl = `${BUILD_LINK_BASE}/test-artifacts/chrome/benchmark/user_actions.json`;
const userActionsStatsLink = `E2e Actions Stats`;
@@ -297,7 +309,7 @@ async function start() {
path.resolve(
__dirname,
'..',
- path.join('test-artifacts', 'chrome', 'mv3', 'bundle_size.json'),
+ path.join('test-artifacts', 'chrome', 'bundle_size.json'),
),
'utf-8',
),
diff --git a/package.json b/package.json
index e7060115549e..a14d2c94d344 100644
--- a/package.json
+++ b/package.json
@@ -8,28 +8,30 @@
},
"scripts": {
"start": "yarn build:dev dev --apply-lavamoat=false --snow=false",
- "start:mv3": "ENABLE_MV3=true yarn build:dev dev --apply-lavamoat=false",
+ "start:mv2": "ENABLE_MV3=false yarn build:dev dev --apply-lavamoat=false --snow=false",
"start:flask": "yarn start --build-type flask",
"start:mmi": "yarn start --build-type mmi",
"start:lavamoat": "yarn build:dev dev --apply-lavamoat=true",
"dist": "yarn build dist",
- "dist:mv3": "ENABLE_MV3=true yarn build dist",
+ "dist:mv2": "ENABLE_MV3=false yarn build dist",
"dist:mmi": "yarn dist --build-type mmi",
"dist:mmi:debug": "yarn dist --build-type mmi --apply-lavamoat=false",
"build": "yarn lavamoat:build",
"build:dev": "node development/build/index.js",
- "start:test": "BLOCKAID_FILE_CDN=static.cx.metamask.io/api/v1/confirmations/ppom SEGMENT_HOST='https://api.segment.io' SEGMENT_WRITE_KEY='FAKE' SENTRY_DSN_DEV=https://fake@sentry.io/0000000 yarn build:dev testDev --apply-lavamoat=false --snow=false",
+ "start:test": "SEGMENT_HOST='https://api.segment.io' SEGMENT_WRITE_KEY='FAKE' SENTRY_DSN_DEV=https://fake@sentry.io/0000000 yarn build:dev testDev",
"start:test:flask": "SEGMENT_HOST='https://api.segment.io' SEGMENT_WRITE_KEY='FAKE' SENTRY_DSN_DEV=https://fake@sentry.io/0000000 yarn build:dev testDev --build-type flask --apply-lavamoat=false --snow=false",
- "start:test:mv3": "ENABLE_MV3=true SEGMENT_HOST='https://api.segment.io' SEGMENT_WRITE_KEY='FAKE' SENTRY_DSN_DEV=https://fake@sentry.io/0000000 yarn build:dev testDev",
+ "start:test:mv2:flask": "ENABLE_MV3=false SEGMENT_HOST='https://api.segment.io' SEGMENT_WRITE_KEY='FAKE' SENTRY_DSN_DEV=https://fake@sentry.io/0000000 yarn build:dev testDev --build-type flask --apply-lavamoat=false --snow=false",
+ "start:test:mv2": "ENABLE_MV3=false BLOCKAID_FILE_CDN=static.cx.metamask.io/api/v1/confirmations/ppom SEGMENT_HOST='https://api.segment.io' SEGMENT_WRITE_KEY='FAKE' SENTRY_DSN_DEV=https://fake@sentry.io/0000000 yarn build:dev testDev --apply-lavamoat=false --snow=false",
"benchmark:chrome": "SELENIUM_BROWSER=chrome ts-node test/e2e/benchmark.js",
- "mv3:stats:chrome": "SELENIUM_BROWSER=chrome ENABLE_MV3=true ts-node test/e2e/mv3-perf-stats/index.js",
+ "mv3:stats:chrome": "SELENIUM_BROWSER=chrome ts-node test/e2e/mv3-perf-stats/index.js",
"user-actions-benchmark:chrome": "SELENIUM_BROWSER=chrome ts-node test/e2e/user-actions-benchmark.js",
"benchmark:firefox": "SELENIUM_BROWSER=firefox ts-node test/e2e/benchmark.js",
- "build:test": "BLOCKAID_FILE_CDN=static.cx.metamask.io/api/v1/confirmations/ppom SEGMENT_HOST='https://api.segment.io' SEGMENT_WRITE_KEY='FAKE' SENTRY_DSN_DEV=https://fake@sentry.io/0000000 yarn build test",
+ "build:test": "SEGMENT_HOST='https://api.segment.io' SEGMENT_WRITE_KEY='FAKE' SENTRY_DSN_DEV=https://fake@sentry.io/0000000 yarn build test",
+ "build:test:dev": "SEGMENT_HOST='https://api.segment.io' SEGMENT_WRITE_KEY='FAKE' SENTRY_DSN_DEV=https://fake@sentry.io/0000000 yarn build:dev testDev --apply-lavamoat=false",
"build:test:flask": "SEGMENT_HOST='https://api.segment.io' SEGMENT_WRITE_KEY='FAKE' yarn build test --build-type flask",
+ "build:test:flask:mv2": "ENABLE_MV3=false SEGMENT_HOST='https://api.segment.io' SEGMENT_WRITE_KEY='FAKE' yarn build test --build-type flask",
"build:test:mmi": "SEGMENT_HOST='https://api.segment.io' SEGMENT_WRITE_KEY='FAKE' yarn build test --build-type mmi",
- "build:test:mv3": "ENABLE_MV3=true SEGMENT_HOST='https://api.segment.io' SEGMENT_WRITE_KEY='FAKE' SENTRY_DSN_DEV=https://fake@sentry.io/0000000 yarn build test",
- "build:test:dev:mv3": "ENABLE_MV3=true SEGMENT_HOST='https://api.segment.io' SEGMENT_WRITE_KEY='FAKE' SENTRY_DSN_DEV=https://fake@sentry.io/0000000 yarn build:dev testDev --apply-lavamoat=false",
+ "build:test:mv2": "ENABLE_MV3=false BLOCKAID_FILE_CDN=static.cx.metamask.io/api/v1/confirmations/ppom SEGMENT_HOST='https://api.segment.io' SEGMENT_WRITE_KEY='FAKE' SENTRY_DSN_DEV=https://fake@sentry.io/0000000 yarn build test",
"test": "yarn lint && yarn test:unit && yarn test:unit:jest",
"dapp": "node development/static-server.js node_modules/@metamask/test-dapp/dist --port 8080",
"dapp-chain": "GANACHE_ARGS='-b 2' concurrently -k -n ganache,dapp -p '[{time}][{name}]' 'yarn ganache:start' 'sleep 5 && yarn dapp'",
@@ -49,7 +51,6 @@
"test:e2e:mmi:visual": "./test/e2e/mmi/scripts/run-visual-test.sh check",
"test:e2e:mmi:visual:update": "./test/e2e/mmi/scripts/run-visual-test.sh update",
"test:e2e:pw:report": "yarn playwright show-report public/playwright/playwright-reports/html",
- "test:e2e:chrome:mv3": "ENABLE_MV3=true SELENIUM_BROWSER=chrome node test/e2e/run-all.js",
"test:e2e:chrome:rpc": "SELENIUM_BROWSER=chrome node test/e2e/run-all.js --rpc",
"test:e2e:chrome:multi-provider": "MULTIPROVIDER=true SELENIUM_BROWSER=chrome node test/e2e/run-all.js --multi-provider",
"test:e2e:firefox": "SELENIUM_BROWSER=firefox node test/e2e/run-all.js",
diff --git a/test/e2e/json-rpc/switchEthereumChain.spec.js b/test/e2e/json-rpc/switchEthereumChain.spec.js
index bd2cb907f895..9c326a0d0116 100644
--- a/test/e2e/json-rpc/switchEthereumChain.spec.js
+++ b/test/e2e/json-rpc/switchEthereumChain.spec.js
@@ -208,7 +208,11 @@ describe('Switch Ethereum Chain for two dapps', function () {
// if this is an MV3 build(3 or 4 total)
await driver.wait(async () => {
const windowHandles = await driver.getAllWindowHandles();
- const numberOfWindowHandlesToExpect = process.env.ENABLE_MV3 ? 4 : 3;
+ const numberOfWindowHandlesToExpect =
+ process.env.ENABLE_MV3 === 'true' ||
+ process.env.ENABLE_MV3 === undefined
+ ? 4
+ : 3;
return windowHandles.length === numberOfWindowHandlesToExpect;
});
},
diff --git a/test/e2e/tests/account/import-flow.spec.js b/test/e2e/tests/account/import-flow.spec.js
index 689b1c0eb4c5..fac83ea1edf9 100644
--- a/test/e2e/tests/account/import-flow.spec.js
+++ b/test/e2e/tests/account/import-flow.spec.js
@@ -379,7 +379,10 @@ describe('Import flow @no-mmi', function () {
});
it('Connects to a Hardware wallet for trezor', async function () {
- if (process.env.ENABLE_MV3) {
+ if (
+ process.env.ENABLE_MV3 === 'true' ||
+ process.env.ENABLE_MV3 === undefined
+ ) {
// Hardware wallets not supported in MV3 build yet
this.skip();
}
diff --git a/test/e2e/tests/request-queuing/ui.spec.js b/test/e2e/tests/request-queuing/ui.spec.js
index 5e2f35fad63f..e85d87226e84 100644
--- a/test/e2e/tests/request-queuing/ui.spec.js
+++ b/test/e2e/tests/request-queuing/ui.spec.js
@@ -74,7 +74,7 @@ async function selectDappClickSendGetNetwork(driver, dappUrl) {
// because the offscreen document returned by getAllWindowHandles provides
// an extra window handle
const newWindowHandles = await driver.waitUntilXWindowHandles(
- process.env.ENABLE_MV3
+ process.env.ENABLE_MV3 === 'true' || process.env.ENABLE_MV3 === undefined
? currentWindowHandles.length
: currentWindowHandles.length + 1,
);
diff --git a/test/e2e/webdriver/driver.js b/test/e2e/webdriver/driver.js
index 616bb6d2f881..f5f81f038bdf 100644
--- a/test/e2e/webdriver/driver.js
+++ b/test/e2e/webdriver/driver.js
@@ -574,7 +574,10 @@ class Driver {
}
async waitUntilXWindowHandles(_x, delayStep = 1000, timeout = this.timeout) {
- const x = process.env.ENABLE_MV3 ? _x + 1 : _x;
+ const x =
+ process.env.ENABLE_MV3 === 'true' || process.env.ENABLE_MV3 === undefined
+ ? _x + 1
+ : _x;
let timeElapsed = 0;
let windowHandles = [];
while (timeElapsed <= timeout) {
diff --git a/ui/__mocks__/webextension-polyfill.js b/ui/__mocks__/webextension-polyfill.js
index 0984c767deb2..693368f15e0c 100644
--- a/ui/__mocks__/webextension-polyfill.js
+++ b/ui/__mocks__/webextension-polyfill.js
@@ -1,3 +1,3 @@
module.exports = {
- runtime: { getManifest: () => ({ manifest_version: 2 }) },
+ runtime: { getManifest: () => ({ manifest_version: 3 }) },
};