Modernizr / Modernizr

Modernizr is a JavaScript library that detects HTML5 and CSS3 features in the user’s browser.
https://www.npmjs.com/package/modernizr
MIT License
25.65k stars 2.97k forks source link

Custom modernizr builds crash IE8 #332

Closed thasmo closed 12 years ago

thasmo commented 13 years ago

We have experienced that custom, compressed modernizr builds crash IE8, resulting in showing this address in the addressbar: res://ieframe.dll/acr_error.html/#

This is not happening in the compat modes of IE7 or IE8 in IE9.

Unfortunately we can't really test this any further as we don't have a machine with IE8 installed. The machine we experienced this on, was a Windows XP machine of one of our partner companies.

Using the uncompressed development version does work without errors: http://www.modernizr.com/downloads/modernizr-2.0.6.js

dottodot commented 13 years ago

I have the same problem, if I use the uncompressed version I do not have this issue.

I have ie8 to test on but not sure how to find whats causing the problem.

gordonbrander commented 13 years ago

Having the same issue with the following build in IE 8.0.6.001.18702/XP:

/* Modernizr 2.0.6 (Custom Build) | MIT & BSD
 * Contains: iepp | respond | mq | cssclasses | teststyles
 */

I have not yet tested with other builds.

gordonbrander commented 13 years ago

Update: also tested it with a full build using the generator:

/* Modernizr 2.0.6 (Custom Build) | MIT & BSD
 * Contains: fontface | backgroundsize | borderimage | borderradius | boxshadow | flexbox | hsla | multiplebgs | opacity | rgba | textshadow | cssanimations | csscolumns | generatedcontent | cssgradients | cssreflections | csstransforms | csstransforms3d | csstransitions | applicationcache | canvas | canvastext | draganddrop | hashchange | history | audio | video | indexeddb | input | inputtypes | localstorage | postmessage | sessionstorage | websockets | websqldatabase | webworkers | geolocation | inlinesvg | smil | svg | svgclippaths | touch | webgl | iepp | respond | mq | cssclasses | addtest | prefixed | teststyles | testprop | testallprops | hasevent | prefixes | domprefixes | load
 */

Update: this is almost certainly related: https://github.com/scottjehl/Respond/issues/27.

I removed Modernizr from my page in order to test, and added HTML5 Shiv + Respond.js instead. WIth respond.js, the page throws this error in IE 8.0.6.001.18702/XP. Without, it's fine.

Update 2: The issue definitely seems to be related to respond.js for me. Built the following:

/* Modernizr 2.0.6 (Custom Build) | MIT & BSD
 * Contains: iepp | cssclasses | load
 */

...and it runs no problem in IE8/XP. Adding respond.js to the build throws the error.

paulirish commented 13 years ago

hmmmmm @scottjehl we got a problem it seems.

thasmo commented 13 years ago

Any progress on this? Wondering where I can get a Win XP version for testing this. :|

thasmo commented 13 years ago

Oops. oO The GUI mocked me. oO

plockc commented 13 years ago

There is a comment with 8 bit bytes near the method

tests['csstransforms3d']

that has what I'm guessing is a Microsoft "smart-quote"

We experience crashes of IE8 when we do not set a charset when serving this file (like running under lighttpd)

our fix: remove the comment

paulirish commented 13 years ago

@plockc you've built this version recently? can you give us the top of the file which has what tests are in the build?

paulirish commented 13 years ago

remove what comment?

plockc commented 13 years ago

(sorry for all the edits, trying to figure out the code delimiters)

I didn't see what looked like a list of tests (sorry, I'm helping the markup guys, I don't use the library myself), but here is the version:

/*!
 * Modernizr v2.0.6
 * http://www.modernizr.com
 *
 * Copyright (c) 2009-2011 Faruk Ates, Paul Irish, Alex Sexton
 * Dual-licensed under the BSD or MIT licenses: www.modernizr.com/license/
 */

Asking the markup guy that got it, it should be a full build, pulled from here: http://www.modernizr.com/downloads/modernizr-2.0.6.js

which I verify to have the same 8 bit bytes

The comment is here:

    tests['csstransforms3d'] = function() {

        var ret = !!testProps(['perspectiveProperty', 'WebkitPerspective', 'MozPerspective', 'OPerspective', 'msPerspective']);

        // Webkit<89>۪s 3D transforms are passed off to the browser's own graphics renderer.
        //   It works fine in Safari on Leopard and Snow Leopard, but not in Chrome in
        //   some conditions. As a result, Webkit typically recognizes the syntax but
        //   will sometimes throw a false positive, thus we must do a more thorough check:
        if ( ret && 'webkitPerspective' in docElement.style ) {

          // Webkit allows this media query to succeed only if the feature is enabled.
          // `@media (transform-3d),(-o-transform-3d),(-moz-transform-3d),(-ms-transform-3d),(-webkit-transform-3d),(modernizr){ ... }`
          ret = Modernizr['csstransforms3d'];
        }
        return ret;
    };

