Bug 852315 - Test. r=bsmedberg
authorJohn Schoenick <jschoenick@mozilla.com>
Tue, 23 Apr 2013 13:58:23 -0700
changeset 170906 0d186c979373404e260d6c7eced71f784427a03f
parent 170905 5c9e441390235b20b9b67ac9a0bbf0af5f95c2b4
child 170907 e581cbef0dd93a2d0b4f3ed4466f4a26253ef959
push id270
push userpvanderbeken@mozilla.com
push dateThu, 06 Mar 2014 09:24:21 +0000
reviewersbsmedberg
bugs852315
milestone30.0a1
Bug 852315 - Test. r=bsmedberg
dom/plugins/test/mochitest/mochitest.ini
dom/plugins/test/mochitest/test_bug852315.html
--- a/dom/plugins/test/mochitest/mochitest.ini
+++ b/dom/plugins/test/mochitest/mochitest.ini
@@ -28,16 +28,17 @@ support-files =
 [test_bug532208.html]
 [test_bug539565-1.html]
 [test_bug539565-2.html]
 [test_bug738396.html]
 [test_bug771202.html]
 [test_bug777098.html]
 [test_bug784131.html]
 [test_bug813906.html]
+[test_bug852315.html]
 [test_bug854082.html]
 [test_bug863792.html]
 [test_bug967694.html]
 [test_cocoa_focus.html]
 skip-if = toolkit != "cocoa"
 support-files = cocoa_focus.html
 [test_cocoa_window_focus.html]
 skip-if = toolkit != "cocoa"
new file mode 100644
--- /dev/null
+++ b/dom/plugins/test/mochitest/test_bug852315.html
@@ -0,0 +1,49 @@
+<!doctype html>
+<html>
+<head>
+  <title>Test for Bug 852315</title>
+  <script type="application/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"/>
+
+  <meta http-equiv="content-type" content="text/html; charset=utf-8">
+  <base href="chrome://browser/content/">
+</head>
+<body>
+<script type="application/javascript">
+
+SimpleTest.waitForExplicitFinish();
+setTestPluginEnabledState(SpecialPowers.Ci.nsIPluginTag.STATE_ENABLED);
+
+// Tests that the document-inactive notification stopping plugins does not
+// fatally re-enter when adding other plugins to the document.
+
+var i = document.createElement("iframe");
+var ob = document.body;
+i.addEventListener("load", function loadfunc() {
+  var d = i.contentWindow.document;
+  var e = i.contentDocument.createElement("embed");
+  var destroyran = false;
+  e.type = "application/x-test";
+  i.contentDocument.body.appendChild(e);
+
+  // On despawn, append an embed tag to document.
+  e.callOnDestroy(function() {
+    var e2 = d.createElement("embed");
+    d.body.appendChild(e2);
+    destroyran = true;
+  });
+
+  // Navigate the frame to cause the document with the plugin to go inactive
+  i.removeEventListener("load", loadfunc);
+  i.src = "about:blank";
+  SimpleTest.executeSoon(function() {
+    ok(destroyran, "OnDestroy callback ran and did not crash");
+    SimpleTest.finish();
+  });
+});
+document.body.appendChild(i);
+
+</script>
+</body>
+</html>