Closed Bug 245608 Opened 21 years ago Closed 21 years ago

CSS Stylesheet doesn't load

Categories

(Core :: Networking: HTTP, defect)

x86
Linux
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 227976

People

(Reporter: maciej.blizinski, Assigned: darin.moz)

References

()

Details

Attachments

(1 file)

User-Agent: Mozilla/5.0 (X11; U; Linux i686; pl-PL; rv:1.6) Gecko/20040207 Firefox/0.8 Build Identifier: Mozilla/5.0 (X11; U; Linux i686; pl-PL; rv:1.6) Gecko/20040207 Firefox/0.8 Alternate adress (you will be redirected anyway): https://pico.magnum2.pl/ecdb/index.php?LANG=en&level=1&struct=1 When opening the website, the browser renders HTML, but doesn't load CSS stylesheet. When I press reload, sometimes the stylesheet loads, and sometimes it doesn't, it's random. It mostly doesn't. It happens when Mozilla is used with Apache 2.0 over SSL. If I take the stylesheet's URL and paste it directly into the address bar, I see the CSS code. Alright. Now I go back to the website. This time the stylesheet is loaded and HTML renders with styles. Reproducible: Sometimes Steps to Reproduce: 1. Open the webpage, the stylesheet is probably not loaded 2. Press refresh, and it doesn't help 3. Find the stylesheet's URL (i.e. https://pico.magnum2.pl/ecdb/css/style.css), paste it into the address bar and see the code 4. Go back to the website and see that site renders with the stylesheet Actual Results: When just opening the webpage, it's rendered without stylesheet. You can see it to the right, on the labels over the login form fields. The characters are black, for instance. Expected Results: I expect the website to render with the stylesheet. The labels over login form fields should be green, as defined in the CSS stylesheet. As said above, it happens with Apache 2.0 with SSL. When not using SSL, stylesheets load correctly. It also happens with Apache 2.0 running locally, on the same computer. It happens with Mozilla 1.6 and Mozilla Firefox 0.8. The browser's behaviour is more or less random. Sometimes the stylesheet loads while browsing the website. In let's say 10th click it suddenly loads. And sometimes it doesn't load at all.
I think the real bug would be that it does load occassionally (although I can't reproduce) :S This is the script for loading the stylesheets: ---- if (browserVersion.nav6) { document.write('<link rel="stylesheet" type="text/css" href="css/style.css">'); } if (browserVersion.nav4up) { document.write('<link rel="stylesheet" type="text/css" href="css/style_n.css">'); } if (browserVersion.ie4up) { document.write('<link rel="stylesheet" type="text/css" href="css/style.css">'); } ---- The variable browserVersion is here: ---- /* function browserVersion() { var agt = navigator.userAgent.toLowerCase(); this.major = parseInt(navigator.appVersion); this.minor = parseFloat(navigator.appVersion); this.nav = ((agt.indexOf('mozilla')!=-1) && ((agt.indexOf('spoofer')==-1) && (agt.indexOf('compatible') == -1))); this.nav4up = this.nav && (this.major == 4); this.nav6 = this.nav && (this.major >= 5); this.navonly = (this.nav && (agt.indexOf(";nav") != -1)); this.ie = (agt.indexOf("msie") != -1); this.ie4up = this.ie && (this.major >= 4); this.ie5up = this.ie && (navigator.appVersion.indexOf('compatible; MSIE 5.0') != -1) this.opera = (agt.indexOf("opera") != -1); this.ver4up = (this.ie4up || this.nav4up ); } var browserVersion = new browserVersion(); */ --- As you can see, it is commented out resulting in browserVersion being undefined.
I changed the code so there's <link> tag directly in the <head> section. <script language="JavaScript" src="js/browser.js" type="text/javascript"></script> <link href="css/style.css" type="text/css"> </head> I still do reproduce.
I tried the test site, & had the same rendering errors. I couldn't repoduce the correct rendering by loading the CSS as explained in "Steps to Reproduce:"
Trying to find a workaround I removed HTTP compression from the server, and styles started loading. I prepared new location with http compression to restore previous environment, but unfortunately I can't reproduce the problem right now. New location: https://pico.magnum2.pl/stylebug/ecdb
Worksforme with a current Linux build. 1.6 is pretty old; could you possibly check in a recent build?
I can still reproduce with Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8a2) Gecko/20040608 Please be sure you're using this URL: https://pico.magnum2.pl/stylebug/ecdb/
Ah, OK. If I clear the cache and make sure I'm using HTTP/1.1 before loading the page, I do see the problem. An HTTP/CSSLoader log shows: 16386[8163568]: nsHttpTransaction [this=8982d08 count=8 read=8 mContentRead=706 mContentLength=706] .... 16384[8093130]: nsHttpChannel::OnDataAvailable [this=89d5db8 request=8abed60 offset=698 count=8] 16384[8093130]: skipping status notification [this=89d5db8 sink=0 pending=1 background=0] 16384[8093130]: ###!!! ASSERTION: OnDataAvailable implementation consumed no data: 'Error', file /home/bzbarsky/mozilla/xlib/mozilla/netwerk/base/src/nsInputStreamPump.cpp, line 458 16384[8093130]: ###!!! Break: at file /home/bzbarsky/mozilla/xlib/mozilla/netwerk/base/src/nsInputStreamPump.cpp, line 458 16384[8093130]: nsHttpChannel::OnStopRequest [this=89d5db8 request=8abed60 status=8000ffff] ... 16384[8093130]: SheetLoadData::OnStreamComplete 16384[8093130]: Load failed: status 2147549183, data stream 8961cf8 So all the CSSLoader knows is that necko returns an error status for the load... Note that the "OnDataAvailable implementation consumed no data" error will trigger a status of NS_ERROR_UNEXPECTED in the input stream pump. That's the status code that nsHttpChannel::OnStopRequest and SheetLoadData::OnStreamComplete both end up seeing. This looks like bug 227976, more or less. Marking dependent.
Assignee: dbaron → darin
Status: UNCONFIRMED → NEW
Component: Style System (CSS) → Networking: HTTP
Depends on: 227976
Ever confirmed: true
QA Contact: ian → core.networking.http
actually, this is a duplicate of bug 227976. my patch for that bug fixed this bug. *** This bug has been marked as a duplicate of 227976 ***
Status: NEW → RESOLVED
Closed: 21 years ago
Resolution: --- → DUPLICATE
Maciej: does this problem still happen?
QA Contact: core.networking.http → benc
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: