Bug 1062406 - Part 2: Tests. r=bz, a=lmandel
authorKearwood (Kip) Gilbert <kgilbert@mozilla.com>
Tue, 09 Sep 2014 11:34:00 +0200
changeset 224859 c143c4fb1627573f5a0244541de1cc2f010afddc
parent 224858 885dcc785dd4c2b219a4a7dfa132107b3f37c8df
child 224860 19a3efe721ca47bbca375147df32c882634ac413
push id3979
push userraliiev@mozilla.com
push dateMon, 13 Oct 2014 16:35:44 +0000
treeherdermozilla-beta@30f2cc610691 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbz, lmandel
bugs1062406
milestone34.0a2
Bug 1062406 - Part 2: Tests. r=bz, a=lmandel - Implemented a mochitest to ensure that non-finite values passed to window.scroll, window.scrollTo, and window.scrollBy are interpreted as 0.
layout/generic/test/mochitest.ini
layout/generic/test/test_bug1062406.html
--- a/layout/generic/test/mochitest.ini
+++ b/layout/generic/test/mochitest.ini
@@ -87,16 +87,17 @@ skip-if = (buildapp == 'b2g' && toolkit 
 [test_bug785324.html]
 [test_bug791616.html]
 skip-if = buildapp == 'b2g' # b2g(Target should not have scrolled - got 114.10000610351562, expected 115.39999389648438) b2g-debug(Target should not have scrolled - got 114.10000610351562, expected 115.39999389648438) b2g-desktop(Target should not have scrolled - got 114.10000610351562, expected 115.39999389648438)
 [test_bug831780.html]
 [test_bug841361.html]
 [test_bug904810.html]
 [test_bug938772.html]
 [test_bug970363.html]
+[test_bug1062406.html]
 [test_contained_plugin_transplant.html]
 skip-if = os=='win' || e10s
 [test_image_selection.html]
 [test_image_selection_2.html]
 [test_invalidate_during_plugin_paint.html]
 skip-if = buildapp == 'mulet' || buildapp == 'b2g' || toolkit == 'android' || e10s # b2g(plugins not supported) b2g-debug(plugins not supported) b2g-desktop(plugins not supported)
 [test_movement_by_characters.html]
 [test_movement_by_words.html]
new file mode 100644
--- /dev/null
+++ b/layout/generic/test/test_bug1062406.html
@@ -0,0 +1,39 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=1062406
+-->
+<head>
+  <title>Test for Bug 1062406</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=1062406">Mozilla Bug 1062406</a>
+<div id="content" style="display: none">
+  
+</div>
+<div style="width:10000px; height:10000px"></div>
+<pre id="test">
+<script type="application/javascript">
+
+  /** Test for Bug 1062406 **/
+  window.scroll(100, 100);
+  window.scroll(NaN, NaN);
+  is(window.scrollX, 0, "window.scroll x parameter must treat NaN as 0.");
+  is(window.scrollY, 0, "window.scroll y parameter must treat NaN as 0.");
+
+  window.scroll(100, 100);
+  window.scroll(Infinity, Infinity);
+  is(window.scrollX, 0, "window.scroll x parameter must treat Infinity as 0.");
+  is(window.scrollY, 0, "window.scroll y parameter must treat Infinity as 0.");
+
+  window.scroll(100, 100);
+  window.scroll(-Infinity, -Infinity);
+  is(window.scrollX, 0, "window.scroll x parameter must treat -Infinity as 0.");
+  is(window.scrollY, 0, "window.scroll y parameter must treat -Infinity as 0.");
+
+</script>
+</pre>
+</body>
+</html>