1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/content/base/test/test_bug827160.html Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,63 @@ 1.4 +<!DOCTYPE HTML> 1.5 +<html> 1.6 +<!-- 1.7 +https://bugzilla.mozilla.org/show_bug.cgi?id=827160 1.8 +--> 1.9 +<head> 1.10 + <meta charset="utf-8"> 1.11 + <title>Test for Bug 827160</title> 1.12 + <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> 1.13 + <script type="application/javascript" src="/tests/SimpleTest/SpecialPowers.js"></script> 1.14 + <script type="application/javascript" src="utils.js"></script> 1.15 + <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> 1.16 +</head> 1.17 +<body> 1.18 +<a target="_blank" href=https://bugzilla.mozilla.org/show_bug.cgi?id=827160">Mozilla Bug 827160</a> 1.19 + 1.20 +<script type="application/javascript"> 1.21 + 1.22 +// Make sure the test plugin is not click-to-play 1.23 +var pluginHost = SpecialPowers.Cc["@mozilla.org/plugin/host;1"] 1.24 + .getService(SpecialPowers.Ci.nsIPluginHost); 1.25 +var pluginTags = pluginHost.getPluginTags(); 1.26 +for (var tag of pluginTags) { 1.27 + if (tag.name == "Test Plug-in" || tag.name == "Second Test Plug-in") { 1.28 + var oldEnabledState = tag.enabledState; 1.29 + tag.enabledState = SpecialPowers.Ci.nsIPluginTag.STATE_ENABLED; 1.30 + SimpleTest.registerCleanupFunction(function() { 1.31 + tag.enabledState = oldEnabledState; 1.32 + }); 1.33 + } 1.34 +} 1.35 + 1.36 +</script> 1.37 + 1.38 +<!-- Should load test plugin application/x-test --> 1.39 +<object id="shouldLoad" data="data:application/x-test,foo"></object> 1.40 +<!-- Should load test plugin application/x-test2, ignoring type="" --> 1.41 +<object id="shouldIgnoreType" type="application/x-test" data="data:application/x-test2,foo"></object> 1.42 +<!-- Should load nothing, channel type does not match type and typeMustMatch is present --> 1.43 +<object id="shouldNotLoad" type="application/x-test" data="data:application/x-test2,foo" typemustmatch></object> 1.44 +<!-- Should not load test plugin application/x-test2, no type field is present --> 1.45 +<object id="shouldNotLoadMissingType" data="data:application/x-test2,foo" typemustmatch></object> 1.46 +<!-- Should load, no data field is present --> 1.47 +<object id="shouldLoadMissingData" type="application/x-test" typemustmatch></object> 1.48 +<pre id="test"> 1.49 + 1.50 +<script type="application/javascript"> 1.51 +SimpleTest.waitForExplicitFinish(); 1.52 + 1.53 +window.addEventListener("load", function () { 1.54 + const OBJLC = SpecialPowers.Ci.nsIObjectLoadingContent; 1.55 + is(SpecialPowers.wrap(document.getElementById("shouldLoad")).displayedType, OBJLC.TYPE_PLUGIN, "Testing object load without type, failed expected load"); 1.56 + is(SpecialPowers.wrap(document.getElementById("shouldIgnoreType")).displayedType, OBJLC.TYPE_PLUGIN, "Testing object load with type, failed expected load"); 1.57 + is(SpecialPowers.wrap(document.getElementById("shouldNotLoad")).displayedType, OBJLC.TYPE_NULL, "Testing object load with typemustmatch, load success even though failure expected"); 1.58 + is(SpecialPowers.wrap(document.getElementById("shouldNotLoadMissingType")).displayedType, OBJLC.TYPE_NULL, "Testing object load with typemustmatch and with type, load success even though failure expected"); 1.59 + is(SpecialPowers.wrap(document.getElementById("shouldLoadMissingData")).displayedType, OBJLC.TYPE_PLUGIN, "Testing object load with typemustmatch and without data, failed expected load"); 1.60 + SimpleTest.finish(); 1.61 +}, false); 1.62 + 1.63 +</script> 1.64 +</pre> 1.65 +</body> 1.66 +</html>