Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | <!doctype html> |
michael@0 | 2 | <html> |
michael@0 | 3 | <head> |
michael@0 | 4 | <title>Test for Bug 784131</title> |
michael@0 | 5 | <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> |
michael@0 | 6 | <script type="application/javascript" src="utils.js"></script> |
michael@0 | 7 | <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> |
michael@0 | 8 | |
michael@0 | 9 | <meta http-equiv="content-type" content="text/html; charset=utf-8"> |
michael@0 | 10 | <base href="chrome://browser/content/"> |
michael@0 | 11 | </head> |
michael@0 | 12 | <body> |
michael@0 | 13 | |
michael@0 | 14 | <script type="text/javascript"> |
michael@0 | 15 | setTestPluginEnabledState(SpecialPowers.Ci.nsIPluginTag.STATE_ENABLED); |
michael@0 | 16 | </script> |
michael@0 | 17 | |
michael@0 | 18 | <embed id="body" type="application/x-test"> |
michael@0 | 19 | <div> |
michael@0 | 20 | <embed id="nested" type="application/x-test"> |
michael@0 | 21 | </div> |
michael@0 | 22 | |
michael@0 | 23 | <script type="application/javascript"> |
michael@0 | 24 | function getObjectValue(obj) { |
michael@0 | 25 | try { |
michael@0 | 26 | return obj.getObjectValue(); |
michael@0 | 27 | } catch (e) { |
michael@0 | 28 | return null; |
michael@0 | 29 | } |
michael@0 | 30 | } |
michael@0 | 31 | SimpleTest.waitForExplicitFinish(); |
michael@0 | 32 | |
michael@0 | 33 | var body_embed = document.querySelector("embed#body"); |
michael@0 | 34 | var nested_embed = document.querySelector("embed#nested"); |
michael@0 | 35 | var nested_parent = nested_embed.parentNode; |
michael@0 | 36 | // Ensure plugins are spawned |
michael@0 | 37 | var body_obj = getObjectValue(body_embed); |
michael@0 | 38 | var nested_obj = getObjectValue(nested_embed); |
michael@0 | 39 | isnot(body_obj, null, "body plugin spawned"); |
michael@0 | 40 | isnot(nested_obj, null, "nested plugin spawned"); |
michael@0 | 41 | // Display:none the plugin and the nested plugin's parent |
michael@0 | 42 | body_embed.style.display = "none"; |
michael@0 | 43 | nested_parent.style.display = "none"; |
michael@0 | 44 | body_embed.clientTop; |
michael@0 | 45 | nested_embed.clientTop; |
michael@0 | 46 | |
michael@0 | 47 | // Plugins should still be running the same instance |
michael@0 | 48 | ok(body_embed.checkObjectValue(body_obj), "body plugin still running"); |
michael@0 | 49 | ok(nested_embed.checkObjectValue(nested_obj), "nested plugin still running"); |
michael@0 | 50 | // Spin event loop |
michael@0 | 51 | SimpleTest.executeSoon(function() { |
michael@0 | 52 | // Plugins should be stopped |
michael@0 | 53 | is(getObjectValue(body_embed), null, "body plugin gone"); |
michael@0 | 54 | is(getObjectValue(nested_embed), null, "nested plugin gone"); |
michael@0 | 55 | |
michael@0 | 56 | // Restart plugins... |
michael@0 | 57 | body_embed.style.display = "inherit"; |
michael@0 | 58 | nested_parent.style.display = "inherit"; |
michael@0 | 59 | |
michael@0 | 60 | // Ensure plugins are spawned |
michael@0 | 61 | var body_obj = getObjectValue(body_embed); |
michael@0 | 62 | var nested_obj = getObjectValue(nested_embed); |
michael@0 | 63 | isnot(body_obj, null, "body plugin spawned"); |
michael@0 | 64 | isnot(nested_obj, null, "nested plugin spawned"); |
michael@0 | 65 | |
michael@0 | 66 | // Take away frames again, flush layout, restore frames |
michael@0 | 67 | body_embed.style.display = "none"; |
michael@0 | 68 | nested_parent.style.display = "none"; |
michael@0 | 69 | body_embed.clientTop; |
michael@0 | 70 | nested_embed.clientTop; |
michael@0 | 71 | body_embed.style.display = "inherit"; |
michael@0 | 72 | nested_parent.style.display = "inherit"; |
michael@0 | 73 | body_embed.clientTop; |
michael@0 | 74 | nested_embed.clientTop; |
michael@0 | 75 | |
michael@0 | 76 | // Spin event loop, ensure plugin remains running |
michael@0 | 77 | SimpleTest.executeSoon(function() { |
michael@0 | 78 | ok(body_embed.checkObjectValue(body_obj), "body plugin still running"); |
michael@0 | 79 | ok(nested_embed.checkObjectValue(nested_obj), "nested plugin still running"); |
michael@0 | 80 | SimpleTest.finish(); |
michael@0 | 81 | }); |
michael@0 | 82 | }); |
michael@0 | 83 | </script> |
michael@0 | 84 | </body> |
michael@0 | 85 | </html> |