Closed Bug 1420338 Opened 7 years ago Closed 7 years ago

Firefox is not finishing rendering of the preceding HTML, before executing javascript.

Categories

(Firefox :: Untriaged, defect)

57 Branch
defect
Not set
normal

Tracking

()

RESOLVED INVALID

People

(Reporter: bruinsmaarten, Unassigned)

Details

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.94 Safari/537.36

Steps to reproduce:

I have this:

    <!DOCTYPE html>
    <html>
    <head>
        <meta charset="utf-8" />
        <title>Test</title>
    </head>
    <body>
        One line of html code
        <script>
            // Synchronous delay of 5 seconds
            var timeWhile = new Date().getTime(); 
            while( new Date().getTime() - timeWhile < 5000 );
        </script>
    </body>

The orginal script is different, but i changed it to make it more clear.


Actual results:

Firefox is showing (rendering): "One line of html code" after 5 seconds and not within 5 seconds. 


Expected results:

Maybe this is not really a bug, because my expectations are not based on definitions, but what I would expect that the best solution is, in a case like this. 
So feel free to remove it if you think you need to.

For sure, you guys know much more about browsers than me, so maybe it's the best solution in this specific example, but conflicting with other examples. And maybe it's not possible at all, because of some technical reasons. Anyway i though it's worth mentioning it. I'm not 100% sure if this is the right place, so otherwise sorry.
Javascript is a synchronous(blocking) single thread language and before creating a bug report you should have at least test with other browsers to compare. It's very unlikely that you see a bug in a browser if all browser agree on the behavior.
Status: UNCONFIRMED → RESOLVED
Closed: 7 years ago
Resolution: --- → INVALID
I tested it in other browsers and i know it's also the case in for example Google Chrome. I also know that Javascript is a synchronous single thread language. But i saw it as follows:

When done rendering, the browser can start executing the JavaScript. So then it still can be single threaded and it still can be blocking. It's more about the moment of starting it (just some extra delay).

But anyway, if you know for sure it's not possible, then it's okay and you can forget about it. Then this is not the place to mention it, so sorry about that.
You need to log in before you can comment on or make changes to this bug.