hiimnalaa / swfobject

Automatically exported from code.google.com/p/swfobject
0 stars 0 forks source link

Wrong conditions used in checking mimeTypes #539

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Check out this condition from swfobject.js:
if (d && !(typeof nav.mimeTypes != UNDEF && nav.mimeTypes[FLASH_MIME_TYPE] && 
!nav.mimeTypes[FLASH_MIME_TYPE].enabledPlugin))

This is soo wrong.. Just think of what would happen if typeof nav.mimeTypes 
would be UNDEF or if nav.mimeTypes[FLASH_MIME_TYPE] would be null. The overall 
condition would be true.

The condition should be:
if (d && (typeof nav.mimeTypes != UNDEF && nav.mimeTypes[FLASH_MIME_TYPE] && 
nav.mimeTypes[FLASH_MIME_TYPE].enabledPlugin))

or:

if (d && !(typeof nav.mimeTypes == UNDEF || !nav.mimeTypes[FLASH_MIME_TYPE] || 
!nav.mimeTypes[FLASH_MIME_TYPE].enabledPlugin))

I was investigating the issue with broken preview of flash websites in google's 
"Instant Preview" when I found this error. Hopefully it will fix the problem. 
Not sure about that though.

Have a nice day,
Cristi Terpea

Original issue reported on code.google.com by in.a.cri...@gmail.com on 9 Mar 2011 at 10:46

GoogleCodeExporter commented 9 years ago
I believe you are correct. I will add this to our to-do list. Thanks

Original comment by platelu...@gmail.com on 16 May 2011 at 3:12

GoogleCodeExporter commented 9 years ago
Went with:

if (d && (typeof nav.mimeTypes != UNDEF && nav.mimeTypes[FLASH_MIME_TYPE] && 
nav.mimeTypes[FLASH_MIME_TYPE].enabledPlugin))

Tested in Chrome 11, Firefox 3.6, Firefox 4, Safari 5, Opera 11 and IE9

Needs to be tested in older versions of Safari and IE.

Original comment by platelu...@gmail.com on 22 May 2011 at 6:45