author Nicholas Nethercote <nnethercote@mozilla.com>
Wed, 25 Oct 2017 10:22:38 +1100
changeset 387909 3d0093f961eec929caa370444cd0f7fcbfbc82bc
parent 222958 562c336394da0ab60cdf979f89566d9c1cc1f6d5
child 459500 0e0638c8ef27dea641754aae390213e829eb71f3
permissions -rw-r--r--
Bug 1410794 - Change some |string| occurrences in nsIPrefBranch.idl to |ACString|. r=erahm. This makes the code nicer. In particular, it removes many getter_Copies() calls. The patch also converts a lot of nsCStrings to nsAutoCString, which will avoid heap allocation in the common case. The patch also renames PREF_CopyCharPref() as PREF_GetCStringPref(), because it's actually getting a string, not a char, and that matches the existing GetCString() and GetDefaultCString() methods. Correspondingly, it also renames PREF_SetCharPref() as PREF_SetCStringPref(). The |aPrefName| arguments in nsIPrefBranch.idl remain as |string| because they almost always involve passing in C string literals, and passing "foo" is much nicer than passing NS_LITERAL_CSTRING("foo"). It's worth noting that early versions of this patch used |AUTF8String| instead of |ACString|. But it turns out that libpref stores prefs internally as Latin1. And |ACString| is compatible with Latin1 but |AUTF8String| isn't, because non-ASCII Latin1 strings are not valid UTF-8!

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

<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 id="content" style="display: none">

<pre id="test">

<script class="testbody" type="application/javascript">

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");

    }, 0);
  }, 0);