Skip to content

fix: Avoid autoreloading by Chrome-generated files#3696

Open
Rob--W wants to merge 1 commit intomozilla:masterfrom
Rob--W:watcher-ignore-chrome-file
Open

fix: Avoid autoreloading by Chrome-generated files#3696
Rob--W wants to merge 1 commit intomozilla:masterfrom
Rob--W:watcher-ignore-chrome-file

Conversation

@Rob--W
Copy link
Copy Markdown
Member

@Rob--W Rob--W commented Apr 25, 2026

Fixes #3468

Must be merged after #3697 to avoid test failures.

@Rob--W Rob--W requested a review from rpl April 25, 2026 20:55
@Rob--W Rob--W force-pushed the watcher-ignore-chrome-file branch 7 times, most recently from d0656cb to 11a79fb Compare April 26, 2026 23:02
@Rob--W Rob--W force-pushed the watcher-ignore-chrome-file branch from 11a79fb to 50c2b2a Compare April 26, 2026 23:13
@Rob--W
Copy link
Copy Markdown
Member Author

Rob--W commented Apr 26, 2026

CI was repeatedly failing due to onChange called for the parent directory in the test:

  1) watcher
       watcher ignores _metadata
         ignores change to non-toplevel _metadata directory (await):
     expected spy to not have been called but was called once

I identified the root cause, to be a watchpack bug, and created a PR to fix that: #3697.

CI is currently red because #3697 is not included in the PR.

Here is a fully green CI job for #3697 + this PR: https://app.circleci.com/pipelines/github/mozilla/web-ext/4894/workflows/871b8d37-b0ce-475a-9094-182c9c889cb0

@Rob--W
Copy link
Copy Markdown
Member Author

Rob--W commented Apr 27, 2026

While this PR works, I wonder whether I should have added the ignore patterns to FileFilter instead:

baseIgnoredPatterns = [
'**/*.xpi',
'**/*.zip',
'**/.*', // any hidden file and folder
'**/.*/**/*', // and the content inside hidden folder
'**/node_modules',
'**/node_modules/**/*',
],

That is passed to the watcher at:

const fileFilter = createFileFilter({ sourceDir, artifactsDir, ignoreFiles });
return onSourceChange({
sourceDir,
watchFile,
watchIgnored,
artifactsDir,
onChange: () => reloadExtension(sourceDir),
shouldWatchFile: (file) => fileFilter.wantFile(file),

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.

A reload now triggers infinite reloading in Chrome

1 participant