Mozilla Home
Privacy
Cookies
Legal
Bugzilla
Browse
Advanced Search
New Bug
Reports
Documentation
Log In
Log In with GitHub
or
Remember me
Browse
Advanced Search
New Bug
Reports
Documentation
Attachment 829992 Details for
Bug 757726
[patch]
part-6-v3-hide-plugins-pref.patch
WIP_757726-part-6-v3-hide-plugins-pref.patch (text/plain), 23.16 KB, created by
Chris Peterson [:cpeterson]
(
hide
)
Description:
part-6-v3-hide-plugins-pref.patch
Filename:
MIME Type:
Creator:
Chris Peterson [:cpeterson]
Size:
23.16 KB
patch
obsolete
># HG changeset patch ># Parent c3edda7979b2df96a34a7437471eace5b4a6e762 ># User Chris Peterson <cpeterson@mozilla.com> ># Date 1383283149 25200 > >Bug 757726 - Part 6: Hide most plugins from navigator.plugins and navigator.mimeTypes enumeration. r? > >diff --git a/dom/base/nsMimeTypeArray.cpp b/dom/base/nsMimeTypeArray.cpp >--- a/dom/base/nsMimeTypeArray.cpp >+++ b/dom/base/nsMimeTypeArray.cpp >@@ -20,23 +20,23 @@ using namespace mozilla::dom; > > NS_IMPL_CYCLE_COLLECTING_ADDREF(nsMimeTypeArray) > NS_IMPL_CYCLE_COLLECTING_RELEASE(nsMimeTypeArray) > NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsMimeTypeArray) > NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY > NS_INTERFACE_MAP_ENTRY(nsISupports) > NS_INTERFACE_MAP_END > >-NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE_2(nsMimeTypeArray, >+NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE_3(nsMimeTypeArray, > mWindow, >- mMimeTypes) >+ mMimeTypes, >+ mHiddenMimeTypes) > > nsMimeTypeArray::nsMimeTypeArray(nsPIDOMWindow* aWindow) >- : mWindow(aWindow), >- mPluginMimeTypeCount(0) >+ : mWindow(aWindow) > { > SetIsDOMBinding(); > } > > nsMimeTypeArray::~nsMimeTypeArray() > { > } > >@@ -45,17 +45,17 @@ nsMimeTypeArray::WrapObject(JSContext* a > { > return MimeTypeArrayBinding::Wrap(aCx, aScope, this); > } > > void > nsMimeTypeArray::Refresh() > { > mMimeTypes.Clear(); >- mPluginMimeTypeCount = 0; >+ mHiddenMimeTypes.Clear(); > } > > nsPIDOMWindow* > nsMimeTypeArray::GetParentObject() const > { > MOZ_ASSERT(mWindow); > return mWindow; > } >@@ -76,40 +76,54 @@ nsMimeTypeArray::NamedItem(const nsAStri > > nsMimeType* > nsMimeTypeArray::IndexedGetter(uint32_t aIndex, bool &aFound) > { > aFound = false; > > EnsurePluginMimeTypes(); > >- MOZ_ASSERT(mMimeTypes.Length() >= mPluginMimeTypeCount); >- >- if (aIndex >= mPluginMimeTypeCount) { >+ if (aIndex >= mMimeTypes.Length()) { > return nullptr; > } > > aFound = true; > > return mMimeTypes[aIndex]; > } > >+static nsMimeType* >+FindMimeType(const nsTArray<nsRefPtr<nsMimeType> >& aMimeTypes, >+ const nsAString& aType) >+{ >+ for (uint32_t i = 0; i < aMimeTypes.Length(); ++i) { >+ nsMimeType* mimeType = aMimeTypes[i]; >+ if (aType.Equals(mimeType->Type())) { >+ return mimeType; >+ } >+ } >+ >+ return nullptr; >+} >+ > nsMimeType* > nsMimeTypeArray::NamedGetter(const nsAString& aName, bool &aFound) > { > aFound = false; > > EnsurePluginMimeTypes(); > >- for (uint32_t i = 0; i < mMimeTypes.Length(); ++i) { >- if (aName.Equals(mMimeTypes[i]->Type())) { >- aFound = true; >+ nsMimeType* mimeType = FindMimeType(mMimeTypes, aName); >+ if (!mimeType) { >+ mimeType = FindMimeType(mHiddenMimeTypes, aName); >+ } > >- return mMimeTypes[i]; >- } >+ if (mimeType) { >+ aFound = true; >+ return mimeType; > } > > // Now let's check with the MIME service. > nsCOMPtr<nsIMIMEService> mimeSrv = do_GetService("@mozilla.org/mime;1"); > if (!mimeSrv) { > return nullptr; > } > >@@ -143,46 +157,46 @@ nsMimeTypeArray::NamedGetter(const nsASt > } > } > } > } > > // If we got here, we support this type! Say so. > aFound = true; > >+ // We don't want navigator.mimeTypes enumeration to expose MIME types with >+ // application handlers, so add them to the list of hidden MIME types. > nsMimeType *mt = new nsMimeType(mWindow, aName); >- mMimeTypes.AppendElement(mt); >+ mHiddenMimeTypes.AppendElement(mt); > > return mt; > } > > uint32_t > nsMimeTypeArray::Length() > { > EnsurePluginMimeTypes(); > >- MOZ_ASSERT(mMimeTypes.Length() >= mPluginMimeTypeCount); >- >- return mPluginMimeTypeCount; >+ return mMimeTypes.Length(); > } > > void > nsMimeTypeArray::GetSupportedNames(nsTArray< nsString >& aRetval) > { > EnsurePluginMimeTypes(); > > for (uint32_t i = 0; i < mMimeTypes.Length(); ++i) { > aRetval.AppendElement(mMimeTypes[i]->Type()); > } > } > > void > nsMimeTypeArray::EnsurePluginMimeTypes() > { >- if (!mMimeTypes.IsEmpty() || !mWindow) { >+ if (!mMimeTypes.IsEmpty() || !mHiddenMimeTypes.IsEmpty() || !mWindow) { > return; > } > > nsCOMPtr<nsIDOMNavigator> navigator; > mWindow->GetNavigator(getter_AddRefs(navigator)); > > if (!navigator) { > return; >@@ -190,19 +204,17 @@ nsMimeTypeArray::EnsurePluginMimeTypes() > > ErrorResult rv; > nsPluginArray *pluginArray = > static_cast<Navigator*>(navigator.get())->GetPlugins(rv); > if (!pluginArray) { > return; > } > >- pluginArray->GetMimeTypes(mMimeTypes); >- >- mPluginMimeTypeCount = mMimeTypes.Length(); >+ pluginArray->GetMimeTypes(mMimeTypes, mHiddenMimeTypes); > } > > NS_IMPL_CYCLE_COLLECTION_ROOT_NATIVE(nsMimeType, AddRef) > NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(nsMimeType, Release) > > NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE_2(nsMimeType, mWindow, mPluginElement) > > nsMimeType::nsMimeType(nsPIDOMWindow* aWindow, nsPluginElement* aPluginElement, >diff --git a/dom/base/nsMimeTypeArray.h b/dom/base/nsMimeTypeArray.h >--- a/dom/base/nsMimeTypeArray.h >+++ b/dom/base/nsMimeTypeArray.h >@@ -41,25 +41,26 @@ public: > void GetSupportedNames(nsTArray< nsString >& retval); > > protected: > void EnsurePluginMimeTypes(); > void Clear(); > > nsCOMPtr<nsPIDOMWindow> mWindow; > >- // mMimeTypes contains all mime types handled by plugins followed by >- // any other mime types that we handle internally and have been >- // looked up before. >+ // mMimeTypes contains MIME types handled by non-hidden plugins, those >+ // popular plugins that must be exposed in navigator.plugins enumeration to >+ // avoid breaking web content. Likewise, mMimeTypes are exposed in >+ // navigator.mimeTypes enumeration. > nsTArray<nsRefPtr<nsMimeType> > mMimeTypes; > >- // mPluginMimeTypeCount is the number of plugin mime types that we >- // have in mMimeTypes. The plugin mime types are always at the >- // beginning of the list. >- uint32_t mPluginMimeTypeCount; >+ // mHiddenMimeTypes contains MIME types handled by plugins hidden from >+ // navigator.plugins enumeration or by an OS PreferredApplicationHandler. >+ // mHiddenMimeTypes are hidden from navigator.mimeTypes enumeration. >+ nsTArray<nsRefPtr<nsMimeType> > mHiddenMimeTypes; > }; > > class nsMimeType MOZ_FINAL : public nsWrapperCache > { > public: > NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(nsMimeType) > NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(nsMimeType) > >diff --git a/dom/base/nsPluginArray.cpp b/dom/base/nsPluginArray.cpp >--- a/dom/base/nsPluginArray.cpp >+++ b/dom/base/nsPluginArray.cpp >@@ -1,17 +1,20 @@ > /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ > /* This Source Code Form is subject to the terms of the Mozilla Public > * License, v. 2.0. If a copy of the MPL was not distributed with this > * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ > > #include "nsPluginArray.h" > >+#include "mozilla/Preferences.h" > #include "mozilla/dom/PluginArrayBinding.h" > #include "mozilla/dom/PluginBinding.h" >+ >+#include "nsCharSeparatedTokenizer.h" > #include "nsMimeTypeArray.h" > #include "Navigator.h" > #include "nsIDocShell.h" > #include "nsIWebNavigation.h" > #include "nsPluginHost.h" > #include "nsPluginTags.h" > #include "nsIObserverService.h" > #include "nsIWeakReference.h" >@@ -58,35 +61,46 @@ NS_IMPL_CYCLE_COLLECTING_ADDREF(nsPlugin > NS_IMPL_CYCLE_COLLECTING_RELEASE(nsPluginArray) > NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsPluginArray) > NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY > NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIObserver) > NS_INTERFACE_MAP_ENTRY(nsIObserver) > NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference) > NS_INTERFACE_MAP_END > >-NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE_2(nsPluginArray, >+NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE_3(nsPluginArray, > mWindow, >- mPlugins) >+ mPlugins, >+ mHiddenPlugins) >+ >+static void >+GetPluginMimeTypes(const nsTArray<nsRefPtr<nsPluginElement> >& aPlugins, >+ nsTArray<nsRefPtr<nsMimeType> >& aMimeTypes) >+{ >+ for (uint32_t i = 0; i < aPlugins.Length(); ++i) { >+ nsPluginElement *plugin = aPlugins[i]; >+ aMimeTypes.AppendElements(plugin->MimeTypes()); >+ } >+} > > void >-nsPluginArray::GetMimeTypes(nsTArray<nsRefPtr<nsMimeType> >& aMimeTypes) >+nsPluginArray::GetMimeTypes(nsTArray<nsRefPtr<nsMimeType> >& aMimeTypes, >+ nsTArray<nsRefPtr<nsMimeType> >& aHiddenMimeTypes) > { > aMimeTypes.Clear(); >+ aHiddenMimeTypes.Clear(); > > if (!AllowPlugins()) { > return; > } > > EnsurePlugins(); > >- for (uint32_t i = 0; i < mPlugins.Length(); ++i) { >- nsPluginElement *plugin = mPlugins[i]; >- aMimeTypes.AppendElements(plugin->MimeTypes()); >- } >+ GetPluginMimeTypes(mPlugins, aMimeTypes); >+ GetPluginMimeTypes(mHiddenPlugins, aHiddenMimeTypes); > } > > nsPluginElement* > nsPluginArray::Item(uint32_t aIndex) > { > bool unused; > return IndexedGetter(aIndex, unused); > } >@@ -116,22 +130,24 @@ nsPluginArray::Refresh(bool aReloadDocum > > // Check if the number of plugins we know about are different from > // the number of plugin tags the plugin host knows about. If the > // lengths are different, we refresh. This is safe because we're > // notified for every plugin enabling/disabling event that > // happens, and therefore the lengths will be in sync only when > // the both arrays contain the same plugin tags (though as > // different types). >- if (newPluginTags.Length() == mPlugins.Length()) { >+ uint32_t pluginCount = mPlugins.Length() + mHiddenPlugins.Length(); >+ if (newPluginTags.Length() == pluginCount) { > return; > } > } > > mPlugins.Clear(); >+ mHiddenPlugins.Clear(); > > nsCOMPtr<nsIDOMNavigator> navigator; > mWindow->GetNavigator(getter_AddRefs(navigator)); > > if (!navigator) { > return; > } > >@@ -164,40 +180,51 @@ nsPluginArray::Invalidate() > { > nsCOMPtr<nsIObserverService> obsService = > mozilla::services::GetObserverService(); > if (obsService) { > obsService->RemoveObserver(this, "plugin-info-updated"); > } > } > >+static nsPluginElement* >+FindPlugin(const nsTArray<nsRefPtr<nsPluginElement> >& aPlugins, >+ const nsAString& aName) >+{ >+ for (uint32_t i = 0; i < aPlugins.Length(); ++i) { >+ nsAutoString pluginName; >+ nsPluginElement* plugin = aPlugins[i]; >+ plugin->GetName(pluginName); >+ >+ if (pluginName.Equals(aName)) { >+ return plugin; >+ } >+ } >+ >+ return nullptr; >+} >+ > nsPluginElement* > nsPluginArray::NamedGetter(const nsAString& aName, bool &aFound) > { > aFound = false; > > if (!AllowPlugins()) { > return nullptr; > } > > EnsurePlugins(); > >- for (uint32_t i = 0; i < mPlugins.Length(); ++i) { >- nsAutoString pluginName; >- nsPluginElement* plugin = mPlugins[i]; >- plugin->GetName(pluginName); >- >- if (pluginName.Equals(aName)) { >- aFound = true; >- >- return plugin; >- } >+ nsPluginElement* plugin = FindPlugin(mPlugins, aName); >+ if (!plugin) { >+ plugin = FindPlugin(mHiddenPlugins, aName); > } > >- return nullptr; >+ aFound = (plugin != nullptr); >+ return plugin; > } > > uint32_t > nsPluginArray::Length() > { > if (!AllowPlugins()) { > return 0; > } >@@ -237,37 +264,80 @@ nsPluginArray::Observe(nsISupports *aSub > bool > nsPluginArray::AllowPlugins() const > { > nsCOMPtr<nsIDocShell> docShell = do_GetInterface(mWindow); > > return docShell && docShell->PluginsAllowedInCurrentDoc(); > } > >+static bool >+HasStringPrefix(const nsCString& str, const nsACString& prefix) { >+ return str.Compare(prefix.BeginReading(), false, prefix.Length()) == 0; >+} >+ >+bool >+nsPluginArray::IsSpecialPluginType(const nsPluginTag* pluginTag) >+{ >+ const nsCString& pluginName = pluginTag->mName; >+ >+ const uint32_t length = mEnumerablePluginNames.Length(); >+ for (uint32_t i = 0; i < length; i++) { >+ const nsCString& name = mEnumerablePluginNames[i]; >+ if (HasStringPrefix(pluginName, name)) { >+ return true; // hide plugin! >+ } >+ } >+ >+ return false; // don't hide plugin >+} >+ > void > nsPluginArray::EnsurePlugins() > { >- if (!mPlugins.IsEmpty()) { >+ if (!mPlugins.IsEmpty() || !mHiddenPlugins.IsEmpty()) { > // We already have an array of plugin elements. > return; > } > >+ const nsAdoptingCString& enumerableNames = >+ Preferences::GetCString("plugins.enumerableNames"); >+ >+ if (enumerableNames) { >+ nsCCharSeparatedTokenizer tokens(enumerableNames, ','); >+ while (tokens.hasMoreTokens()) { >+ const nsCSubstring& token = tokens.nextToken(); >+ if (!token.IsEmpty()) { >+ mEnumerablePluginNames.AppendElement(token); >+ } >+ } >+ } >+ >+ mPlugins.Clear(); >+ mHiddenPlugins.Clear(); >+ > nsRefPtr<nsPluginHost> pluginHost = nsPluginHost::GetInst(); > if (!pluginHost) { > // We have no plugin host. > return; > } > > nsTArray<nsRefPtr<nsPluginTag> > pluginTags; > pluginHost->GetPlugins(pluginTags); > > // need to wrap each of these with a nsPluginElement, which is > // scriptable. > for (uint32_t i = 0; i < pluginTags.Length(); ++i) { >- mPlugins.AppendElement(new nsPluginElement(mWindow, pluginTags[i])); >+ nsPluginTag* pluginTag = pluginTags[i]; >+ >+ // Add the plugin to the list of hidden or non-hidden plugins? >+ nsTArray<nsRefPtr<nsPluginElement> >& pluginArray = >+ IsSpecialPluginType(pluginTag) ? mPlugins : mHiddenPlugins; >+ >+ pluginArray.AppendElement(new nsPluginElement(mWindow, pluginTag)); > } > } > > // nsPluginElement implementation. > > NS_IMPL_CYCLE_COLLECTING_ADDREF(nsPluginElement) > NS_IMPL_CYCLE_COLLECTING_RELEASE(nsPluginElement) > NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsPluginElement) >diff --git a/dom/base/nsPluginArray.h b/dom/base/nsPluginArray.h >--- a/dom/base/nsPluginArray.h >+++ b/dom/base/nsPluginArray.h >@@ -38,34 +38,48 @@ public: > > // nsPluginArray registers itself as an observer with a weak reference. > // This can't be done in the constructor, because at that point its > // refcount is 0 (and it gets destroyed upon registration). So, Init() > // must be called after construction. > void Init(); > void Invalidate(); > >- void GetMimeTypes(nsTArray<nsRefPtr<nsMimeType> >& aMimeTypes); >+ void GetMimeTypes(nsTArray<nsRefPtr<nsMimeType> >& aMimeTypes, >+ nsTArray<nsRefPtr<nsMimeType> >& aHiddenMimeTypes); > > // PluginArray WebIDL methods > > nsPluginElement* Item(uint32_t aIndex); > nsPluginElement* NamedItem(const nsAString& aName); > void Refresh(bool aReloadDocuments); > nsPluginElement* IndexedGetter(uint32_t aIndex, bool &aFound); > nsPluginElement* NamedGetter(const nsAString& aName, bool &aFound); > uint32_t Length(); > void GetSupportedNames(nsTArray< nsString >& aRetval); > > private: > bool AllowPlugins() const; > void EnsurePlugins(); >+ bool IsSpecialPluginType(const nsPluginTag* pluginTag); > > nsCOMPtr<nsPIDOMWindow> mWindow; >+ nsTArray<nsCString> mEnumerablePluginNames; >+ >+ // Many sites check whether a particular plugin is installed by enumerating >+ // all navigator.plugins, checking each plugin's name. These sites should >+ // just check navigator.plugins["Popular Plugin Name"] instead. mPlugins >+ // contains those popular plugins that must be exposed in navigator.plugins >+ // enumeration to avoid breaking web content. > nsTArray<nsRefPtr<nsPluginElement> > mPlugins; >+ >+ // mHiddenPlugins contains plugins that can be queried by >+ // navigator.plugins["Hidden Plugin Name"] but do not need to be exposed in >+ // navigator.plugins enumeration. >+ nsTArray<nsRefPtr<nsPluginElement> > mHiddenPlugins; > }; > > class nsPluginElement MOZ_FINAL : public nsISupports, > public nsWrapperCache > { > public: > NS_DECL_CYCLE_COLLECTING_ISUPPORTS > NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(nsPluginElement) >diff --git a/dom/plugins/test/mochitest/test_secondPlugin.html b/dom/plugins/test/mochitest/test_secondPlugin.html >--- a/dom/plugins/test/mochitest/test_secondPlugin.html >+++ b/dom/plugins/test/mochitest/test_secondPlugin.html >@@ -4,33 +4,69 @@ > > <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> > <script type="text/javascript" src="utils.js"></script> > <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> > </head> > > <body onload="run()"> > <script class="testbody" type="application/javascript"> >+ "use strict"; >+ > SimpleTest.waitForExplicitFinish(); > setTestPluginEnabledState(SpecialPowers.Ci.nsIPluginTag.STATE_ENABLED); > setTestPluginEnabledState(SpecialPowers.Ci.nsIPluginTag.STATE_ENABLED, "Second Test Plug-in"); > >+ function findPlugin(pluginName) { >+ for (var i = 0; i < navigator.plugins.length; i++) { >+ var plugin = navigator.plugins[i]; >+ if (plugin.name === pluginName) { >+ return plugin; >+ } >+ } >+ return null; >+ } >+ >+ function findMimeType(mimeTypeType) { >+ for (var i = 0; i < navigator.mimeTypes.length; i++) { >+ var mimeType = navigator.mimeTypes[i]; >+ if (mimeType.type === mimeTypeType) { >+ return mimeType; >+ } >+ } >+ return null; >+ } >+ > function run() { >- var foundFirstPlugin = false; >- var foundSecondPlugin = false; >- for (var index in navigator.plugins) { >- var plugin = navigator.plugins[index]; >- if (plugin.name == "Test Plug-in") foundFirstPlugin = true; >- if (plugin.name == "Second Test Plug-in") foundSecondPlugin = true; >- } >- ok(foundFirstPlugin, "Should have a plugin named 'Test Plug-in'"); >- ok(foundSecondPlugin, "Should have a plugin named 'Second Test Plug-in'"); >+ // Add "Test Plug-in" (but not "Second Test Plug-in") to the list of >+ // unhidden plugins. This test must modify the "plugins.enumerableNames" >+ // pref BEFORE accessing the navigator.plugins or navigator.mimeTypes >+ // arrays because they only read the pref when they first initialize >+ // their internal arrays! >+ var prefs = SpecialPowers.Cc["@mozilla.org/preferences-service;1"].getService(SpecialPowers.Ci.nsIPrefBranch); >+ var defaultEnumerableNamesPref = prefs.getCharPref("plugins.enumerableNames"); >+ prefs.setCharPref("plugins.enumerableNames", defaultEnumerableNamesPref + ",Test Plug-in"); > > var pluginElement = document.getElementById("plugin"); > is(pluginElement.identifierToStringTest("foo"), "foo", "Should be able to call a function provided by the plugin"); > >+ ok(navigator.plugins["Test Plug-in"], "Should have queried a non-hidden plugin named 'Test Plug-in'"); >+ ok(navigator.plugins["Second Test Plug-in"], "Should have queried a hidden plugin named 'Test Plug-in'"); >+ >+ ok(findPlugin("Test Plug-in"), "Should have found a non-hidden plugin named 'Test Plug-in'"); >+ ok(!findPlugin("Second Test Plug-in"), "Should NOT found a hidden plugin named 'Test Plug-in'"); >+ >+ ok(navigator.mimeTypes["application/x-test"], "Should have queried a non-hidden MIME type named 'application/x-test'"); >+ ok(navigator.mimeTypes["application/x-second-test"], "Should have queried a MIME type named 'application/x-second-test'"); >+ >+ ok(findMimeType("application/x-test"), "Should have found a non-hidden MIME type named 'application/x-test'"); >+ ok(!findMimeType("application/x-second-test"), "Should NOT have found a MIME type named 'application/x-second-test'"); >+ >+ // Restore original pref to hide "Test Plug-in" and "Second Test Plug-in". >+ prefs.setCharPref("plugins.enumerableNames", defaultEnumerableNamesPref); >+ > SimpleTest.finish(); > } > </script> > > <object id="plugin" type="application/x-second-test" width=200 height=200></object> > </body> > </html> >diff --git a/dom/tests/mochitest/bugs/test_bug427744.html b/dom/tests/mochitest/bugs/test_bug427744.html >--- a/dom/tests/mochitest/bugs/test_bug427744.html >+++ b/dom/tests/mochitest/bugs/test_bug427744.html >@@ -14,21 +14,20 @@ https://bugzilla.mozilla.org/show_bug.cg > <div id="content" style="display: none"> > > </div> > <pre id="test"> > <script class="testbody" type="text/javascript"> > > /** Test for Bug 427744 **/ > >-var found = false; >-for (var i = 0; i < navigator.plugins.length; i++) { >- if (navigator.plugins[i].name == "Test Plug-in") { >- found = true; >- is(navigator.plugins[i].version, "1.0.0.0", "Should have seen the right version"); >- } >-} >-ok(found, "Should have seen the test plugin"); >+var firstPlugin = navigator.plugins["Test Plug-in"]; >+ok(firstPlugin, "Should have seen the test plugin"); >+is(firstPlugin.version, "1.0.0.0", "Should have seen the right test plugin version"); >+ >+var secondPlugin = navigator.plugins["Second Test Plug-in"]; >+ok(secondPlugin, "Should have seen the second test plugin"); >+is(secondPlugin.version, "1.0.0.0", "Should have seen the right second test plugin version"); > > </script> > </pre> > </body> > </html> >diff --git a/layout/tools/reftest/reftest.js b/layout/tools/reftest/reftest.js >--- a/layout/tools/reftest/reftest.js >+++ b/layout/tools/reftest/reftest.js >@@ -631,27 +631,19 @@ function BuildConditionSandbox(aURL) { > } > > // Set OSX to the Mac OS X version for Mac, and 0 otherwise. > var osxmatch = /Mac OS X (\d+.\d+)$/.exec(hh.oscpu); > sandbox.OSX = osxmatch ? parseFloat(osxmatch[1]) : 0; > > // see if we have the test plugin available, > // and set a sandox prop accordingly >- sandbox.haveTestPlugin = false; >- > var navigator = gContainingWindow.navigator; >- for (var i = 0; i < navigator.mimeTypes.length; i++) { >- if (navigator.mimeTypes[i].type == "application/x-test" && >- navigator.mimeTypes[i].enabledPlugin != null && >- navigator.mimeTypes[i].enabledPlugin.name == "Test Plug-in") { >- sandbox.haveTestPlugin = true; >- break; >- } >- } >+ var testPlugin = navigator.plugins["Test Plug-in"]; >+ sandbox.haveTestPlugin = !!testPlugin; > > // Set a flag on sandbox if the windows default theme is active > var box = gContainingWindow.document.createElement("box"); > box.setAttribute("id", "_box_windowsDefaultTheme"); > gContainingWindow.document.documentElement.appendChild(box); > sandbox.windowsDefaultTheme = (gContainingWindow.getComputedStyle(box, null).display == "none"); > gContainingWindow.document.documentElement.removeChild(box); > >diff --git a/modules/libpref/src/init/all.js b/modules/libpref/src/init/all.js >--- a/modules/libpref/src/init/all.js >+++ b/modules/libpref/src/init/all.js >@@ -2001,16 +2001,22 @@ pref("dom.promise.enabled", true); > // (0 is disabled) > // Disabled on all platforms per bug 705748 until the found issues are > // resolved. > pref("hangmonitor.timeout", 0); > > pref("plugins.load_appdir_plugins", false); > // If true, plugins will be click to play > pref("plugins.click_to_play", false); >+ >+// Plugin name *prefixes* of plugins that should be exposed when enumerating >+// navigator.plugins[]. The "Shockwave" prefix matches both Adobe Flash Player >+// ("Shockwave Flash") and Adobe Shockwave Player ("Shockwave for Director"). >+pref("plugins.enumerableNames", "Java,QuickTime Plug-in,Shockwave"); >+ > // The default value for nsIPluginTag.enabledState (STATE_ENABLED = 2) > pref("plugin.default.state", 2); > > // How long in minutes we will allow a plugin to work after the user has chosen > // to allow it "now" > pref("plugin.sessionPermissionNow.intervalInMinutes", 60); > // How long in days we will allow a plugin to work after the user has chosen > // to allow it persistently.
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
Flags:
johns
: review+
Actions:
View
|
Diff
|
Review
Attachments on
bug 757726
:
664380
|
674153
|
693268
|
693273
|
693793
|
820124
|
820126
|
820127
|
820130
|
820132
|
820133
|
825121
|
825122
|
825124
|
829927
|
829988
| 829992 |
831356
|
8421211