the first line of the comment should have been "WebKit's" I assume

Here is a test I use (found a high byte in jQuery 1.6.4.min with it as well):

hexdump -v -e '1/1 "%02X" "\n"' modernizr.js   | awk '/^[8-9A-F]/ {print NR " " $0} /[0-7]?/ {}'

Checking the latest from github, someone appears to be editing source code with a "smart quotes" editor and saving the file in UTF-8 (I think), there are many high byte sequences, for example hex E2 80 99 is a right single quote:

curl -o modernizr.js https://github.com/Modernizr/Modernizr/blob/master/modernizr.js

hexdump -v -e '1/1 "%02X" "\n"' modernizr.js   | awk '/^[8-9A-F]/ {print NR " " $0} /[0-7]?/ {}'

(each line of output is a decimal offset and the byte value in hex)
14516 E2
14517 86
14518 91

14557 E2
14558 86
14559 93

15842 E2
15843 80
15844 A6

171271 E2
171272 80
171273 99

286370 E2
286371 86
286372 90

286520 E2
286521 86
286522 92

286671 E2
286672 86
286673 91

286819 E2
286820 86
286821 93

287169 E2
287170 86
287171 90

287343 E2
287344 86
287345 92

287518 E2
287519 86
287520 91

287690 E2
287691 86
287692 93
paulirish commented 13 years ago

thank you so much for the detail @plockc

lode commented 12 years ago

I'am also having the issue of a 'crashing' IE8. The tab crashes and show indeed res://ieframe.dll/acr_error.html/#domain.ext,http://www.domain.ext/.

I'am using the minified version (from the html5 boilerplate) and can't find the comment in my modernizr source which is changed in the previous commit. Is this really all needed to fix this issue? To me it seems this won't help.

paulirish commented 12 years ago

@lode i would also get a minified version that does not include respond.js

lode commented 12 years ago

@paulirish but it seems to me that I do need respond.js.

(Right now I've been able to "solve" it by using the development version of modernizr and minify it myself via jscompress.com. This one doesn't crash.)

paulirish commented 12 years ago

you dont need respond.js.. you can do mobile-first MQs and get IE support with a conditional comments and two css files.

interesting bug though. :o

thasmo commented 12 years ago

Does this bug depend on shipping modernizr 2.1? Will it be fixed? Thanks guys!

whereisaaron commented 12 years ago

One data point for sufferers; We found that the attribute that triggered the IE crashes when combined with Modernizr was related to 'print' vs 'screen' style sheets 'media' attribute. We found that is you explicitly say 'screen' (which as you know is the default anyway) that leads to the IE crash. Here is the versions offending line:

1) <link rel="stylesheet" href="/css/style.css"> --> No crash 2) <link rel="stylesheet" href="/css/style.css" media="print"> --> No crash 3) <link rel="stylesheet" href="/css/style.css" media="screen"> --> Crash!

We found if we avoid (3) we could avoid the IE crashes.

We have not used @import but with do use @media, e.g. '@media only screen and (min-width: 480px)' CSS files that do not use @import or @media do not trigger the problem, even if you do explicitly specify 'media="screen"'.

Aaron.

paulirish commented 12 years ago

aaron fwiw this is a respond.js bug.

scottjehl commented 12 years ago

and a fixed one at that! :)

