Closed Bug 934108 Opened 7 years ago Closed 4 years ago

[trailers.apple.com] Remove use of plugin enumeration

Categories

(Web Compatibility :: Desktop, defect)

defect
Not set
minor

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: BenB, Unassigned)

References

()

Details

(Whiteboard: [country-all] [contactready] [video] [js])

See bug 934107 for purpose of this bug.

This bug is for http://trailers.apple.com.

From bug 757726 comment 91 by Chris:

Here is Apple's QuickTime plugin detection script:
http://trailers.apple.com/trailers/global/v3.1/scripts/lib/ac_media.js

My QuickTime plugin's name is "QuickTime Plug-in 7.7.3". Apple's script enumerates navigator.plugins[] for a plugin matching `plugin.name.indexOf("QuickTime") > -1`.

If I whitelist MIME type "application/quicktime" to unhide the QuickTime plugin, then alternative plugins like "VLC Multimedia Plug-in" will also be unhidden. Unfortunately, Apple's script won't recognize the VLC plugin name without a "QuickTime" substring, so unhiding this uncommon plugin has a small downside and no upside for VLC plugin users.
Blocks: 934107
Here's the full, offending code:
            var qtInstalled = false;
            if (navigator.plugins && navigator.plugins.length) {
                for (var i = 0; i < navigator.plugins.length; i++) {
                    var plugin = navigator.plugins[i];
                    if (plugin.name.indexOf("QuickTime") > -1) {
                        qtInstalled = true;
                    }
                }
            } else if (..[VBScript]...
To elaborate on Ben's example:

Because QuickTime's plugin name contains a version number ("QuickTime Plug-in 7.7.3"), a QuickTime detection script can't check `navigator.plugins["QuickTime Plug-in"]` or `navigator.plugins["QuickTime Plug-in 7.7.3"]`. Version numbers change and the installed version number is unknown.

A more robust QT plugin check:

    function getQuickTimePlugin() {
        var mimeTypes = navigator.mimeTypes;
        if (!mimeTypes) {
            return null;
        }
        var quicktime = mimeTypes["video/quicktime"];
        if (!quicktime) {
            return null;
        }
        return quicktime.enabledPlugin;
    }

    var qtPlugin = getQuickTimePlugin();
    if (qtPlugin) {
        var qtInstalled = (qtPlugin.name.indexOf("QuickTime") > -1); // e.g. "QuickTime Plug-in 7.7.3"
        var qtVersion = qtPlugin.version; // e.g. "7.7.3"
    } // else check VBScript or QT plugin not installed ...
Bad code still live on site. Moving to desktop component.
Assignee: english-us → nobody
Component: English US → Desktop
Whiteboard: [country-all]
Blocks: 114156
Whiteboard: [country-all] → [country-all] [contactready] [video] [js]
This evangelism bug will no longer be relevant after we drop support for all plugins (other than Flash) in Firefox 52 (bug 1269807).
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → WONTFIX
Product: Tech Evangelism → Web Compatibility
You need to log in before you can comment on or make changes to this bug.