js/src/tests/js1_5/Regress/regress-127243.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/js/src/tests/js1_5/Regress/regress-127243.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,75 @@
     1.4 +// |reftest| skip-if(xulRuntime.OS=="WINNT"&&isDebugBuild) slow
     1.5 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     1.6 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.7 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.8 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.9 +
    1.10 +//-----------------------------------------------------------------------------
    1.11 +var BUGNUMBER = 127243;
    1.12 +var summary = 'Do not crash on watch';
    1.13 +var actual = 'No Crash';
    1.14 +var expect = 'No Crash';
    1.15 +
    1.16 +printBugNumber(BUGNUMBER);
    1.17 +printStatus (summary);
    1.18 +
    1.19 +if (typeof window != 'undefined' && typeof document != 'undefined') 
    1.20 +{
    1.21 +  // delay test driver end
    1.22 +  gDelayTestDriverEnd = true;
    1.23 +  window.addEventListener('load', handleLoad, false);
    1.24 +}
    1.25 +else
    1.26 +{
    1.27 +  printStatus('This test must be run in the browser');
    1.28 +  reportCompare(expect, actual, summary);
    1.29 +
    1.30 +}
    1.31 +
    1.32 +var div;
    1.33 +
    1.34 +function handleLoad()
    1.35 +{
    1.36 +  div = document.createElement('div');
    1.37 +  document.body.appendChild(div);
    1.38 +  div.setAttribute('id', 'id1');
    1.39 +  div.style.width = '50px';
    1.40 +  div.style.height = '100px';
    1.41 +  div.style.overflow = 'auto';
    1.42 +
    1.43 +  for (var i = 0; i < 5; i++)
    1.44 +  {
    1.45 +    var p = document.createElement('p');
    1.46 +    var t = document.createTextNode('blah');
    1.47 +    p.appendChild(t);
    1.48 +    div.appendChild(p);
    1.49 +  }
    1.50 +
    1.51 +  div.watch('scrollTop', wee);
    1.52 +
    1.53 +  setTimeout('setScrollTop()', 1000);
    1.54 +}
    1.55 +
    1.56 +function wee(id, oldval, newval)
    1.57 +{
    1.58 +  var t = document.createTextNode('setting ' + id +
    1.59 +                                  ' value ' + div.scrollTop +
    1.60 +                                  ' oldval ' + oldval +
    1.61 +                                  ' newval ' + newval);
    1.62 +  var p = document.createElement('p');
    1.63 +  p.appendChild(t);
    1.64 +  document.body.appendChild(p);
    1.65 +
    1.66 +  return newval;
    1.67 +}
    1.68 +
    1.69 +function setScrollTop()
    1.70 +{
    1.71 +  div.scrollTop = 42;
    1.72 +
    1.73 +  reportCompare(expect, actual, summary);
    1.74 +
    1.75 +  gDelayTestDriverEnd = false;
    1.76 +  jsTestDriverEnd();
    1.77 +
    1.78 +}

mercurial