Bug 1313927 - Create separated test to disable it on Android only. r=jet
☠☠ backed out by 7457db3be275 ☠ ☠
authorTobias Schneider <schneider@jancona.com>
Fri, 21 Apr 2017 12:08:48 -0700
changeset 567067 827141143dc93f77a9d2862b23def5726c47201e
parent 567066 332fa2188d891a1aa15c9c98fd2e1f7007a46239
child 567068 e41a0de745aee09f4bd80cf09b60336ebf52abbb
push id55429
push userbmo:hskupin@gmail.com
push dateMon, 24 Apr 2017 10:48:57 +0000
reviewersjet
bugs1313927
milestone55.0a1
Bug 1313927 - Create separated test to disable it on Android only. r=jet
dom/base/test/intersectionobserver_window.html
dom/base/test/mochitest.ini
dom/base/test/test_bug1313927.html
dom/base/test/test_intersectionobservers.html
--- a/dom/base/test/intersectionobserver_window.html
+++ b/dom/base/test/intersectionobserver_window.html
@@ -14,21 +14,31 @@
 <body>
 <div id="target"></div>
 <script>
         var io = new IntersectionObserver(function(records) {
           var viewportWidth =
               document.documentElement.clientWidth || document.body.clientWidth;
           var viewportHeight =
               document.documentElement.clientHeight || document.body.clientHeight;
-          var passed = records.length === 1 &&
+          var result = records.length === 1 &&
                        records[0].rootBounds.top === 0 &&
                        records[0].rootBounds.left === 0 &&
                        records[0].rootBounds.right === viewportWidth &&
                        records[0].rootBounds.width === viewportWidth &&
                        records[0].rootBounds.bottom === viewportHeight &&
                        records[0].rootBounds.height === viewportHeight;
-          window.opener.postMessage(passed, '*');
+          if (!result) {
+              result = [records[0].rootBounds.top,
+                        records[0].rootBounds.left,
+                        records[0].rootBounds.right,
+                        records[0].rootBounds.width,
+                        records[0].rootBounds.bottom,
+                        records[0].rootBounds.height,
+                        viewportWidth,
+                        viewportHeight].join(',');
+          }
+          window.opener.postMessage(result, '*');
         });
         io.observe(document.getElementById("target"));
 </script>
 </body>
 </html>
--- a/dom/base/test/mochitest.ini
+++ b/dom/base/test/mochitest.ini
@@ -650,16 +650,18 @@ skip-if = (toolkit == 'android') # Andro
 [test_iframe_referrer_changing.html]
 [test_iframe_referrer_invalid.html]
 [test_Image_constructor.html]
 [test_img_referrer.html]
 [test_innersize_scrollport.html]
 [test_integer_attr_with_leading_zero.html]
 [test_intersectionobservers.html]
 skip-if = true # Track Bug 1320704
+[test_bug1313927.html]
+skip-if = (os == "android") # bug 1313927
 [test_link_prefetch.html]
 skip-if = !e10s # Track Bug 1281415
 [test_link_stylesheet.html]
 [test_messagemanager_targetchain.html]
 [test_meta_viewport0.html]
 skip-if = (os != 'android')    # meta-viewport tag support is mobile-only
 [test_meta_viewport1.html]
 skip-if = (os != 'android')    # meta-viewport tag support is mobile-only
new file mode 100644
--- /dev/null
+++ b/dom/base/test/test_bug1313927.html
@@ -0,0 +1,32 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+  <meta charset="utf-8">
+  <title>Test for Bug 1313927</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=1313927">Mozilla Bug 1313927</a>
+<p id="display"></p>
+<pre id="test">
+<script type="application/javascript">
+
+    var win;
+
+    window.onmessage = function (e) {
+        win.close();
+        is(e.data, true);
+        SimpleTest.finish();
+    };
+
+    win = window.open("intersectionobserver_window.html");
+
+    SimpleTest.waitForExplicitFinish();
+
+</script>
+</pre>
+<div id="log">
+</div>
+</body>
+</html>
--- a/dom/base/test/test_intersectionobservers.html
+++ b/dom/base/test/test_intersectionobservers.html
@@ -895,27 +895,16 @@ limitations under the License.
         }, {root: rootEl, threshold: [1]});
 
         io.observe(targetEl1);
         callDelayed(function() {
           targetEl1.style.transform = 'translateX(-40px) translateY(-40px)';
         }, 0);
       });
 
-
-      it('uses the viewport when no root is specified', function(done) {
-        window.onmessage = function (e) {
-          expect(e.data).to.be.ok();
-          win.close();
-          done();
-        };
-
-        var win = window.open("intersectionobserver_window.html");
-      });
-
       it('triggers only once if observed multiple times (and does not crash when collected)', function(done) {
         var spy = sinon.spy();
         io = new IntersectionObserver(spy, {root: rootEl});
         io.observe(targetEl1);
         io.observe(targetEl1);
         io.observe(targetEl1);
 
         spy.waitForNotification(function() {