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.66k stars 2.98k forks source link

Flash test throws warning in FF #1187

Closed sp00n closed 10 years ago

sp00n commented 10 years ago

I've built the new 3.0.0pre JS file with the default settings, and I'm receiving a JavaScript warning in Firefox 26 for Line 5004:

Media resource data:video/mp4;base64,AAAA [...] could not be decoded.
activex = 'Pan' in new window.ActiveXObject('ShockwaveFlash.ShockwaveFlash');

It doesn't actually matter if Flash is installed (resp. activated) or not, the error will be thrown either way. It doesn't in any way affect the recognition of flash though, that's working just fine, it's just some minor nuisance.

patrickkettner commented 10 years ago

@sp00n im real sorry for the annoyance. Those are actually two different tests (the first line is from videoautoplay, the second is from flash).

However, I am not able to replicate it.

11:22:40.644 GET http://localhost:8000/test/ [HTTP/1.0 200 OK 1ms]
11:22:39.528 Unknown property 'column-count'.  Declaration dropped. test:27
11:22:40.645 GET http://localhost:8000/test/qunit/qunit.css [HTTP/1.0 200 OK 1ms]
11:22:40.645 GET http://localhost:8000/dist/modernizr-build.js [HTTP/1.0 200 OK 2ms]
11:22:40.646 GET http://localhost:8000/test/js/lib/polyfills.js [HTTP/1.0 200 OK 3ms]
11:22:40.646 GET http://localhost:8000/test/js/lib/detect-global.js [HTTP/1.0 200 OK 4ms]
11:22:40.646 GET http://localhost:8000/test/qunit/qunit.js [HTTP/1.0 200 OK 4ms]
11:22:40.647 GET http://localhost:8000/test/js/lib/jquery-1.7b2.js [HTTP/1.0 200 OK 7ms]
11:22:40.647 GET http://localhost:8000/test/js/lib/jsonselect.js [HTTP/1.0 200 OK 6ms]
11:22:40.647 GET http://localhost:8000/test/js/lib/uaparser.js [HTTP/1.0 200 OK 5ms]
11:22:40.648 GET http://localhost:8000/test/js/setup.js [HTTP/1.0 200 OK 5ms]
11:22:40.648 GET http://localhost:8000/test/js/unit.js [HTTP/1.0 200 OK 5ms]
11:22:40.648 GET http://localhost:8000/test/js/unit-caniuse.js [HTTP/1.0 200 OK 4ms]
11:22:40.649 GET http://localhost:8000/test/js/dumpdata.js [HTTP/1.0 200 OK 0ms]
11:22:39.550 Unknown property '-moz-border-radius'.  Declaration dropped. qunit.css:42
11:22:39.550 Unknown property '-moz-border-radius'.  Declaration dropped. qunit.css:117
11:22:39.550 Unknown property '-moz-border-radius'.  Declaration dropped. qunit.css:194
11:22:39.568 Unknown pseudo-class or pseudo-element '-webkit-scrollbar'.  Ruleset ignored due to bad selector. test:1
11:22:39.568 Unknown pseudo-class or pseudo-element '-moz-scrollbar'.  Ruleset ignored due to bad selector. test:1
11:22:39.568 Unknown pseudo-class or pseudo-element '-o-scrollbar'.  Ruleset ignored due to bad selector. test:1
11:22:39.568 Unknown pseudo-class or pseudo-element '-ms-scrollbar'.  Ruleset ignored due to bad selector. test:1
11:22:39.568 Unknown pseudo-class or pseudo-element 'scrollbar'.  Ruleset ignored due to bad selector. test:1
11:22:39.585 Error in parsing value for 'width'.  Declaration dropped. test
11:22:39.587 Expected 'none' or URL but found 'blur('.  Error in parsing value for 'filter'.  Declaration dropped. test
11:22:39.587 Unknown property '-moz-filter'.  Declaration dropped. test
11:22:39.588 Error in parsing value for 'background-image'.  Declaration dropped. test
11:22:39.588 Expected color but found 'left'.  Error in parsing value for 'background-image'.  Declaration dropped. test
11:22:39.588 Unknown property '-moz-opacity'.  Declaration dropped. test
11:22:39.588 Error in parsing value for 'position'.  Declaration dropped. test
11:22:39.605 Expected media feature name but found 'touch-enabled'. test:1
11:22:39.605 Expected media feature name but found '-webkit-touch-enabled'. test:1
11:22:39.605 Expected media feature name but found '-o-touch-enabled'. test:1
11:22:39.605 Expected media feature name but found '-ms-touch-enabled'. test:1
11:22:39.605 Expected media feature name but found 'heartz'. test:1
11:22:40.618 "Total number of global properties: 3" detect-global.js:131
11:22:40.618 [object Object] detect-global.js:132
11:22:40.662 Unknown property 'text-justification'.  Declaration dropped. test
11:22:40.694 Unknown property 'hyphens'.  Declaration dropped. test
11:22:40.994 GET http://caniuse.com/jsonp.php [HTTP/1.1 200 OK 436ms]

