Closed Bug 1679997 Opened 4 years ago Closed 2 months ago

Add cssOrigin to declarative contentScripts API (manifest.json, scripting, contentScripts)

Categories

(WebExtensions :: Compatibility, enhancement, P3)

enhancement

Tracking

(firefox144 fixed)

RESOLVED FIXED
144 Branch
Tracking Status
firefox144 --- fixed

People

(Reporter: erosman, Assigned: chrstina.lin, Mentored)

References

(Blocks 1 open bug)

Details

(Keywords: dev-doc-complete, good-first-bug, Whiteboard: [wecg][addons-jira])

Attachments

(1 file)

Similar to tabs.insertCSS(), an option to set cssOrigin would be beneficial. e.g.

browser.contentScripts.register({
  matches: [hosts],
  css: [{code, cssOrigin: "user"}],
  runAt: "document_idle"
});

This sounds reasonable, and should be fairly easy since we already support it for tabs.executeScript. I'm expecting just a matter of adding a field to register options:
https://searchfox.org/mozilla-central/rev/1843375acb/toolkit/components/extensions/schemas/content_scripts.json#10
maybe forwarding it along the line in implementation starting from:
https://searchfox.org/mozilla-central/rev/1843375acb/toolkit/components/extensions/parent/ext-contentScripts.js#148
and adding a test probably around here:
https://searchfox.org/mozilla-central/rev/1843375acb/toolkit/components/extensions/test/xpcshell/test_ext_contentScripts_register.js

The guide to getting started is at https://wiki.mozilla.org/WebExtensions/Contribution_Onramp.

Mentor: tomica
Status: UNCONFIRMED → NEW
Ever confirmed: true
Keywords: good-first-bug
Priority: -- → P3
Severity: -- → N/A

Hi,

since I'd like to practice testing in this scope, it's great if I can fix this bug. Could I?

Hello, I am new to contributing to Bugzilla can you assigned me to this issue so that I can learn to fix these bugs and also suggest to me how can Is start working on this bug to fix it

Sorry Falguni, but gero has asked first.

(In reply to gero from comment #2)

since I'd like to practice testing in this scope, it's great if I can fix this bug. Could I?

Sure, I assigned the bug to you. Take a look at comment 1 for details on getting started, and feel free to ask questions (use "request information" below the comment box here).

Assignee: nobody → gero

Hey Gero, how is it going with this bug? If you have an issue, feel free to ask.

Otherwise, we'd like to assign this bug to someone else.

Flags: needinfo?(gero)

Sry for being disappeared, feel free to assign it to the other guy.

Flags: needinfo?(gero)
Assignee: gero → nobody

HI there,
I would like to work on this issue, I have set development environment, can you please guide me solving this.
I set mozilla-central development environment, am I on right way for this issue?

Hi my name is Leslie and I am an Outreachy applicant. Can I work on this bug?

Flags: needinfo?(tomica)

These days, the scripting API is the primary API to register content scripts and styles. Therefore I'm adjusting the title to reflect the full scope of changes.

There is consensus across browsers to support the feature, at https://github.com/w3c/webextensions/issues/414

Blocks: 1687764
Flags: needinfo?(tomica)
Summary: Add cssOrigin to contentScripts API → Add cssOrigin to declarative contentScripts API (manifest.json, scripting, contentScripts)
Whiteboard: [wecg]
See Also: → 1428398
Whiteboard: [wecg] → [wecg][addons-jira]
Component: General → Compatibility

(In reply to Rob Wu [:robwu] from comment #10)

These days, the scripting API is the primary API to register content scripts and styles. Therefore I'm adjusting the title to reflect the full scope of changes.

what do you mean by "full scope", are you proposing we should update the old contentScripts api as well?

Flags: needinfo?(rob)

(In reply to Tomislav Jovanovic :zombie from comment #11)

(In reply to Rob Wu [:robwu] from comment #10)

These days, the scripting API is the primary API to register content scripts and styles. Therefore I'm adjusting the title to reflect the full scope of changes.

what do you mean by "full scope", are you proposing we should update the old contentScripts api as well?

Initially this bug was about contentScripts only. I'm suggesting to expand it to scripting and the manifest key, because it does not make sense to add it to contentScripts.register only.

As the title shows, I'm suggesting to do it for all of the content script APIs, including contentScripts.

Last year I tried implementing a new content script field (match_origin_as_fallback in manifest - bug 1475831, and matchOriginAsFallback in the scripting API - bug 1853411), but initially not in contentScripts. That caused a regression in an extension (bug 1896669), so to minimize risk I also added the field to the existing contentScripts API.

Flags: needinfo?(rob)
Assignee: nobody → chrlin
Attachment #9490705 - Attachment description: WIP: Bug 1679997 - Add cssOrigin to declarative contentScripts API. r=zombie → Bug 1679997 - Add cssOrigin to declarative contentScripts API. r=zombie
Status: NEW → ASSIGNED

This good-first-bug hasn't had any activity for 2 months, it is automatically unassigned.
For more information, please visit BugBot documentation.

Assignee: chrlin → nobody
Status: ASSIGNED → NEW
Assignee: nobody → chrlin
Attachment #9490705 - Attachment description: Bug 1679997 - Add cssOrigin to declarative contentScripts API. r=zombie → Bug 1679997 - Add cssOrigin to declarative contentScripts API. r=zombie.
Status: NEW → ASSIGNED
Attachment #9490705 - Attachment description: Bug 1679997 - Add cssOrigin to declarative contentScripts API. r=zombie. → Bug 1679997 - Add cssOrigin to declarative contentScripts API. r=robwu.
Mentor: tomica → rob
Keywords: dev-doc-needed
Status: ASSIGNED → RESOLVED
Closed: 2 months ago
Resolution: --- → FIXED
Target Milestone: --- → 144 Branch
See Also: → 1986249
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: