Closed Bug 1798848 Opened 26 days ago Closed 14 days ago

"Add new rule" is blocked by CSP

Categories

(DevTools :: Inspector: Rules, defect)

Firefox 102
defect

Tracking

(firefox-esr102 wontfix, firefox106 wontfix, firefox107 wontfix, firefox108 wontfix, firefox109 verified)

VERIFIED FIXED
109 Branch
Tracking Status
firefox-esr102 --- wontfix
firefox106 --- wontfix
firefox107 --- wontfix
firefox108 --- wontfix
firefox109 --- verified

People

(Reporter: tobias.bengfort, Assigned: jdescottes)

References

(Blocks 1 open bug, )

Details

(Keywords: regressionwindow-wanted)

Attachments

(1 file)

User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Firefox/102.0

Steps to reproduce:

Actual results:

  • An empty <style> tag is added just before the closing html tag.
  • The rule does not appear in the rules panel
  • An error is logged: Content Security Policy: The page’s settings blocked the loading of a resource at inline (“default-src”).

Expected results:

The rule should be created

Blocks: devtools-csp
Regressions: 1228985
See Also: → 1391994
No longer regressions: 1228985
See Also: → 1228985

Thanks for the report, I couldn't reproduce on the website mentioned in the summary, but the test page from Bug 1228985 shows the issue:

https://bug1228985.bmoattachments.org/attachment.cgi?id=9149557

STRs:

ER:
A new rule should be created.

AR:
No new rule created.

QA Whiteboard: [qa-regression-triage]

The oldest Firefox version that I manged to run without crashing (92) already had this bug. So probably not a recent regression.

I was able to reproduce this issue and get a regression range but it seems our tool couldnt bisect more builds and this is the best we could do:

7:48.44 INFO: Last good revision: 2da6d806f45732e169fd8e7ea9a9761fa7fed93d (2021-03-25)
7:48.44 INFO: First bad revision: 55c63a6c547f1fecd412505a064f21fd1e1ec48e (2021-03-26)
7:48.44 INFO: Pushlog:
https://hg.mozilla.org/mozilla-central/pushloghtml?fromchange=2da6d806f45732e169fd8e7ea9a9761fa7fed93d&tochange=55c63a6c547f1fecd412505a064f21fd1e1ec48e

Hopefully one of our devs can take a look and might identify what is causing this.

Severity: -- → S3
Status: UNCONFIRMED → NEW
Ever confirmed: true

Great work. I am pretty sure this was caused by "Bug 1685268 - Enable STYLESHEET resource type by default". Looking at the code here: https://searchfox.org/mozilla-central/source/devtools/server/actors/page-style.js#1162-1177 We can see that getStyleElement is never called, which contains the code added Bug 1228985 to fix this bug.

Flags: needinfo?(nchevobbe)
Assignee: nobody → jdescottes
Status: NEW → ASSIGNED

Thanks for the regression window and for the investigation! We still have 2 codepaths for stylesheet management, but we should soon only have one.

Let's fix the regression and add a test.

Flags: needinfo?(nchevobbe)
Pushed by jdescottes@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/80167c80abe4
[devtools] Fix add new rule for pages with style-src CSP when using stylesheet resource r=nchevobbe
Status: ASSIGNED → RESOLVED
Closed: 14 days ago
Resolution: --- → FIXED
Target Milestone: --- → 109 Branch

Verified as fixed in our latest build 109.0a1 (2022-11-14).

The patch landed in nightly and beta is affected.
:jdescottes, is this bug important enough to require an uplift?

  • If yes, please nominate the patch for beta approval.
  • If no, please set status-firefox108 to wontfix.

For more information, please visit auto_nag documentation.

Flags: needinfo?(jdescottes)

Not a recent regression, this can ride the trains.

Flags: needinfo?(jdescottes)

Updating the remaining flag.

Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.