summaryrefslogtreecommitdiffstats
path: root/embedding/test/test_window_open_position_constraint.html
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /embedding/test/test_window_open_position_constraint.html
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'embedding/test/test_window_open_position_constraint.html')
-rw-r--r--embedding/test/test_window_open_position_constraint.html56
1 files changed, 56 insertions, 0 deletions
diff --git a/embedding/test/test_window_open_position_constraint.html b/embedding/test/test_window_open_position_constraint.html
new file mode 100644
index 000000000..d2c777c74
--- /dev/null
+++ b/embedding/test/test_window_open_position_constraint.html
@@ -0,0 +1,56 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+ <title>Test for Bug 978847</title>
+ <script type="text/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=978847">Mozilla Bug 978847</a>
+<p id="display"></p>
+</div>
+<pre id="test">
+<script class="testbody" type="text/javascript">
+SimpleTest.waitForExplicitFinish();
+
+SimpleTest.waitForFocus(function() {
+ var x;
+ var y;
+
+ // window should be constrained to the screen rect,
+ // which we assume is less than 10000px square
+ var w1 = window.open("about:blank", "", "left=16000,top=16000,width=100,height=100");
+ SimpleTest.waitForFocus(function() {
+ ok(w1.screenX < 10000 && w1.screenY < 10000,
+ "window should not be opened off-screen: got location " +
+ w1.screenX + "," + w1.screenY);
+ x = w1.screenX;
+ y = w1.screenY;
+ w1.close();
+
+ // larger window dimensions should result in a shift of the constrained location
+ var w2 = window.open("about:blank", "", "left=16000,top=16000,width=150,height=150");
+ SimpleTest.waitForFocus(function() {
+ ok(w2.screenX == x - 50 && w2.screenY == y - 50,
+ "constrained window position did not depend on size as expected: got " +
+ w2.screenX + "," + w2.screenY + ", expected " + (x - 50) + "," + (y - 50));
+ w2.close();
+
+ // now try with coordinates that are close to MAXINT,
+ // so adding width/height risks 32-bit integer overflow
+ var w3 = window.open("about:blank", "", "left=2147483600,top=2147483600,width=100,height=100");
+ SimpleTest.waitForFocus(function() {
+ ok(w3.screenX < 10000 && w3.screenY < 10000,
+ "window should not be opened off-screen: got location " +
+ w3.screenX + "," + w3.screenY);
+ w3.close();
+ SimpleTest.finish();
+ }, w3, true);
+ }, w2, true);
+ }, w1, true);
+}, window, false);
+
+</script>
+</pre>
+</body>
+</html>