Attachment #820132: part-6-unhide-PluginCheck-plugins.patch for bug #757726

View | Details | Raw Unified | Return to bug 757726
Collapse All | Expand All

(-)a/dom/base/nsPluginArray.cpp (-3 / +69 lines)
Line     Link Here 
 Lines 261-284   nsPluginArray::Observe(nsISupports *aSub Link Here 
261
bool
261
bool
262
nsPluginArray::AllowPlugins() const
262
nsPluginArray::AllowPlugins() const
263
{
263
{
264
  nsCOMPtr<nsIDocShell> docShell = do_GetInterface(mWindow);
264
  nsCOMPtr<nsIDocShell> docShell = do_GetInterface(mWindow);
265
265
266
  return docShell && docShell->PluginsAllowedInCurrentDoc();
266
  return docShell && docShell->PluginsAllowedInCurrentDoc();
267
}
267
}
268
268
269
static const char *const sKnownPluginNameKeywords[] = {
270
  // Updated in 2013:
271
  "ActiveGS",
272
  "Adobe Acrobat",
273
  "Adobe Flash Player"
274
  "Adobe Reader",
275
  "Adobe Shockwave Player",
276
  "DivX",
277
  "Google Earth Plugin",
278
  "Java",
279
  "QuickTime Plug-in",
280
  "Shockwave Flash",
281
  "Shockwave for Director",
282
  "Silverlight",
283
  "Unity Player",
284
  "VLC Multimedia Plug-in",
285
  "VLC Web Plugin",
286
287
  // Last updated in 2012:
288
  "Aliedit",
289
  "Alipay security control",
290
  "Citrix Online Web Deployment Plugin",
291
  "Citrix Receiver Plug-in",
292
  "Flip4Mac Windows Media Plugin",
293
  "Google Talk Plugin",
294
  "Google Talk Plugin Video Accelerator",
295
  "RealJukebox NS Plugin",
296
  "RealNetworks(tm) Chrome Background Extension Plug-In",
297
  "RealPlayer",
298
  "VidXWebPlayer",
299
  "WacomTabletPlugin",
300
  "Windows Media Components for QuickTime",
301
302
  // Last updated in 2011:
303
  "Microsoft", // Microsoft DRM
304
305
  // Last updated in 2010:
306
  "BrowserPlus",
307
  "DevalVR",
308
  "InstantAction.com Game Launcher",
309
  "iPhotoPhotocast",
310
  "MetaStream 3 Plugin",
311
  "QUAKE LIVE",
312
  "QuakeLive Plugin",
313
  "Totem",
314
  "Windows Media Player Firefox",
315
  "Windows Media Player Plug-in",
316
317
  // Mozilla test plugin:
318
  "Second Test Plug-in",
319
};
320
269
static bool
321
static bool
270
IsPluginHidable(const nsPluginTag* pluginTag)
322
IsPluginHidable(const nsPluginTag* pluginTag)
271
{
323
{
272
  const nsCString& pluginName = pluginTag->mName;
324
  const nsCString& pluginName = pluginTag->mName;
273
325
274
  return !pluginName.Equals("Shockwave Flash") &&
326
  // Don't hide plugins whose names contain version numbers because content
275
         !pluginName.Equals("Java Applet Plug-in") &&
327
  // can't query navigator.plugins[] without knowing the exact plugin name.
276
         !pluginName.Equals("Second Test Plug-in"); // UNHIDE PLUGIN FOR TESTS
328
  // Search right to left because the version will probably be at the end.
329
  if (pluginName.RFindCharInSet("0123456789", 0) != kNotFound) {
330
    return false;
331
  }
332
333
  // Does the plugin name contain a known keyword?
334
  for (size_t i = 0; i < mozilla::ArrayLength(sKnownPluginNameKeywords); i++) {
335
    const char* keyword = sKnownPluginNameKeywords[i];
336
    if (pluginName.Find(keyword) != kNotFound) {
337
      return false;
338
    }
339
  }
340
341
  // We can hide this plugin because plugins.mozilla.org has never heard it.
342
  return true;
277
}
343
}
278
344
279
void
345
void
280
nsPluginArray::EnsurePlugins()
346
nsPluginArray::EnsurePlugins()
281
{
347
{
282
  if (!mPlugins.IsEmpty() || !mHiddenPlugins.IsEmpty()) {
348
  if (!mPlugins.IsEmpty() || !mHiddenPlugins.IsEmpty()) {
283
    // We already have an array of plugin elements.
349
    // We already have an array of plugin elements.
284
    return;
350
    return;

Return to bug 757726