Closed Bug 1596728 Opened 6 years ago Closed 6 years ago

color picker fails with web fonts like font awesome (because of pseudo-elements)

Categories

(DevTools :: Inspector, defect, P2)

71 Branch
defect

Tracking

(firefox70 wontfix, firefox71 verified, firefox72 verified)

VERIFIED FIXED
Firefox 72
Tracking Status
firefox70 --- wontfix
firefox71 --- verified
firefox72 --- verified

People

(Reporter: mark.bokil, Assigned: yzen)

Details

(Whiteboard: [dt-q])

Attachments

(2 files)

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:71.0) Gecko/20100101 Firefox/71.0

Steps to reproduce:

Went to the font awesome site and used the inspector to add a color to a web font. In the inspector I hovered over the color picker and it advised me to click to open the color picker. I clicked the color picker and nothing opens. https://fontawesome.com/icons?d=gallery

Actual results:

The color picker fails to appear when clicked and a web font element is selected in the inspector.

Expected results:

Color picker should have appeared.

Bugbug thinks this bug should belong to this component, but please revert this change in case of error.

Component: Untriaged → Layout: Text and Fonts
Product: Firefox → Core

I can repro on Nightly.

Status: UNCONFIRMED → NEW
Component: Layout: Text and Fonts → Inspector
Ever confirmed: true
Product: Core → DevTools

Thank you for filing, I can reproduce this too in Nightly (Firefox 72) and when I do, the following errors appear in the browser console:

Error while calling actor 'domnode's method 'getBackgroundColor' getAdjustedQuads(...)[0] is undefined Actor.js:91:13
getBackgroundColor@resource://devtools/server/actors/inspector/utils.js:472:1
getBackgroundColor@resource://devtools/server/actors/inspector/node.js:718:32
handler@resource://devtools/shared/protocol/Actor.js:154:37
onPacket@resource://devtools/server/debugger-server-connection.js:378:58
receiveMessage@resource://devtools/shared/transport/child-transport.js:66:16
Actor.js:96:15
uncaught exception: Protocol error (unknownError): getAdjustedQuads(...)[0] is undefined

It looks like the way we try to calculate color contrast in the color-picker fails for that particular site.

The error comes from this line of code: https://searchfox.org/mozilla-central/rev/cac340f10816707e91c46db6d285f80259420f07/devtools/server/actors/inspector/utils.js#468
Which was added in bug 1568053, which landed in Firefox 70.

Here is a reduced test case:

  • open this URL data:text/html,<style>body{color:red}body::before{content:"test";}</style>
  • select <body>
  • click on the red color swatch in the rule-view.

Yura: do you know what needs to be done to avoid this problem with pseudo-elements?

Flags: needinfo?(yzenevich)
Priority: -- → P2
Summary: color picker fails with web fonts like font awesome → color picker fails with web fonts like font awesome (because of pseudo-elements)
Whiteboard: [dt-q]
Assignee: nobody → yzenevich
Status: NEW → ASSIGNED
Flags: needinfo?(yzenevich)
Pushed by yura.zenevich@gmail.com: https://hg.mozilla.org/integration/autoland/rev/64e9c22dc177 fix an error when opening a color picker for an element with a pseudo child. r=rcaliman
Status: ASSIGNED → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 72

Comment on attachment 9109723 [details]
Bug 1596728 - fix an error when opening a color picker for an element with a pseudo child. r=rcaliman

Beta/Release Uplift Approval Request

  • User impact if declined: In the use case described in STR, color picker is broken and would not open.
  • Is this code covered by automated tests?: No
  • Has the fix been verified in Nightly?: Yes
  • Needs manual test from QE?: Yes
  • If yes, steps to reproduce:
  • List of other uplifts needed: None
  • Risk to taking this patch: Low
  • Why is the change risky/not risky? (and alternatives if risky): Added additional check to ensure that we do not throw a JS exception when opening a color picker in the inspector panel.
  • String changes made/needed: none
Attachment #9109723 - Flags: approval-mozilla-beta?

Comment on attachment 9109723 [details]
Bug 1596728 - fix an error when opening a color picker for an element with a pseudo child. r=rcaliman

Fix for a recent devtools regression, that looks sage enough for our last beta, uplift approved for 71 beta 12, thanks.

Attachment #9109723 - Flags: approval-mozilla-beta? → approval-mozilla-beta+

Confirmed issue with 72.0a1 (2019-11-15) on Windows 10.
Fix verified with 71.0b12, 72.0a1(2019-11-21)on Windows 10, macOS 10.14, Ubuntu 18.04.

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

Attachment

General

Creator:
Created:
Updated:
Size: