Error when using "Copy Rule" context menu entry when there's no rule at cursor position
Categories
(DevTools :: Inspector: Rules, defect, P3)
Tracking
(firefox129 verified, firefox130 verified)
People
(Reporter: nchevobbe, Assigned: nchevobbe)
Details
Attachments
(1 file)
Alex noticed he could easily get errors when copying rules:
while testing copying rules, I found that you can easily get a resource://devtools/client/inspector/shared/style-inspector-menu.js, line 474: TypeError: can't access property "stringifyRule", rule is null exception and a test as simple as data:text/html,foo.
But the exception doesn't seem to break anything.
Assignee | ||
Comment 1•1 year ago
|
||
Alex, I wasn't able to reproduce the issue, how are you copying the rule? both selecting with the mouse and doing Cmd+C, or using the context menu entry don't trigger the error you reported on my machine
Comment 2•1 year ago
|
||
My STR is the following:
- open
data:text/html,foo
- open inspector (<body> is selected by default)
- right click anywhere in the rule view and click on
Copy Rule
I'm getting JavaScript error: resource://devtools/client/inspector/shared/style-inspector-menu.js, line 474: TypeError: can't access property "stringifyRule", rule is null
printed in stdout.
Assignee | ||
Comment 3•1 year ago
|
||
Thanks for the STR, I can reproduce easily now
We probably shouldn't display the context menu entry if there's no rule behind the cursor.
The check that we do to display the entry is simply "are we in the rule view", which is a bit naive
const menuitemCopyRule = new MenuItem({
label: STYLE_INSPECTOR_L10N.getStr("styleinspector.contextmenu.copyRule"),
click: () => {
this._onCopyRule();
},
visible: this.isRuleView,
});
Assignee | ||
Comment 4•1 year ago
|
||
Updated•1 year ago
|
Comment 6•1 year ago
|
||
bugherder |
Updated•1 year ago
|
Reproducible on a 2024-06-11 Nightly build on Windows 10.
Verified as fixed on Firefox 129.0b2 and Firefox Nightly 130.0a1 on Windows 10, macOS 14, Ubuntu 22.
Description
•