css errors in error console

Add-ons for Pale Moon and other applications
General discussion, compatibility, contributed extensions, themes, plugins, and more.

Moderators: FranklinDM, Lootyhoof

astewart
Moonbather
Moonbather
Posts: 53
Joined: 2013-12-19, 02:34
Location: San Diego, CA, US

css errors in error console

Unread post by astewart » 2019-01-02, 03:32

I'm debugging a custombutton that tests bits of css, listens to the error console messages and displays the css with the error line selected. It does something like this test code

Code: Select all

var css = ".something { xxxxx: 1; display: none;";
var parser = Cc["@mozilla.org/xmlextras/domparser;1"].createInstance(Ci.nsIDOMParser),
    doc1 = parser.parseFromString("<html xmlns='http://www.w3.org/1999/xhtml'/>", "application/xhtml+xml"),
    doc = doc1.implementation.createDocument("http://www.w3.org/1999/xhtml", "cb3-parse", null),
    style = doc.createElementNS("http://www.w3.org/1999/xhtml", "style");
style.appendChild(doc.createTextNode(css));
doc.documentElement.appendChild(style);
alert(doc.styleSheets[0].cssRules[0].cssText);
return doc.styleSheets[0];
The css in this test code has two obvious errors and the alert message that results shows

Code: Select all

.something { display: none; }
indicating the incorrect css has been skipped. No error shows in the error console for the listener to capture or in the browser console, with no filtering.

Is there a PM setting / preference that would enable css errors like this to show in the error console?

Alan

User avatar
Moonchild
Pale Moon guru
Pale Moon guru
Posts: 35650
Joined: 2011-08-28, 17:27
Location: Motala, SE

Re: css errors in error console

Unread post by Moonchild » 2019-01-02, 06:57

Set layout.css.report_errors to true in about:config for your debugging purposes.
This was set to false by default because logging these errors with normal browsing was a performance sink.
"Sometimes, the best way to get what you want is to be a good person." -- Louis Rossmann
"Seek wisdom, not knowledge. Knowledge is of the past; wisdom is of the future." -- Native American proverb
"Linux makes everything difficult." -- Lyceus Anubite

astewart
Moonbather
Moonbather
Posts: 53
Joined: 2013-12-19, 02:34
Location: San Diego, CA, US

Re: css errors in error console

Unread post by astewart » 2019-01-02, 17:02

Thank you. Works perfectly to set the pref, then reset to original, around the code in question.

Alan