widget/tests/test_plugin_scroll_consistency.html
author Jan de Mooij <jdemooij@mozilla.com>
Sat, 12 Jan 2019 10:50:04 +0000
changeset 453631 cfa1c48c717048f00eb4811b5719cd716eb1e5b3
parent 223012 562c336394da0ab60cdf979f89566d9c1cc1f6d5
child 459392 0e0638c8ef27dea641754aae390213e829eb71f3
permissions -rw-r--r--
Bug 1518753 part 5 - Stop using JSProtoKey for initial shapes. r=tcampbell I added this optimization in bug 1299107 to share more shapes across compartments. Unfortunately this doesn't play well with same-compartment realms (ICs can misbehave) because it relies on compartments being isolated from each other. I think we should remove this optimization: * Fixing the IC issue is impossible without deoptimizing everything. * I added it mainly for chrome globals. The shared-JSM-global work has eliminated the need for this there. * Same-compartment realms win memory back by eliminating CCWs etc. * It's quite a lot of complicated code. Differential Revision: https://phabricator.services.mozilla.com/D16170

<html>
<head>
  <title>Test for plugin child widgets not being messed up by scrolling</title>
  <script type="text/javascript"
          src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
  <script type="text/javascript" src="utils.js"></script>
  <link rel="stylesheet" type="text/css"
          href="chrome://mochikit/content/tests/SimpleTest/test.css" />
</head>
<body onload="setTimeout(runTests, 0)">
<script type="application/javascript">
setTestPluginEnabledState(SpecialPowers.Ci.nsIPluginTag.STATE_ENABLED);
</script>

<p id="display">
  <div style="overflow:hidden; height:100px;" id="scroll">
    <embed type="application/x-test" wmode="window" width="100" height="800" id="plugin"></object>
    <div style="height:1000px;"></div>
  </div>
</p>
<div id="content" style="display: none">

</div>
<pre id="test">
</pre>

<script class="testbody" type="application/javascript">
SimpleTest.waitForExplicitFinish();

var plugin = document.getElementById("plugin");

function consistencyCheck(state) {
  var s = plugin.doInternalConsistencyCheck();
  ok(s == "", "Consistency check: " + state + ": " + s);
}

function runTests()
{
  consistencyCheck("Initial state");

  var scroll = document.getElementById("scroll");
  scroll.scrollTop = 10;
  consistencyCheck("Scrolled down a bit");

  setTimeout(function() {
    consistencyCheck("Before scrolling back to top");
    scroll.scrollTop = 0;
    consistencyCheck("Scrolled to top");

    setTimeout(function() {
      consistencyCheck("After scrolling to top");

      SimpleTest.finish();
    }, 0);
  }, 0);
}

</script>
</body>

</html>