youtube icon indicating copy to clipboard operation
youtube copied to clipboard

💡Clean up unexpected 'background.scripts' in manifest.json for Firefox

Open hkzo opened this issue 5 months ago • 5 comments

⚬ PROBLEM: Firefox triggers a WebExtension warning when loading the extension. The manifest.json contains an unexpected property "background.scripts" inside the "background" object. It does not break the extension's functionality, but it causes a warning to appear in the extension support page (about:debugging).

⚬ SOLUTION: Remove or properly restructure the "background.scripts" property within the manifest.json file to eliminate the warning on Firefox.

manifest.json

  "background": {
    "scripts": [
      "background.js"
-   ],
-    "background.scripts": "background.js"
+   ]
  },

⚬ ALTERNATIVES: Leave the warning as it is, since there is no functional impact on the extension.

⚬ RELEVANCE / SCOPE: This is relevant for Firefox users and developers who inspect the extension support page. It ensures a warning-free installation.

⚬ "SIDE EFFECTS": None. This is a purely internal manifest file cleanup and does not affect the UI, settings, or any features.

⚬ CONTEXT:

  • Extension Version: v4.2080
  • OS: macOS
  • Browser: Firefox 152
  • Steps to reproduce:
    1. Load the extension into Firefox.
    2. Navigate to about:debugging#/runtime/this-firefox.
    3. Check the "Manifest Warnings" section for the extension.
  • Manifest Warning Message:
    Reading manifest: Warning processing background.background.scripts: An unexpected property was found in the WebExtension manifest.
    Image

Thank you!


SHORT Table (Summary)
Problem Manifest warning in Firefox due to unexpected background.scripts.
Solution Clean up the structure in manifest.json.
Alternatives Leave it as it is since there is no functional impact.
Scope Firefox users and developers checking logs.
Side effects None.
Context Extension v4.2080, macOS, Firefox 152

hkzo avatar Jul 04 '26 01:07 hkzo

Hi, I'd like to work on this. I'll submit a PR shortly.

nightcityblade avatar Jul 04 '26 03:07 nightcityblade

Hi I would like to work on this

harshjainnn avatar Jul 04 '26 03:07 harshjainnn

Thanks for the quick PR, @harshjainnn!

Just a heads-up: Based on my investigation, the three source files we can see (master/manifest.json, build/build.py, and .github/workflows/build-firefox-app.yml) all look perfectly fine and don't seem to have any issues.

Because of this, it's highly possible that this invalid background.scripts property is being injected during the extension signing or packaging pipeline—background processes that we cannot fully trace from the source files alone.

We might need to look into the signing/CI environment to fix the root cause so that the fix doesn't get overwritten or break the build.

hkzo avatar Jul 04 '26 04:07 hkzo

Hi @hkzo — I traced this through the full build pipeline to find the root cause. Investigation:

build/build.py's firefox() function only does a clean deletion of service_worker and inserts a valid scripts array — no merge or flattening logic that could produce a dotted key like background.scripts. .github/workflows/build-firefox-app.yml runs python3 build/build.py -firefox with no intermediate sed/jq steps touching the manifest. Building locally (python build/build.py -firefox) and inspecting the resulting firefox-4.zip confirms the packaged manifest.json is clean:

"background": { "scripts": ["background.js"] } Root cause of the original warning: The invalid "background.scripts" key existed in two places historically:

Root manifest.json — removed in 1601f45b build/manifest3Firefox.json — removed in 6cf85010 (PR #3485)

Both are clean on master now. Builds/signed packages generated before those commits would still show the warning if tested — likely explaining any residual reports. Suggestion: if the warning is still seen in a currently signed/published release, it may be worth checking whether that release was built from a commit prior to 6cf85010, and triggering a fresh release build from current master to confirm it's resolved end-to-end.

harshjainnn avatar Jul 04 '26 06:07 harshjainnn

Thank you so much for the deep dive and thorough investigation, @harshjainnn!

Your analysis is spot on. To be absolutely sure, I extracted and compared the manifest.json directly from the published v4.2080 package. Excluding the version number, there were indeed unexpected differences in web_accessible_resources:

"web_accessible_resources": [
    {
      "resources": [
        "menu/index.html",
        "js&css/web-accessible/core.js",
        "js&css/web-accessible/functions.js",
        "js&css/web-accessible/www.youtube.com/appearance.js",
        "js&css/web-accessible/www.youtube.com/player.js",
        "js&css/web-accessible/www.youtube.com/themes.js",
        "js&css/web-accessible/www.youtube.com/playlist.js",
        "js&css/web-accessible/www.youtube.com/playlist-complete-playlist.js",
+       "js&css/web-accessible/www.youtube.com/playlist-cleaner.js",
        "js&css/web-accessible/www.youtube.com/channel.js",
        "js&css/web-accessible/www.youtube.com/shortcuts.js",
        "js&css/web-accessible/www.youtube.com/blocklist.js",
        "js&css/web-accessible/www.youtube.com/settings.js",
        "js&css/web-accessible/www.youtube.com/last-watched-overlay.js",
        "js&css/web-accessible/www.youtube.com/return-youtube-dislike.js",
        "js&css/web-accessible/www.youtube.com/return-youtube-dislike.css",
        "js&css/web-accessible/init.js",
        "menu/icons/48.png"
      ],
      "matches": [
        "https://www.youtube.com/*"
      ]
    }
  ]

Since the master branch and our build scripts are completely clean, this confirms that the root cause is isolated to the manual packaging/signing environment handled outside of this repository.

As contributors, there is nothing more we can change or fix in the source code. Let's leave this issue open and wait for the core maintainers to check their release environment for future updates.

Thank you again for your awesome support in tracing this down!

hkzo avatar Jul 05 '26 12:07 hkzo