Closed
Bug 659650
Opened 14 years ago
Closed 14 years ago
loadAndRegisterSheet fails if CSS contains #id
Categories
(Core :: CSS Parsing and Computation, defect)
Tracking
()
VERIFIED
INVALID
People
(Reporter: alice0775, Unassigned)
References
Details
(Keywords: regression)
Build Identifier:
http://hg.mozilla.org/mozilla-central/rev/836aa9658341
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:2.0.2) Gecko/20110508 Firefox/7.0a1 ID:20110525030704
loadAndRegisterSheet fails if CSS contains #id
Reproducible: Always
Steps to Reproduce:
1. Start Nightly/7.0a1 with clean profile
2. Enable App Button (Windows7 default)
3. Open Error Console(Ctrl+Shift+j)
4. Evaluate the following code (Copy and Paste into textbox and click Evaluete)
var cssURL = "data:text/css,@namespace%20url(http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul);#appmenu-button{color:red!important;}";
var u = Components.classes["@mozilla.org/network/io-service;1"]
.getService(Components.interfaces.nsIIOService)
.newURI(cssURL, null, null);
Components.classes["@mozilla.org/content/style-sheet-service;1"]
.getService(Components.interfaces.nsIStyleSheetService)
.loadAndRegisterSheet(u,
Components.classes["@mozilla.org/content/style-sheet-service;1"]
.getService(Components.interfaces.nsIStyleSheetService)
.USER_SHEET);
Actual Results:
CSS load fails
Label of AppBottun color is not changed to red.
Expected Results:
CSS load success.
You can see label of AppBottun color should be changed to red.
![]() |
Reporter | |
Comment 1•14 years ago
|
||
Regression window:(m-c hourly):
Works:
http://hg.mozilla.org/mozilla-central/rev/bb5904c365a2
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:2.0.2) Gecko/20110508 Firefox/6.0a1 ID:20110524030614
Fails:
http://hg.mozilla.org/mozilla-central/rev/89f5c8191f3b
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:2.0.2) Gecko/20110508 Firefox/6.0a1 ID:20110524034306
Pushlog:
http://hg.mozilla.org/mozilla-central/pushloghtml?fromchange=bb5904c365a2&tochange=89f5c8191f3b
Suspected Bug:
Bug 658949 - data URL with hash - content doesn't match location.
Comment 2•14 years ago
|
||
> var cssURL = "data:text/css,@namespace%20url(http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul);#appmenu-button{color:red!important;}";
'#' must be percent-encoded if it is a part of the content.
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → INVALID
![]() |
Reporter | |
Comment 3•14 years ago
|
||
Yes, I think so,
Previous version of Firefox is wrong.
Status: RESOLVED → VERIFIED
Updated•14 years ago
|
tracking-firefox7:
? → ---
Comment 4•14 years ago
|
||
Could this change be noted on the "Firefox 6 for developers" or "Updating add-ons for Firefox 6" MDN pages?
https://developer.mozilla.org/en/Firefox_6_for_developers
https://developer.mozilla.org/en/Firefox/Updating_add-ons_for_Firefox_6
This change broke an extension of mine pretty badly because I had (incorrectly) left hash symbols in the data URI. If it was noted on the above pages it would've saved me a lot of time spent narrowing down what the bug was and searching for it here. I'm sure loadAndRegisterSheet is used in other extensions for little hacks as above without passing the content through encodeURIComponent.
Comment 5•13 years ago
|
||
I spent a week trying to figure out why this fails in Firefox 10. No errors in the Error Console, absolutely nothing to indicate why StyleSheetService was getting hung up on #ids.
The docs on MDN definitely need to be updated to reflect this:
https://developer.mozilla.org/en/Using_the_Stylesheet_Service
For anyone else stumbling across this problem, the following works:
var uri = ios.newURI(encodeURIComponent(myStyleSheet), null, null);
sss.loadAndRegisterSheet(uri, sss.USER_SHEET);
You need to log in
before you can comment on or make changes to this bug.
Description
•