Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add --chromium-pref flag #2912

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

aklinker1
Copy link

@aklinker1 aklinker1 commented Oct 15, 2023

Overview

This closes #2899.

Add a new parameter, --chromium-pref, which lets users configure some profile settings when running the web-ext run command. For default preferences, I set extensions.ui.developer_mode=true so you don't have to toggle the developer mode switch every time you run an extension on chromium.

const DEFAULT_PREFS = {
'extensions.ui.developer_mode': true,
};

I also had to upgrade chromium-launcher to v1.1.0 (see GoogleChrome/chrome-launcher#323), so this replaces #2825 and #2901.

this.chromiumInstance = await this.chromiumLaunch({
enableExtensions: true,
chromePath: chromiumBinary,
chromeFlags,
startingUrl,
userDataDir,
// Ignore default flags to keep the extension enabled.
ignoreDefaultFlags: true,
prefs: this.getPrefs(),
});

Manual Testing

Here's the commands I ran to do manual testing:

# Default, dev mode should be enabled at chrome://extensions
node .\bin\web-ext.js run -s .\tests\fixtures\minimal-web-ext\ -t chromium
# Disable dev mode, change download dir (chrome://settings/downloads)
node .\bin\web-ext.js run -s .\tests\fixtures\minimal-web-ext\ -t chromium --chromium-pref extensions.ui.developer_mode=false --chromium-pref download.default_directory="C:\Users\Aaron\Downloads\test"

@@ -66,6 +66,9 @@ describe('util/extension-runners/chromium', async () => {
'--password-store=basic',
'--use-mock-keychain',
'--force-fieldtrials=*BackgroundTracing/default/',
'--disable-hang-monitor',
'--disable-prompt-on-repost',
'--disable-domain-reliability',
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These changes were required after upgrading chrome-launcher, similar to #2825 (comment)

@aklinker1 aklinker1 changed the title Chromium Preferences feat: Add --chromium-pref flag Oct 15, 2023
@codecov
Copy link

codecov bot commented Oct 15, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.31%. Comparing base (17d1c4b) to head (b1779d9).

Current head b1779d9 differs from pull request most recent head 61e8a86

Please upload reports for the commit 61e8a86 to get more accurate results.

Additional details and impacted files
@@             Coverage Diff             @@
##           master    #2912       +/-   ##
===========================================
+ Coverage        0   99.31%   +99.31%     
===========================================
  Files           0       32       +32     
  Lines           0     1759     +1759     
===========================================
+ Hits            0     1747     +1747     
- Misses          0       12       +12     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@aklinker1 aklinker1 marked this pull request as ready for review October 15, 2023 18:15
@aklinker1
Copy link
Author

Rebased and fixed merge conflicts

@aklinker1
Copy link
Author

Rebased and fixed conflicts

@VersoriumX
Copy link

No conflicts present with Branch

Copy link

@VersoriumX VersoriumX left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add

@pftom
Copy link

pftom commented May 30, 2024

@aklinker1 why not merge this pr? I still encounter the content script source map issues

@aklinker1
Copy link
Author

aklinker1 commented May 30, 2024

Only maintainers can merge PRs, and this hasn't been approved by one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Pass in custom chromium prefs (enable developer mode by default)
3 participants