Closed Bug 1896669 Opened 2 months ago Closed 2 months ago

"Dark Background and Light Text" add-on stops working

Categories

(WebExtensions :: General, defect)

Firefox 128
Desktop
Windows 11
defect

Tracking

(firefox-esr115 unaffected, firefox126 unaffected, firefox127 unaffected, firefox128 fixed)

RESOLVED FIXED
128 Branch
Tracking Status
firefox-esr115 --- unaffected
firefox126 --- unaffected
firefox127 --- unaffected
firefox128 --- fixed

People

(Reporter: alice0775, Assigned: robwu)

References

(Regression)

Details

(Keywords: nightly-community, regression, Whiteboard: [addons-jira])

Attachments

(1 file)

Steps to reproduce:

  1. Install "Dark Background and Light Text" add-on ( https://addons.mozilla.org/en-US/firefox/addon/dark-background-light-text/ )
  2. Open any web site such as https://ftp.mozilla.org/pub/firefox/nightly/

Actual results:
"Dark Background and Light Text" add-on does not work.
Background color of the web page is white

The following error is shown in Browser Console:

Uncaught (in promise) Error: Type error for parameter contentScriptOptions (Unexpected property "matchOriginAsFallback") for contentScripts.register.
    f moz-extension://66a005e5-6702-42f9-b8df-19f7fafcfc5e/background.js:1
background.js:1:8683

Expected results:
Background color of the web page is dark color

Regression window:
https://hg.mozilla.org/integration/autoland/pushloghtml?fromchange=40766d50ef1f07d0598cba24fb616f62edc438ac&tochange=d062a9fa5bb6dbbf536b4f11890b5dc61bd191c9

Suspect: Bug 1853411 or Bug 1475831

Regressed by: 1475831

hey Rob, would you mind to look into this regression which seems to be originating from Bug 1475831 changes?

Flags: needinfo?(rob)

The Bugbug bot thinks this bug should belong to the 'Toolkit::Add-ons Manager' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.

Component: Untriaged → Add-ons Manager
Product: WebExtensions → Toolkit

This extension does something special - undocumented but understandable.

It reads the content_scripts declaration from manifest.json, with browser.runtime.getManifest().content_scripts. Then it transforms all properties, renaming snake_case to camelCase, which happens to be the convention used in the contentScripts.register API.

In bug 1475831 I added a new key to the content script API, match_origin_as_fallback, and added support for the same in the scripting API in bug 1853411. The contentScripts.register (and MV2 userScripts.register, and tabs.executeScript) APIs did not get this new API because these APIs are MV3-only and the scripting API is the recommended alternative.

We could fix the issue by also introducing support for matchOriginAsFallback in the contentScripts.register API (and others for consistency).

An alternative is to mark the property as "optional": "omit-key-if-missing". Then the key won't show up in the return value of runtime.getManifest().

Component: Add-ons Manager → General
Flags: needinfo?(rob)
Product: Toolkit → WebExtensions
Duplicate of this bug: 1896828
Assignee: nobody → rob
Status: NEW → ASSIGNED
Whiteboard: [addons-jira]
Pushed by rob@robwu.nl:
https://hg.mozilla.org/integration/autoland/rev/ddb2d9dea326
Add matchOriginAsFallback to contentScripts.register API r=rpl
Status: ASSIGNED → RESOLVED
Closed: 2 months ago
Resolution: --- → FIXED
Target Milestone: --- → 128 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: