content/base/test/test_bug827160.html

Thu, 15 Jan 2015 21:03:48 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 21:03:48 +0100
branch
TOR_BUG_9701
changeset 11
deefc01c0e14
permissions
-rw-r--r--

Integrate friendly tips from Tor colleagues to make (or not) 4.5 alpha 3;
This includes removal of overloaded (but unused) methods, and addition of
a overlooked call to DataStruct::SetData(nsISupports, uint32_t, bool.)

michael@0 1 <!DOCTYPE HTML>
michael@0 2 <html>
michael@0 3 <!--
michael@0 4 https://bugzilla.mozilla.org/show_bug.cgi?id=827160
michael@0 5 -->
michael@0 6 <head>
michael@0 7 <meta charset="utf-8">
michael@0 8 <title>Test for Bug 827160</title>
michael@0 9 <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
michael@0 10 <script type="application/javascript" src="/tests/SimpleTest/SpecialPowers.js"></script>
michael@0 11 <script type="application/javascript" src="utils.js"></script>
michael@0 12 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
michael@0 13 </head>
michael@0 14 <body>
michael@0 15 <a target="_blank" href=https://bugzilla.mozilla.org/show_bug.cgi?id=827160">Mozilla Bug 827160</a>
michael@0 16
michael@0 17 <script type="application/javascript">
michael@0 18
michael@0 19 // Make sure the test plugin is not click-to-play
michael@0 20 var pluginHost = SpecialPowers.Cc["@mozilla.org/plugin/host;1"]
michael@0 21 .getService(SpecialPowers.Ci.nsIPluginHost);
michael@0 22 var pluginTags = pluginHost.getPluginTags();
michael@0 23 for (var tag of pluginTags) {
michael@0 24 if (tag.name == "Test Plug-in" || tag.name == "Second Test Plug-in") {
michael@0 25 var oldEnabledState = tag.enabledState;
michael@0 26 tag.enabledState = SpecialPowers.Ci.nsIPluginTag.STATE_ENABLED;
michael@0 27 SimpleTest.registerCleanupFunction(function() {
michael@0 28 tag.enabledState = oldEnabledState;
michael@0 29 });
michael@0 30 }
michael@0 31 }
michael@0 32
michael@0 33 </script>
michael@0 34
michael@0 35 <!-- Should load test plugin application/x-test -->
michael@0 36 <object id="shouldLoad" data="data:application/x-test,foo"></object>
michael@0 37 <!-- Should load test plugin application/x-test2, ignoring type="" -->
michael@0 38 <object id="shouldIgnoreType" type="application/x-test" data="data:application/x-test2,foo"></object>
michael@0 39 <!-- Should load nothing, channel type does not match type and typeMustMatch is present -->
michael@0 40 <object id="shouldNotLoad" type="application/x-test" data="data:application/x-test2,foo" typemustmatch></object>
michael@0 41 <!-- Should not load test plugin application/x-test2, no type field is present -->
michael@0 42 <object id="shouldNotLoadMissingType" data="data:application/x-test2,foo" typemustmatch></object>
michael@0 43 <!-- Should load, no data field is present -->
michael@0 44 <object id="shouldLoadMissingData" type="application/x-test" typemustmatch></object>
michael@0 45 <pre id="test">
michael@0 46
michael@0 47 <script type="application/javascript">
michael@0 48 SimpleTest.waitForExplicitFinish();
michael@0 49
michael@0 50 window.addEventListener("load", function () {
michael@0 51 const OBJLC = SpecialPowers.Ci.nsIObjectLoadingContent;
michael@0 52 is(SpecialPowers.wrap(document.getElementById("shouldLoad")).displayedType, OBJLC.TYPE_PLUGIN, "Testing object load without type, failed expected load");
michael@0 53 is(SpecialPowers.wrap(document.getElementById("shouldIgnoreType")).displayedType, OBJLC.TYPE_PLUGIN, "Testing object load with type, failed expected load");
michael@0 54 is(SpecialPowers.wrap(document.getElementById("shouldNotLoad")).displayedType, OBJLC.TYPE_NULL, "Testing object load with typemustmatch, load success even though failure expected");
michael@0 55 is(SpecialPowers.wrap(document.getElementById("shouldNotLoadMissingType")).displayedType, OBJLC.TYPE_NULL, "Testing object load with typemustmatch and with type, load success even though failure expected");
michael@0 56 is(SpecialPowers.wrap(document.getElementById("shouldLoadMissingData")).displayedType, OBJLC.TYPE_PLUGIN, "Testing object load with typemustmatch and without data, failed expected load");
michael@0 57 SimpleTest.finish();
michael@0 58 }, false);
michael@0 59
michael@0 60 </script>
michael@0 61 </pre>
michael@0 62 </body>
michael@0 63 </html>

mercurial