|
1 // |reftest| skip-if(xulRuntime.OS=="WINNT"&&isDebugBuild) slow |
|
2 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
|
3 /* This Source Code Form is subject to the terms of the Mozilla Public |
|
4 * License, v. 2.0. If a copy of the MPL was not distributed with this |
|
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
6 |
|
7 //----------------------------------------------------------------------------- |
|
8 var BUGNUMBER = 127243; |
|
9 var summary = 'Do not crash on watch'; |
|
10 var actual = 'No Crash'; |
|
11 var expect = 'No Crash'; |
|
12 |
|
13 printBugNumber(BUGNUMBER); |
|
14 printStatus (summary); |
|
15 |
|
16 if (typeof window != 'undefined' && typeof document != 'undefined') |
|
17 { |
|
18 // delay test driver end |
|
19 gDelayTestDriverEnd = true; |
|
20 window.addEventListener('load', handleLoad, false); |
|
21 } |
|
22 else |
|
23 { |
|
24 printStatus('This test must be run in the browser'); |
|
25 reportCompare(expect, actual, summary); |
|
26 |
|
27 } |
|
28 |
|
29 var div; |
|
30 |
|
31 function handleLoad() |
|
32 { |
|
33 div = document.createElement('div'); |
|
34 document.body.appendChild(div); |
|
35 div.setAttribute('id', 'id1'); |
|
36 div.style.width = '50px'; |
|
37 div.style.height = '100px'; |
|
38 div.style.overflow = 'auto'; |
|
39 |
|
40 for (var i = 0; i < 5; i++) |
|
41 { |
|
42 var p = document.createElement('p'); |
|
43 var t = document.createTextNode('blah'); |
|
44 p.appendChild(t); |
|
45 div.appendChild(p); |
|
46 } |
|
47 |
|
48 div.watch('scrollTop', wee); |
|
49 |
|
50 setTimeout('setScrollTop()', 1000); |
|
51 } |
|
52 |
|
53 function wee(id, oldval, newval) |
|
54 { |
|
55 var t = document.createTextNode('setting ' + id + |
|
56 ' value ' + div.scrollTop + |
|
57 ' oldval ' + oldval + |
|
58 ' newval ' + newval); |
|
59 var p = document.createElement('p'); |
|
60 p.appendChild(t); |
|
61 document.body.appendChild(p); |
|
62 |
|
63 return newval; |
|
64 } |
|
65 |
|
66 function setScrollTop() |
|
67 { |
|
68 div.scrollTop = 42; |
|
69 |
|
70 reportCompare(expect, actual, summary); |
|
71 |
|
72 gDelayTestDriverEnd = false; |
|
73 jsTestDriverEnd(); |
|
74 |
|
75 } |