That being said, there really isn't anything to do here. Modernizr creates a number of logging statements as it trys to test things. Since you said it is causing no issue, and the test works as expected, I am going to close this out.

Thanks for the report!

stucox commented 10 years ago

Might this mean the videoautoplay test is failing though?

We only try the MP4 if Modernizr.video.h264 is true, so if FF says it supports H264 but can’t decode that video, is the video we’re using unsuitable? I remember we changed it to suit iOS7, but maybe that broke it for FF (or more specifically, whichever codec is installed on @sp00n’s machine)

sp00n commented 10 years ago

Hm, videoautoplay is set to false indeed. I'm using ffdshow x64 on Win7 x64 to play h264 videos, though I don't know if Firefox is using that as well.

I just decoded the string and saved it as a file. It's not playing in FF ("Video can't be played because the file is corrupt"). It plays fine in VLC, but does not in Windows Media Player.

I re-encoded the file with Handbrake, and the new version both plays in FF and the JS warning is gone. videoautoplay is now also set to true.

I do now sometimes receive a TypeError: elem.parentNode is null error in line 7289 though...

var testAutoplay = function(called) {
   clearTimeout(timeout);
   elem.removeEventListener('playing', testAutoplay);
   addTest('videoautoplay', called || elem.currentTime !== 0);
   elem.parentNode.removeChild(elem);
}; 

elem.parentNode.removeChild(elem); is throwing the error, which seems to happen after I delete the cache, resp. delete the cache and close the browser. But even then it's not 100% reliable to reproduce.

Also, is it on purpose that the <video> element for this check is added to the <html> element, instead of the <body>? When this error appears, the function seems to be called twice. The first time correctly shows the <html> element as the parentNode, whereas on the second time it's simply null.

Below is the re-encoded video file, which might or might not work in iOS7. I've had good results with the settings I used in iOS6 at least.

