Closed Bug 442464 Opened 16 years ago Closed 16 years ago

User stylesheet not loading in Firefox 3

Categories

(Firefox :: Settings UI, defect)

x86
Windows Vista
defect
Not set
normal

Tracking

()

RESOLVED INVALID

People

(Reporter: h, Unassigned)

Details

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9) Gecko/2008052906 Firefox/3.0
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9) Gecko/2008052906 Firefox/3.0

In Firefox 2, I used the Accessibility toolbar to install a user stylesheet. That toolbar doesn't work in Firefox 3, so it's gone. Now my user styles don't work. I checked in about:config that accessext.styles.userStylesheet.enable is true and that accessext.styles.userStylesheet.text contains the correct CSS code, but Firefox is simply not applying it.

I tried using the Web Developer Toolbar, but when I turn Persist mode on, it prompts me for the location of my CSS file every time I load a new page, so that's no good.

Here's the original CSS:

/* Distinguish visited links at www.washingtonpost.com */

@-moz-document domain("www.washingtonpost.com") {
  a:visited {
    color: purple ! important;
  }
}

@-moz-document domain("newsweek.washingtonpost.com") {
  a:visited {
    color: purple ! important;
  }
}

body #comics_wrapper2 a:visited {
	color: purple ! important;
}

I created this because washingtonpost.com, amazingly, styles its links NOT to turn color after being visited, so that I can't tell which articles I've read already.

This is exactly the code I found at accessext.styles.userStylesheet.text (except that the line breaks had been stripped out).

I also tried an instruction I found to name my CSS file as userContent.css and to put it into my Firefox profile directory, but it was still ignored.

To troubleshoot, I replaced the stylesheet and the setting at accessext.styles.userStylesheet.text with much simpler CSS and tried it out on a simple web page to show that it wasn't just a matter of looking at pages where new markup was interfering with assumptions about the cascade, but it really just isn't being used. Even Firebug doesn't indicate that my user stylesheet is being used.


Reproducible: Always

Steps to Reproduce:
1.
2.
3.
To be more specific about my follow-up test, I just put the following CSS into the accessext.styles.userStylesheet.text property in my Firefox 3:

body { font-style: italic; } a:link { text-decoration: none; color: green; } a:visited { text-decoration: none; color: magenta; }

My test HTML file looks like this:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>

	<head>
		<title>User CSS Test</title>
	</head>

	<body>
		<p>I just put the following CSS into the accessext.styles.userStylesheet.text property in my Firefox 3:</p>
		<p>body { font-style: italic; } a:link { text-decoration: none; color: green; } a:visited { text-decoration: none; color: magenta; }</p>
		<p>Here's a <a href="http://www.mozilla.org/">link to Mozilla</a>. All this text should be in italics, and the link should be green or magenta (at least, when the focus or hover isn't on it).</p>
	</body>

</html>

The text is not in italics and the link is still blue or purple, not green or magenta.
accessext.styles.userStylesheet.text looks like something used by the Accessibility Toolbar extension (https://addons.mozilla.org/en-US/firefox/addon/5809).  If the extension isn't working, that preference won't work either.  Try using Stylish instead for now (https://addons.mozilla.org/en-US/firefox/addon/2108).
Status: UNCONFIRMED → RESOLVED
Closed: 16 years ago
Resolution: --- → INVALID
Until now I had no reason to think that the Accessibility Toolbar's functionality in this area was anything other than a wrapper around a built-in Firefox feature. If Firefox has never had a user stylesheet feature natively, I'm astonished and frankly appalled!
Oh, and thanks for pointing me to Stylish.
Firefox does have native user stylesheet features: usercontent.css and nsStyleSheetService.  I believe Stylish uses the latter, and I hope the Accessibility Toolbar does as well.
I tried usercontent.css before and just tried it again. I put it into my Firefox profiles in both the Local and Roaming sections. No good. If it *is* supposed to work, well, it isn't, so either the instructions are incomplete or I've missed something or there's a bug after all.
You have to put usercontent.css in the chrome subdirectory of your Firefox profile directory.  There should be a "usercontent-example.css" file there.
Ah. Either I'd overlooked that or it wasn't in the resource where I'd learned about usercontent.css. Thanks.
You need to log in before you can comment on or make changes to this bug.