diff --git a/dom/plugins/base/nsPluginHost.cpp b/dom/plugins/base/nsPluginHost.cpp index 813b6852d3f..c2b5c102974 100644 --- a/dom/plugins/base/nsPluginHost.cpp +++ b/dom/plugins/base/nsPluginHost.cpp @@ -2034,16 +2034,15 @@ bool nsPluginHost::ShouldAddPlugin(nsPluginTag* aPluginTag) { #if defined(XP_WIN) && (defined(__x86_64__) || defined(_M_X64)) - // On 64-bit windows, the only plugin we should load is flash. Use library - // filename and MIME type to check. + // On 64-bit windows, the only plugins we should load are flash and + // silverlight. Use library filename and MIME type to check. if (StringBeginsWith(aPluginTag->FileName(), NS_LITERAL_CSTRING("NPSWF"), nsCaseInsensitiveCStringComparator()) && (aPluginTag->HasMimeType(NS_LITERAL_CSTRING("application/x-shockwave-flash")) || aPluginTag->HasMimeType(NS_LITERAL_CSTRING("application/x-shockwave-flash-test")))) { return true; } - // Microsoft Silverlight Tests if (StringBeginsWith(aPluginTag->FileName(), NS_LITERAL_CSTRING("npctrl"), nsCaseInsensitiveCStringComparator()) && - (aPluginTag->HasMimeType(NS_LITERAL_CSTRING("application/x-silverlight-app")) || + (aPluginTag->HasMimeType(NS_LITERAL_CSTRING("application/x-silverlight-test")) || aPluginTag->HasMimeType(NS_LITERAL_CSTRING("application/x-silverlight-2")) || aPluginTag->HasMimeType(NS_LITERAL_CSTRING("application/x-silverlight")))) { return true; diff --git a/dom/plugins/test/mochitest/test_bug1165981.html b/dom/plugins/test/mochitest/test_bug1165981.html index c585e8cb65e..88f2c7ab104 100644 --- a/dom/plugins/test/mochitest/test_bug1165981.html +++ b/dom/plugins/test/mochitest/test_bug1165981.html @@ -13,6 +13,7 @@ SimpleTest.waitForExplicitFinish(); ok(SpecialPowers.setTestPluginEnabledState(SpecialPowers.Ci.nsIPluginTag.STATE_ENABLED, "Flash Test Plug-in"), "Should find allowed test flash plugin"); + ok(SpecialPowers.setTestPluginEnabledState(SpecialPowers.Ci.nsIPluginTag.STATE_ENABLED, "Silverlight Test Plug-in"), "Should find allowed test silverlight plugin"); ok(!SpecialPowers.setTestPluginEnabledState(SpecialPowers.Ci.nsIPluginTag.STATE_ENABLED, "Third Test Plug-in"), "Should not find disallowed plugin"); function findPlugin(pluginName) { @@ -36,29 +37,37 @@ } function run() { - var pluginElement = document.getElementById("plugin"); + var pluginElement = document.getElementById("plugin-flash"); + is(pluginElement.identifierToStringTest("foo"), "foo", "Should be able to call a function provided by the plugin"); + + pluginElement = document.getElementById("plugin-silverlight"); is(pluginElement.identifierToStringTest("foo"), "foo", "Should be able to call a function provided by the plugin"); pluginElement = document.getElementById("disallowedPlugin"); is(typeof pluginElement.identifierToStringTest, "undefined", "Should NOT be able to call a function on a disallowed plugin"); - ok(navigator.plugins["Flash Test Plug-in"], "Should have queried a plugin named 'Test Plug-in'"); + ok(navigator.plugins["Flash Test Plug-in"], "Should have queried a plugin named 'Flash Test Plug-in'"); + ok(navigator.plugins["Silverlight Test Plug-in"], "Should have queried a plugin named 'Silverlight Test Plug-in'"); ok(!navigator.plugins["Third Test Plug-in"], "Should NOT have queried a disallowed plugin named 'Third Test Plug-in'"); - ok(findPlugin("Flash Test Plug-in"), "Should have found a plugin named 'Test Plug-in'"); + ok(findPlugin("Flash Test Plug-in"), "Should have found a plugin named 'Flash Test Plug-in'"); + ok(findPlugin("Silverlight Test Plug-in"), "Should have found a plugin named 'Silverlight Test Plug-in'"); ok(!findPlugin("Third Test Plug-in"), "Should NOT found a disallowed plugin named 'Third Test Plug-in'"); ok(navigator.mimeTypes["application/x-shockwave-flash-test"], "Should have queried a MIME type named 'application/x-shockwave-flash-test'"); + ok(navigator.mimeTypes["application/x-silverlight-test"], "Should have queried a MIME type named 'application/x-silverlight-test'"); ok(!navigator.mimeTypes["application/x-third-test"], "Should NOT have queried a disallowed type named 'application/x-third-test'"); ok(findMimeType("application/x-shockwave-flash-test"), "Should have found a MIME type named 'application/x-shockwave-flash-test'"); + ok(findMimeType("application/x-silverlight-test"), "Should have found a MIME type named 'application/x-silverlight-test'"); ok(!findMimeType("application/x-third-test"), "Should NOT have found a disallowed MIME type named 'application/x-third-test'"); SimpleTest.finish(); } - + + diff --git a/dom/plugins/test/testaddon/Makefile.in b/dom/plugins/test/testaddon/Makefile.in index 5ec45d39df5..b023a0db199 100644 --- a/dom/plugins/test/testaddon/Makefile.in +++ b/dom/plugins/test/testaddon/Makefile.in @@ -5,10 +5,10 @@ include $(topsrcdir)/config/rules.mk ifeq ($(MOZ_WIDGET_TOOLKIT),cocoa) -plugin_file_names = Test.plugin SecondTest.plugin ThirdTest.plugin npswftest.plugin +plugin_file_names = Test.plugin SecondTest.plugin ThirdTest.plugin npswftest.plugin npctrltest.plugin addon_file_name = testaddon_$(TARGET_XPCOM_ABI).xpi else -plugin_file_names = $(DLL_PREFIX)nptest$(DLL_SUFFIX) $(DLL_PREFIX)npsecondtest$(DLL_SUFFIX) $(DLL_PREFIX)npthirdtest$(DLL_SUFFIX) $(DLL_PREFIX)npswftest$(DLL_SUFFIX) +plugin_file_names = $(DLL_PREFIX)nptest$(DLL_SUFFIX) $(DLL_PREFIX)npsecondtest$(DLL_SUFFIX) $(DLL_PREFIX)npthirdtest$(DLL_SUFFIX) $(DLL_PREFIX)npswftest$(DLL_SUFFIX) $(DLL_PREFIX)npctrltest$(DLL_SUFFIX) addon_file_name = testaddon.xpi endif diff --git a/dom/plugins/test/testplugin/moz.build b/dom/plugins/test/testplugin/moz.build index d97ba3349b5..d7d7fb6e814 100644 --- a/dom/plugins/test/testplugin/moz.build +++ b/dom/plugins/test/testplugin/moz.build @@ -4,7 +4,7 @@ # 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/. -DIRS += ['secondplugin', 'javaplugin', 'thirdplugin', 'flashplugin'] +DIRS += ['secondplugin', 'javaplugin', 'thirdplugin', 'flashplugin', 'silverlightplugin'] SharedLibrary('nptest') diff --git a/dom/plugins/test/testplugin/silverlightplugin/Info.plist b/dom/plugins/test/testplugin/silverlightplugin/Info.plist new file mode 100644 index 00000000000..7a8094b83cd --- /dev/null +++ b/dom/plugins/test/testplugin/silverlightplugin/Info.plist @@ -0,0 +1,38 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleExecutable + libnpctrltest.dylib + CFBundleIdentifier + org.mozilla.SilverlightTestPlugin + CFBundleInfoDictionaryVersion + 6.0 + CFBundlePackageType + BRPL + CFBundleShortVersionString + 1.0.0.0 + CFBundleSignature + SILVERLIGHTTEST + CFBundleVersion + 1.0.0.0 + WebPluginName + Silverlight Test Plug-in + WebPluginDescription + Silverlight plug-in for testing purposes. + WebPluginMIMETypes + + application/x-silverlight-test + + WebPluginExtensions + + xaml + + WebPluginTypeDescription + Silverlight test type + + + + diff --git a/dom/plugins/test/testplugin/silverlightplugin/Makefile.in b/dom/plugins/test/testplugin/silverlightplugin/Makefile.in new file mode 100644 index 00000000000..ebab18fbd29 --- /dev/null +++ b/dom/plugins/test/testplugin/silverlightplugin/Makefile.in @@ -0,0 +1,9 @@ +# +# 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/. + +RELATIVE_PATH=.. +COCOA_NAME=npctrltest +include @srcdir@/../testplugin.mk + diff --git a/dom/plugins/test/testplugin/silverlightplugin/moz.build b/dom/plugins/test/testplugin/silverlightplugin/moz.build new file mode 100644 index 00000000000..affa3d7a227 --- /dev/null +++ b/dom/plugins/test/testplugin/silverlightplugin/moz.build @@ -0,0 +1,10 @@ +# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*- +# vim: set filetype=python: +# 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/. + +SharedLibrary('npctrltest') + +relative_path = 'silverlightplugin' +include('../testplugin.mozbuild') diff --git a/dom/plugins/test/testplugin/silverlightplugin/nptest.def b/dom/plugins/test/testplugin/silverlightplugin/nptest.def new file mode 100644 index 00000000000..b25c6c8c526 --- /dev/null +++ b/dom/plugins/test/testplugin/silverlightplugin/nptest.def @@ -0,0 +1,7 @@ +LIBRARY NPCTRLTEST + +EXPORTS + NP_GetEntryPoints @1 + NP_Initialize @2 + NP_Shutdown @3 + NP_GetMIMEDescription @4 diff --git a/dom/plugins/test/testplugin/silverlightplugin/nptest.rc b/dom/plugins/test/testplugin/silverlightplugin/nptest.rc new file mode 100644 index 00000000000..a48654bc564 --- /dev/null +++ b/dom/plugins/test/testplugin/silverlightplugin/nptest.rc @@ -0,0 +1,42 @@ +#include + + +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 1,0,0,0 + PRODUCTVERSION 1,0,0,0 + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS VOS__WINDOWS32 + FILETYPE VFT_DLL + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904e4" + BEGIN + VALUE "CompanyName", "mozilla.org" + VALUE "FileDescription", L"Silverlight plug-in for testing purposes." + VALUE "FileExtents", "xaml" + VALUE "FileOpenName", "Silverlight test type" + VALUE "FileVersion", "1.0" + VALUE "InternalName", "npctrltest" + VALUE "MIMEType", "application/x-silverlight-test" + VALUE "OriginalFilename", "npctrltest.dll" + VALUE "ProductName", "Silverlight Test Plug-in" + VALUE "ProductVersion", "1.0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1252 + END +END diff --git a/dom/plugins/test/testplugin/silverlightplugin/nptest_name.cpp b/dom/plugins/test/testplugin/silverlightplugin/nptest_name.cpp new file mode 100644 index 00000000000..2cdfaa5f1c1 --- /dev/null +++ b/dom/plugins/test/testplugin/silverlightplugin/nptest_name.cpp @@ -0,0 +1,7 @@ +/* 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/. */ + +const char *sPluginName = "Silverlight Test Plug-in"; +const char *sPluginDescription = "Silverlight plug-in for testing purposes."; +const char *sMimeDescription = "application/x-silverlight-test:xaml:Silverlight test type"; diff --git a/services/healthreport/tests/xpcshell/test_provider_addons.js b/services/healthreport/tests/xpcshell/test_provider_addons.js index 72d760e15ad..27a908bd7dc 100644 --- a/services/healthreport/tests/xpcshell/test_provider_addons.js +++ b/services/healthreport/tests/xpcshell/test_provider_addons.js @@ -191,6 +191,17 @@ add_task(function test_collect() { "application/x-shockwave-flash-test" ], }, + "Silverlight Test Plug-in": + { + "version": "1.0.0.0", + "description": "Silverlight plug-in for testing purposes.", + "blocklisted": false, + "disabled": false, + "clicktoplay": false, + "mimeTypes":[ + "application/x-silverlight-test" + ], + }, }; let pluginTags = Cc["@mozilla.org/plugin/host;1"] diff --git a/testing/mochitest/Makefile.in b/testing/mochitest/Makefile.in index aba5c3852bc..98a4ee4157a 100644 --- a/testing/mochitest/Makefile.in +++ b/testing/mochitest/Makefile.in @@ -73,6 +73,7 @@ TEST_HARNESS_PLUGINS := \ SecondTest.plugin/ \ ThirdTest.plugin/ \ npswftest.plugin/ \ + npctrltest.plugin/ \ JavaTest.plugin/ else TEST_HARNESS_PLUGINS := \ @@ -80,7 +81,8 @@ TEST_HARNESS_PLUGINS := \ $(DLL_PREFIX)npsecondtest$(DLL_SUFFIX) \ $(DLL_PREFIX)npthirdtest$(DLL_SUFFIX) \ $(DLL_PREFIX)nptestjava$(DLL_SUFFIX) \ - $(DLL_PREFIX)npswftest$(DLL_SUFFIX) + $(DLL_PREFIX)npswftest$(DLL_SUFFIX) \ + $(DLL_PREFIX)npctrltest$(DLL_SUFFIX) endif # Rules for staging the necessary harness bits for a test package