elem.src = 'data:video/mp4;base64,AAAAHGZ0eXBtcDQyAAAAAG1wNDJpc29tYXZjMQAAA3Ftb292AAAAbG12aGQAAAAAzvru2c767tkAAV+QAAEk+AABAAABAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAAGGlvZHMAAAAAEICAgAcAT////3//AAACdnRyYWsAAABcdGtoZAAAAAH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vZGVjIC0gQ29weWxlZnQgMjAwMy0yMDEzIC0gaHR0cDovL3d3dy52aWRlb2xhbi5vcmcveDI2NC5odG1sIC0gb3B0aW9uczogY2FiYWM9MCByZWY9MyBkZWJsb2NrPTE6MDowIGFuYWx5c2U9MHgxOjB4MTExIG1lPWhleCBzdWJtZT03IHBzeT0xIHBzeV9yZD0xLjAwOjAuMDAgbWl4ZWRfcmVmPTEgbWVfcmFuZ2U9MTYgY2hyb21hX21lPTEgdHJlbGxpcz0xIDh4OGRjdD0wIGNxbT0wIGRlYWR6b25lPTIxLDExIGZhc3RfcHNraXA9MSBjaHJvbWFfcXBfb2Zmc2V0PS0yIHRocmVhZHM9NiBsb29rYWhlYWRfdGhyZWFkcz0xIHNsaWNlZF90aHJlYWRzPTAgbnI9MCBkZWNpbWF0ZT0xIGludGVybGFjZWQ9MCBibHVyYXlfY29tcGF0PTAgY29uc3RyYWluZWRfaW50cmE9MCBiZnJhbWVzPTAgd2VpZ2h0cD0wIGtleWludD0zMDAga2V5aW50X21pbj0zMCBzY2VuZWN1dD00MCBpbnRyYV9yZWZyZXNoPTAgcmNfbG9va2FoZWFkPTQwIHJjPWNyZiBtYnRyZWU9MSBjcmY9MjAuMCBxY29tcD0wLjYwIHFwbWluPTAgcXBtYXg9NjkgcXBzdGVwPTQgdmJ2X21heHJhdGU9MTQwMDAgdmJ2X2J1ZnNpemU9MTQwMDAgY3JmX21heD0wLjAgbmFsX2hyZD1ub25lIGlwX3JhdGlvPTEuNDAgYXE9MToxLjAwAIAAAAAcZYiEFfHEf/hOBwACwAAgGyy/gcAAyAAIBwA1lwAAAAVBmjgrqAAAAAVBmlQK6gAAAAVBmmBnUAAAAAVBmoB3UA==';
patrickkettner commented 10 years ago

@sp00n what is the hash of the build you were using? I am not able to replicate that issue either.

@stucox we still haven't changed it for ios7. haven't been able to reencode it yet.

sp00n commented 10 years ago

what is the hash of the build you were using?

That's actually a good question, I don't know and wasn't able to find anything in the files.

I downloaded the master zip file on the 11th Jan though, around 2am CEST, if that's any help.

patrickkettner commented 10 years ago

Where did you downoad it from?

sp00n commented 10 years ago

The main page, https://github.com/Modernizr/Modernizr (https://github.com/Modernizr/Modernizr/archive/master.zip)

patrickkettner commented 10 years ago

great, thanks!

Could you also include the firefox build and OS you are using?

cheers

sp00n commented 10 years ago

Win7 x64 SP1, and tested on Firefox 23.0.1 and Waterfox 26.0. Btw, Chrome doesn't display any warning, and its autoplay value is set to true.

// Edit Aaaand I clicked on Comment & Close...

patrickkettner commented 10 years ago

I can't replicate this :/

I created this test case that is just the current master, and ran it in in firefox 23, and I don't get any errors - can you test and see if you are still?

sp00n commented 10 years ago

Still showing up on Win7 x64 / Waterfox 26.0 and Firefox Portable 23.0.1. In FF23 I also receiving the following error, which doesn't appear on 26: a.ActiveXObject is not a constructor

// Edit It doesn't show up on my Virtual Machine with WinXP and Firefox 27

// Edit2 It does show up on another Virtual Machine With Win7 x32 and Firefox 27

patrickkettner commented 10 years ago

Does this throw the same error?

sp00n commented 10 years ago

No, this throws a JS error: ReferenceError: invalid assignment left-hand side try{"ActiveXObject" in window && c="Pan"in n...

patrickkettner commented 10 years ago

Sorry, tried to hack something on my phone, and I messed it up. Could you try this instead

sp00n commented 10 years ago

I'm only receiving the "could not decode" warning now, the JS errors are gone. This still results in a " no-videoautoplay" though. Have you tried the re-encoded video file I've posted above for compatibility with other OS? It did work for me, but I didn't to any further tests.

patrickkettner commented 10 years ago

I was just trying to fix the flash detect in his case. I am tracking the video issue seperatly.

On Sun, Feb 23, 2014 at 3:34 AM, sp00n notifications@github.com wrote:

I'm only receiving the "could not decode" warning now, the JS errors are gone. This still results in a " no-videoautoplay" though.

Have you tried the re-encoded video file I've posted above for compatibility with other OS? It did work for me, but I didn't to any further tests.

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