Bug 771202 - Tests. r=bsmedberg
☠☠ backed out by f658278070ac ☠ ☠
authorBobby Holley <bobbyholley@gmail.com>
Fri, 13 Jul 2012 10:55:14 +0200
changeset 101889 776f008404bf865b0eed45c19392a2fff16cb945
parent 101888 ff73dacf8eb303427185448d5b0dbee9db246151
child 101890 e9203900ce6c00a5e85e76fbb725e5c4fe816681
push idunknown
push userunknown
push dateunknown
reviewersbsmedberg
bugs771202
milestone16.0a1
Bug 771202 - Tests. r=bsmedberg
dom/plugins/test/mochitest/Makefile.in
dom/plugins/test/mochitest/file_bug771202.html
dom/plugins/test/mochitest/test_bug771202.html
--- a/dom/plugins/test/mochitest/Makefile.in
+++ b/dom/plugins/test/mochitest/Makefile.in
@@ -59,16 +59,18 @@ MOCHITEST_FILES = \
   test_crashing.html \
   $(warning test_crashing2.html disabled due to random orange; see bug 566049) \
   test_hanging.html \
   crashing_subpage.html \
   test_GCrace.html \
   test_propertyAndMethod.html \
   test_bug539565-1.html \
   test_bug539565-2.html \
+  test_bug771202.html \
+  file_bug771202.html \
   test_enumerate.html \
   test_npruntime_construct.html \
   307-xo-redirect.sjs \
   test_redirect_handling.html \
   test_zero_opacity.html \
   test_NPPVpluginWantsAllNetworkStreams.html \
   test_npruntime_npnsetexception.html \
   test_NPNVdocumentOrigin.html \
new file mode 100644
--- /dev/null
+++ b/dom/plugins/test/mochitest/file_bug771202.html
@@ -0,0 +1,9 @@
+<!DOCTYPE html>
+<html>
+<head>
+</head>
+<body>
+  <embed id="pluginElement" type="application/x-test" width="200" height="200"></embed>
+  <marquee id="marqueeElement">Always on the move!</marquee>
+</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/dom/plugins/test/mochitest/test_bug771202.html
@@ -0,0 +1,67 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=771202
+-->
+<head>
+  <meta charset="utf-8">
+  <title>Test for Bug 771202</title>
+  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=771202">Mozilla Bug 771202</a>
+<pre id="test">
+<script type="application/javascript">
+
+/** Test for recreating spliced prototype chains (XBL and plugins) after
+    tranplant. **/
+SimpleTest.waitForExplicitFinish();
+
+function go() {
+  // Set things up.
+  var win = document.getElementById('ifr').contentWindow;
+  var plugin = win.document.getElementById('pluginElement');
+  var marquee = win.document.getElementById('marqueeElement');
+  var testValue = plugin.getObjectValue();
+
+  function checkPlugin() {
+      dump("About to call checkObjectValue\n");
+      ok(plugin.checkObjectValue(testValue), 'Plugin proto should work correctly');
+  }
+
+  // It's not great to depend on implementation details of the XBL-implemented
+  // <marquee> element here, but it's simpler than trying to rig up a custom XBL
+  // test binding here.
+  function checkMarquee() {
+    try {
+      is(marquee.behavior, 'scroll', 'XBL proto should work correctly');
+    } catch (e) {
+      ok(false, 'XBL proto broken');
+    }
+  }
+
+  // First, check things before transplanting.
+  checkPlugin();
+  checkMarquee();
+
+  // Adopt the plugin and retest.
+  document.body.appendChild(plugin);
+  checkPlugin();
+
+  // Adopt the marquee and retest. Note that the binding is applied
+  // asynchronously in this case, so we need to check asynchronously
+  // as well.
+  document.body.appendChild(marquee);
+  setTimeout(function() {
+    checkMarquee();
+    SimpleTest.finish();
+  }, 0);
+}
+
+</script>
+</pre>
+
+<iframe id="ifr" onload="go();" src="file_bug771202.html">
+</body>
+</html>