Open Bug 1550838 Opened 7 months ago Updated 6 months ago

Firefox does not render certain web page ($(body).fadeIn() with body { display: none } rule)

Categories

(Core :: DOM: CSS Object Model, defect, P3)

x86_64
Windows 10
defect

Tracking

()

Tracking Status
firefox-esr60 --- wontfix
firefox66 --- wontfix
firefox67 --- wontfix
firefox67.0.1 --- wontfix
firefox68 --- affected
firefox69 --- affected

People

(Reporter: alice0775, Unassigned)

References

(Depends on 1 open bug, )

Details

(4 keywords)

Attachments

(1 file, 1 obsolete file)

Chrome, Edge(EdgeHTML) anf IE11 works as expected.
Firefox only fails. UA spoofing does not help.

Workaround(userContent.css or stylus(needs reload)):

@-moz-document domain("9x6x3.com") {
body { display: block !important; }
}

Reproducible: always

Steps to reproduce:

  1. Open https://9x6x3.com/

Actual results:
Blank page

Expected Results:
Page should be displayed

Emilio, is this something for you to look at?

Flags: needinfo?(emilio)
Attached file Reduced test-case. (obsolete) —

I'm happy to take a look. Here's a test-case. I haven't dug into what jquery is doing yet.

So this is a tough one to fix. This is because css_defaultDisplay("body") in the jquery source in:

https://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.js?ver=4.9.10

returns "none". More analysis coming.

Flags: needinfo?(emilio)
Comment on attachment 9064227 [details]
Test-case that shows the difference.

><!doctype html>
><style>
>  body { display: none }
></style>
><body>
><script>
>// Try to determine the default display value of an element
>function css_defaultDisplay( nodeName ) {
>  let iframe = document.body.appendChild(document.createElement("iframe"));
>
>  let iframeDoc = (iframe.contentWindow || iframe.contentDocument).document;
>  iframeDoc.write("<!doctype html><html><body>");
>  iframeDoc.close();
>
>  let elem = iframeDoc.body.appendChild( iframeDoc.createElement(nodeName) );
>  display = getComputedStyle(elem).display;
>  iframe.remove();
>  return display;
>}
>
>alert(css_defaultDisplay("body"));
></script>
Attachment #9064227 - Attachment mime type: text/plain → text/html

So basically, css_defaultDisplay there is what's going wrong. It's going wrong because jquery is appending the <iframe> to the body to ensure it's displayed, but it's not (since the body is display: none).

That means we have nowhere to grab the style from (see the longstanding bug 548397 and the cousin bug 1483798), and thus we do the next-thing-we-can-do which is returning the style from the outer document.

This site is using an ancient jQuery btw.

Anyhow, fixing bug 1483798 would fix this (we'd return the style from the display: none iframe).

We're in a somewhat better position to do it now.

Component: Untriaged → DOM: CSS Object Model
Depends on: 1483798
Priority: -- → P3
Product: Firefox → Core
See Also: → 1483798, 548397
Summary: Firefox does not render certain web page → Firefox does not render certain web page ($(body).fadeIn() with body { display: none } rule)

Err, I meant bug 1471231 above.

Depends on: 1471231
No longer depends on: 1483798
See Also: → 1471231
You need to log in before you can comment on or make changes to this bug.