(but if you run into issues with it, please take the discussion over here: https://github.com/scottjehl/Respond/issues/ )

On Jan 31, 2012, at 9:27 AM, Paul Irish wrote:

aaron fwiw this is a respond.js bug.


Reply to this email directly or view it on GitHub: https://github.com/Modernizr/Modernizr/issues/332#issuecomment-3732390

whereisaaron commented 12 years ago

Excellent Scott, glad this problem is fixed, but this problem was reported with 2.0.6 and I believe there hasn't been a release of Modernizr since the fix. So people using the current release version from http://www.modernizr.com/ (still 2.0.6 as of today) are still as far as I know getting the old version of Media Queries portion with this problem? [ Of course since IE7/IE8 crash and burn the really problem it with IE and of course will probably never be fixed :-( ]

scottjehl commented 12 years ago

I'm fairly certain the Modernizr team has pulled Respond.js out of their builder, so you'll have to include it manually from the Respond.js repo. You should find that this problem no longer exists

I'm not sure exactly what the "media queries" checkbox does in there currently. Paul?

On Feb 1, 2012, at 2:09 AM, whereisaaron wrote:

Excellent Scott, glad this problem is fixed, but this problem was reported with 2.0.6 and I believe there hasn't been a release of Modernizr since the fix. So people using the current release version from http://www.modernizr.com/ (still 2.0.6 as of today) are still as far as I know getting the old version of Media Queries portion with this problem? [ Of course since IE7/IE8 crash and burn the really problem it with IE and of course will probably never be fixed :-( ]


Reply to this email directly or view it on GitHub: https://github.com/Modernizr/Modernizr/issues/332#issuecomment-3745720

paulirish commented 12 years ago

i thinkkkkkkkk it adds a

Modernizr.mediaqueries = Modernizr.mq('only all'); to your file. I think.

scottjehl commented 12 years ago

Oh okay - it's a support test. Right on. Thanks, Paul.

On Feb 1, 2012, at 7:30 AM, Paul Irish wrote:

i thinkkkkkkkk it adds a

Modernizr.mediaqueries = Modernizr.mq('only all'); to your file. I think.


Reply to this email directly or view it on GitHub: https://github.com/Modernizr/Modernizr/issues/332#issuecomment-3751281

donaldjenkins commented 12 years ago

I'm getting the crash in IE 6/7/8 with a Modernizr 2.5.2 custom build (was not getting it with Modernizr 2.0.6).

scottjehl commented 12 years ago

Respond.js is no longer included in Modernizr's builder, so I'm not sure of the problem you're encountering here.

If it's a respond.js bug, please file it in the tracker over at https://github.com/scottjehl/Respond/issues

Thanks!

On Feb 8, 2012, at 11:07 PM, Donald Jenkins wrote:

I'm getting the crash in IE 6/7/8 with a Modernizr 2.5.2 custom build (was not getting it with Modernizr 2.0.6).


Reply to this email directly or view it on GitHub: https://github.com/Modernizr/Modernizr/issues/332#issuecomment-3869993

SherriAlexander commented 12 years ago

I echo astorg's comment; just upgraded a site I've been working on to modernizr 2.5.2, and started getting hard crashes in IE 8. Went back to 2.0.6 and no crashes. I don't think respond.js is involved, as my custom build did not include it.

Here is the custom build I was using in case it helps track down the problem:

Modernizr 2.5.2 (Custom Build) | MIT & BSD Build: http://www.modernizr.com/download/#-fontface-generatedcontent-input-inputtypes-shiv-cssclasses-teststyles-load

donaldjenkins commented 12 years ago

Oh, so I'm not alone. Yup—it can't be respond.js as it's no longer included. So surely wouldn't make sense to file a bug in the respond.js issues tracker. My build, in case that helps, is:

http://www.modernizr.com/download/#-borderradius-boxshadow-opacity-video-inputtypes-shiv-cssclasses-testprop-testallprops-prefixes-domprefixes-load

KuraFire commented 12 years ago

Are any of the people who are seeing crashes since 2.5.2 using Typekit? If so, see #308 for a potential fix. cc @astorg @SherriAlexander

SherriAlexander commented 12 years ago

I'm using some custom fonts via @font-face, but not using Typekit on this project.

scottjehl commented 12 years ago

Not sure if Modernizr is injecting any CSS into style elements like I do in Respond.js but if so, many of the IE instability issues in Respond were resolved by appending style elements to the DOM before populating them with styles. Before, I had all style elements populated and appended at once via document fragment, which I thought would've been faster, but caused other problems, like crashing if the HTML element had a background image. It also helped smooth out a @font-face issue in IE.

If that's all irrelevant here, just disregard, but I figured I'd mention it.

On Feb 9, 2012, at 9:48 AM, Sherri Alexander wrote:

I'm using some custom fonts via @font-face, but not using Typekit on this project.


Reply to this email directly or view it on GitHub: https://github.com/Modernizr/Modernizr/issues/332#issuecomment-3881001

donaldjenkins commented 12 years ago

I'm using Typekit so that's the likely reason (though, again, no issues with 2.0.6). What fix are you suggesting: calling Typekit before Modernizr, using html5.shivMethods = false;, or using:

test: Modernizr.fontface, yep: 'http://use.typekit.com/ypq0ypv.js', callback: function () { html5.shivMethods = false; // IE6 and 7 crash without this line try { Typekit.load(); } catch(e){} }

Using test: Modernizr.fontfacewould require adding in a scenario for browsers that don't support @fontface: seems overkill if one of the otrher solutions works.

KuraFire commented 12 years ago

@astorg The issue is that html5.shivMethods does the "innerShiv" functionality a little bit too aggressively for oldIE as of the new html5shiv 3.x (I think 3.x, anyway). Typekit uses that functionality but when something is already attached to the DOM and you change it, oldIE goes kaput.

The specific Modernizr.load / yepnope setup that I'm using is irrelevant here. You just need to set html5.shivMethods to false before the Typekit.load(); call to fix it, however you have your setup. Keep in mind that this is very much a temporary workaround !

donaldjenkins commented 12 years ago

@KuraFire: Gotcha! I'll try that. Alternatively, I might just stick with 2.0.6, pending a more permanent fix. The main benefit of 2.5, for me, is speed (it does load faster in non-IE browsers). When you say temporary, what time frame are you talking about?

KuraFire commented 12 years ago

@astorg Alex, Alexander et al are pretty on top of it, it seems. I can't speak for them or make any guarantees, but at the rate of fixes of late, I'd say only a matter of days.

donaldjenkins commented 12 years ago

@KuraFire Cool, I think I'll hold off pending a more permanent fix. Thanks for the prompt response!

SherriAlexander commented 12 years ago

I will try to do some more debugging and narrow it down to a culprit in my case, but I have to tame my raging project deadlines first. :)

ryanve commented 12 years ago

I got the IE8 acr error when I upgraded the Modernizr build to 2.5.2 on two sites. Here's a screenshot. On responsejs.com it hit the error as soon the page opened. On virtualmusic.tv it hit the error after clicking a link. No Typekit in either case, and no respond.js when I tested it. I tried several different builds and I think it's isolated to the something in the new shiv. I have a computer that can test this if needed. modernizr.com/download/#-shiv-cssclasses causes acr error modernizr.com/download/#-cssclasses-load works fine

zdennis commented 12 years ago

We are experiencing this with shiv's alone in 2.5.2: http://www.modernizr.com/download/#-shiv

zdennis commented 12 years ago

If I don't include html5shiv but I include most other things the problem doesn't happen. Separately adding in http://code.google.com/p/html5shiv/ seems to keep everything happy.

zdennis commented 12 years ago

To update, this issue happened on IE8 on Windows XP in Vmware Fusion. A colleague loaded in in IE8 on Windows 7 in Parallels and didn't experience any issues.

SherriAlexander commented 12 years ago

In case it's OS-related, my issue also occurs in IE8 on Windows XP in Parallels.

To update, this issue happened on IE8 on Windows XP in Vmware Fusion. A colleague loaded in in IE8 on Windows 7 in Parallels and didn't experience any issues.


Reply to this email directly or view it on GitHub: https://github.com/Modernizr/Modernizr/issues/332#issuecomment-3914382

Sherri Alexander Front-End Web Developer sherri@sherri-alexander.com http://www.sherri-alexander.com

agross commented 12 years ago

I see the issue with IE 8 on Windows Server 2003 R2 SP2 (base OS is similar to XP) as well.

Using the Modernizer 2.5.2 build without customizations (just html5shiv, load and the CSS classes without prefix). I don't use respond.js.

I've created a little reproduction over here: agross/modernizr-bug-332@cad5b14

Krinkle commented 12 years ago

The custom Modernizer 2.5.2 build that ships with the latest version of the HTML5 Boilerplate is also causing complete browser shutdown crashes in IE8 on XP for me.

Please for this as soon as possible, reverting to 2.0.6 now.

After re-trying a couple of times, sometimes the browser doesn't crash but instead tries to re-load it a couple of times after failed attempts and eventually ends up at a url like res://ieframe.dll/acr_error.htm# *(domain, url). Also during the reloads it's showing a tooltip in the IE8 tab saying "This tab has been recovered".

paulirish commented 12 years ago

reopening.

@aFarkas could you look at agross's testcase?

aFarkas commented 12 years ago

Yeah, I will look into this issue. Just downloaded the testcase and I can reproduce the issue. Will work on this tomorrow :-)

dmethvin commented 12 years ago

This seems very similar to http://bugs.jquery.com/ticket/9823 FWIW.

aFarkas commented 12 years ago

@dmethvin

Yeah, I'm pretty sure that this is the reason for this bug. Will look later into this and let you know.

scottjehl commented 12 years ago

Same bug used to occur with Respond.js. This change fixed it. https://github.com/scottjehl/Respond/commit/8016973743906889fa021a4d22624d0f1cf5953e

aFarkas commented 12 years ago

@dmethvin and @scottjehl

Yes it turns out this was the bug. It came from html5shiv. Actually the fakeBody isn't really needed, because we tested wether a element with a hidden property is display: none. In fact all known browsers, which have implemented the hidden property also have implemented the corresponding style. So easy to fix + less code

necolas commented 12 years ago

@scottjehl FYI: This is the fix used by jQuery - http://bugs.jquery.com/ticket/9823

@aFarkas The bug is still present in Modernizr (#501) due to a fake body being used in the tests, but looks like it can be fixed with the same fix the jQuery project used (worked for me). Thanks