Skip to content

Commit

Permalink
[fix bug 1303076] Fix plugincheck to avoid enumerating on navigator.m…
Browse files Browse the repository at this point in the history
…imeTypes
  • Loading branch information
alexgibson committed Sep 23, 2016
1 parent 96f64ee commit 05c4b3b
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions media/js/plugincheck/lib/plugincheck.js
Expand Up @@ -14,17 +14,19 @@
*/
function setJavaVersion() {
var type;
var installedVersion;
var installedVersion = '0.0.0'; // fallback is better than throwing an error
var mimes = navigator.mimeTypes['application/x-java-applet'].enabledPlugin;

for (var mime in mimes) {
if(mimes.hasOwnProperty(mime) && mime.indexOf('jpi-version') > -1) {
type = mime;
// + 3 to strip of the leading 1. in java versions
installedVersion = type.substring(type.indexOf('=') + 3)
.replace('_', '.');
}
var mime = Object.keys(mimes).filter(function(key) {
return mimes[key].type.indexOf('jpi-version') > -1;
});

if (mime.length > 0) {
type = mimes[mime[0]].type;
// + 3 to strip of the leading 1. in java versions
installedVersion = type.substring(type.indexOf('=') + 3).replace('_', '.');
}

return installedVersion;
}

Expand Down

0 comments on commit 05c4b3b

Please sign in to comment.