Closed Bug 356503 Opened 18 years ago Closed 3 years ago

An @import to a slow-responding server in userChrome.css or userContent.css or the stylesheet service causes the application to hang at startup

Categories

(Core :: CSS Parsing and Computation, defect)

x86
Linux
defect
Not set
critical

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: jason.barnabe, Unassigned)

References

Details

(Keywords: hang)

Attachments

(1 file)

If you load a page that references a slow-responding server with an @import rule, the page won't load until the server responds or the application gives up (which takes at least 5 minutes), which isn't so bad because the user can stop the load, go to another tab, etc.

If you put it in userChrome or userContent or the stylesheet service at startup, the application UI won't come up until the server responds or the application gives up.

You can use http://userstyles.org/test/slow_css to test - it sleeps 20 seconds before responding to the request.
userChrome.css and userContent.css are loaded synchronously.  If anything, we should probably add code to prevent them from @importing remote style sheets.
And what about the stylesheet service?

Could we alternately lower the timeout for these types of calls to something like 5-10 seconds?
The stylesheet service also loads synchronously.  We could change that, probably...

I'm not sure whether there's a sane way to "time out" a synchronous Necko call... is there?
Attached file testcase
This seems to be fixed now that bug 84582 is fixed.
Not for the sync load case this bug is about...
Maybe @import rules could be given lower priority so they don't block anything. Let the other rules load around it and wait for the @import to finish before applying it.
That could be done, sure.  It's a fair it of work to restructure code like that given sheet cloning for user/UA sheets, and this is not a use case that's that important, imo.  But if someone who cares wants to do it, go for it.
Assignee: dbaron → nobody
QA Contact: ian → style-system
Can we have some news about this bug?

It stop the adoption of @import function for the addon Stylish and our Userstyles.....
I think the sanest thing to do here is to block @import of non-local urls from sync-loaded sheets.  It's clearly a bad idea to block startup for several seconds while you get stuff off some HTTP server... not to mention the fact that @import of an http:// URL from a user or worse yet UA stylesheet is a security hole.  (https:// is more ok to the extent that you trust the server.)
See Also: → 1280265

Following the reporter's steps I am able to confirm that the issues doesn't happen anymore on Ubuntu 20.04 on any of the current versions of Firefox Nightly 87.0a1 (2021-02-11), beta 86.0b9 and release 85.0.2 using the provided testcase. There are no hangs and the browser can be used without issues. The loading is done instantly.

Closing this issue as Resolved > Worksforme.
Feel free to re-open or file a new bug if this issue reoccurs again.

Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: