Backed out changeset abaf54d32b12 (bug 1243846)
authorSebastian Hengst <archaeopteryx@coole-files.de>
Wed, 26 Oct 2016 18:49:07 +0200
changeset 346320 5303fe44c50afa58881d54170e0d81f60bbc6f61
parent 346319 78e4e0957ce33427d91564211413bd900c7afab0
child 346321 25a0cd1c3c3c6f4993f0e1d686612365fd64262b
push id10298
push userraliiev@mozilla.com
push dateMon, 14 Nov 2016 12:33:03 +0000
treeherdermozilla-aurora@7e29173b1641 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1243846
milestone52.0a1
backs outabaf54d32b12058820d8a5be414866962e4495ca
Backed out changeset abaf54d32b12 (bug 1243846)
dom/base/DOMIntersectionObserver.cpp
dom/base/test/intersectionobserver_iframe.html
dom/base/test/intersectionobserver_subframe.html
dom/base/test/intersectionobserver_window.html
dom/base/test/mochitest.ini
dom/base/test/test_intersectionobservers.html
--- a/dom/base/DOMIntersectionObserver.cpp
+++ b/dom/base/DOMIntersectionObserver.cpp
@@ -302,35 +302,18 @@ DOMIntersectionObserver::Update(nsIDocum
   }
 
   for (auto iter = mObservationTargets.Iter(); !iter.Done(); iter.Next()) {
     Element* target = iter.Get()->GetKey();
     nsIFrame* targetFrame = target->GetPrimaryFrame();
     nsRect targetRect;
     Maybe<nsRect> intersectionRect;
 
-    if (rootFrame && targetFrame) {
-      // If mRoot is set we are testing intersection with a container element
-      // instead of the implicit root.
-      if (mRoot) {
-        // Skip further processing of this target if it is not in the same
-        // Document as the intersection root, e.g. if root is an element of
-        // the main document and target an element from an embedded iframe.
-        if (target->GetComposedDoc() != root->GetComposedDoc()) {
-          continue;
-        }
-        // Skip further processing of this target if is not a descendant of the
-        // intersection root in the containing block chain. E.g. this would be
-        // the case if the target is in a position:absolute element whose
-        // containing block is an ancestor of root.
-        if (!nsLayoutUtils::IsAncestorFrameCrossDoc(rootFrame, targetFrame)) {
-          continue;
-        }
-      }
-
+    if (rootFrame && targetFrame &&
+       (!mRoot || nsLayoutUtils::IsAncestorFrameCrossDoc(rootFrame, targetFrame))) {
       targetRect = nsLayoutUtils::GetAllInFlowRectsUnion(
         targetFrame,
         nsLayoutUtils::GetContainingBlockForClientRect(targetFrame),
         nsLayoutUtils::RECTS_ACCOUNT_FOR_TRANSFORMS
       );
       intersectionRect = Some(targetFrame->GetVisualOverflowRect());
 
       nsIFrame* containerFrame = nsLayoutUtils::GetCrossDocParentFrame(targetFrame);
deleted file mode 100644
--- a/dom/base/test/intersectionobserver_iframe.html
+++ /dev/null
@@ -1,23 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<head>
-<style>
-#target5 {
-        position: absolute;
-        top: 0px;
-        left: 0px;
-        width: 20px;
-        height: 20px;
-        background: #f00;
-}
-</style>
-<body>
-<div id="target5"></div>
-<script>
-        var io = new IntersectionObserver(function (records) {
-                window.parent.postMessage(records[0].rootBounds == null, 'http://mochi.test:8888');
-        }, {});
-        io.observe(document.getElementById("target5"));
-</script>
-</body>
-</html>
new file mode 100644
--- /dev/null
+++ b/dom/base/test/intersectionobserver_subframe.html
@@ -0,0 +1,23 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+<style>
+#target5 {
+        position: absolute;
+        top: 0px;
+        left: 0px;
+        width: 20px;
+        height: 20px;
+        background: #f00;
+}
+</style>
+<body>
+<div id="target5"></div>
+<script>
+        var io = new IntersectionObserver(function (records) {
+                parent.postMessage(records[0].rootBounds == null, 'http://mochi.test:8888');
+        }, {});
+        io.observe(document.getElementById("target5"));
+</script>
+</body>
+</html>
deleted file mode 100644
--- a/dom/base/test/intersectionobserver_window.html
+++ /dev/null
@@ -1,34 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<head>
-<style>
-#target5 {
-        position: absolute;
-        top: 0px;
-        left: 0px;
-        width: 20px;
-        height: 20px;
-        background: #f00;
-}
-</style>
-<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 &&
-                       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, '*');
-        });
-        io.observe(document.getElementById("target"));
-</script>
-</body>
-</html>
--- a/dom/base/test/mochitest.ini
+++ b/dom/base/test/mochitest.ini
@@ -231,18 +231,17 @@ support-files =
   websocket_helpers.js
   websocket_tests.js
   !/dom/html/test/form_submit_server.sjs
   !/dom/security/test/cors/file_CrossSiteXHR_server.sjs
   !/image/test/mochitest/blue.png
   !/dom/xhr/tests/file_XHRSendData.sjs
   script_bug1238440.js
   file_blobURL_expiring.html
-  intersectionobserver_iframe.html
-  intersectionobserver_window.html
+  intersectionobserver_subframe.html
 
 [test_anchor_area_referrer.html]
 [test_anchor_area_referrer_changing.html]
 [test_anchor_area_referrer_invalid.html]
 [test_anchor_area_referrer_rel.html]
 [test_anonymousContent_api.html]
 [test_anonymousContent_append_after_reflow.html]
 [test_anonymousContent_canvas.html]
--- a/dom/base/test/test_intersectionobservers.html
+++ b/dom/base/test/test_intersectionobservers.html
@@ -25,18 +25,16 @@ limitations under the License.
   <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
 </head>
 <body onload="next()">
 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1243846">Mozilla Bug 1243846</a>
 <p id="display"></p>
 <pre id="test">
 <script type="application/javascript">
 
-  SpecialPowers.setIntPref("layout.visibility.min-notify-intersection-observers-interval-ms", 0);
-
   var tests = [];
   var curDescribeMsg = '';
   var curItMsg = '';
 
   function beforeEach_fn() { };
   function afterEach_fn() { };
 
   function before(fn) {
@@ -66,17 +64,17 @@ limitations under the License.
     });
   }
 
   requestAnimationFrame(function tick() {
     var i = callbacks.length;
     while (i--) {
       var cb = callbacks[i];
       if (+new Date() >= cb.time) {
-        SimpleTest.executeSoon(cb.fn);
+        cb.fn();
         callbacks.splice(i, 1);
       }
     }
     requestAnimationFrame(tick);
   });
 
   function expect(val) {
     return {
@@ -152,29 +150,22 @@ limitations under the License.
       }
     } else {
       SimpleTest.finish();
     }
   }
 
   var sinon = {
     spy: function () {
-      var callbacks = [];
       var fn = function () {
         fn.callCount++;
         fn.lastCall = { args: arguments };
-        if (callbacks.length) {
-          callbacks.shift()();
-        }
       };
       fn.callCount = 0;
       fn.lastCall = { args: [] };
-      fn.waitForNotification = (fn) => {
-        callbacks.push(fn);
-      };
       return fn;
     }
   };
 
   var ASYNC_TIMEOUT = 124;
 
 
   var io;
@@ -205,18 +196,16 @@ limitations under the License.
       addFixtures();
     });
 
 
     afterEach(function() {
       if (io && 'disconnect' in io) io.disconnect();
       io = null;
 
-      window.onmessage = null;
-
       removeStyles();
       removeFixtures();
     });
 
 
     describe('constructor', function() {
 
       it('throws when callback is not a function', function() {
@@ -335,121 +324,46 @@ limitations under the License.
         io.observe(targetEl2);
         callDelayed(function() {
           expect(spy.callCount).to.be(0);
           done();
         }, ASYNC_TIMEOUT);
       });
 
 
-      it('does not trigger if target is not a descendant of the intersection root in the containing block chain',
-          function(done) {
-
-        var spy = sinon.spy();
-        io = new IntersectionObserver(spy, {root: parentEl});
-
-        parentEl.style.position = 'static';
-        io.observe(targetEl2);
-        callDelayed(function() {
-          expect(spy.callCount).to.be(0);
-          done();
-        }, ASYNC_TIMEOUT);
-      });
-
-      it('triggers if target or root becomes invisible',
-          function(done) {
-
-        var spy = sinon.spy();
-        io = new IntersectionObserver(spy, {root: rootEl});
-
-        runSequence([
-          function(done) {
-            io.observe(targetEl1);
-            spy.waitForNotification(function() {
-              expect(spy.callCount).to.be(1);
-              var records = sortRecords(spy.lastCall.args[0]);
-              expect(records.length).to.be(1);
-              expect(records[0].intersectionRatio).to.be(1);
-              done();
-            }, ASYNC_TIMEOUT);
-          },
-          function(done) {
-            targetEl1.style.display = 'none';
-            spy.waitForNotification(function() {
-              expect(spy.callCount).to.be(2);
-              var records = sortRecords(spy.lastCall.args[0]);
-              expect(records.length).to.be(1);
-              expect(records[0].intersectionRatio).to.be(0);
-              done();
-            }, ASYNC_TIMEOUT);
-          },
-          function(done) {
-            targetEl1.style.display = 'block';
-            spy.waitForNotification(function() {
-              expect(spy.callCount).to.be(3);
-              var records = sortRecords(spy.lastCall.args[0]);
-              expect(records.length).to.be(1);
-              expect(records[0].intersectionRatio).to.be(1);
-              done();
-            }, ASYNC_TIMEOUT);
-          },
-          function(done) {
-            rootEl.style.display = 'none';
-            spy.waitForNotification(function() {
-              expect(spy.callCount).to.be(4);
-              var records = sortRecords(spy.lastCall.args[0]);
-              expect(records.length).to.be(1);
-              expect(records[0].intersectionRatio).to.be(0);
-              done();
-            }, ASYNC_TIMEOUT);
-          },
-          function(done) {
-            rootEl.style.display = 'block';
-            spy.waitForNotification(function() {
-              expect(spy.callCount).to.be(5);
-              var records = sortRecords(spy.lastCall.args[0]);
-              expect(records.length).to.be(1);
-              expect(records[0].intersectionRatio).to.be(1);
-              done();
-            }, ASYNC_TIMEOUT);
-          },
-        ], done);
-      });
-
-
       it('handles container elements with non-visible overflow',
           function(done) {
 
         var spy = sinon.spy();
         io = new IntersectionObserver(spy, {root: rootEl});
 
         runSequence([
           function(done) {
             io.observe(targetEl1);
-            spy.waitForNotification(function() {
+            callDelayed(function() {
               expect(spy.callCount).to.be(1);
               var records = sortRecords(spy.lastCall.args[0]);
               expect(records.length).to.be(1);
               expect(records[0].intersectionRatio).to.be(1);
               done();
             }, ASYNC_TIMEOUT);
           },
           function(done) {
             targetEl1.style.left = '-40px';
-            spy.waitForNotification(function() {
+            callDelayed(function() {
               expect(spy.callCount).to.be(2);
               var records = sortRecords(spy.lastCall.args[0]);
               expect(records.length).to.be(1);
               expect(records[0].intersectionRatio).to.be(0);
               done();
             }, ASYNC_TIMEOUT);
           },
           function(done) {
             parentEl.style.overflow = 'visible';
-            spy.waitForNotification(function() {
+            callDelayed(function() {
               expect(spy.callCount).to.be(3);
               var records = sortRecords(spy.lastCall.args[0]);
               expect(records.length).to.be(1);
               expect(records[0].intersectionRatio).to.be(1);
               done();
             }, ASYNC_TIMEOUT);
           }
         ], done);
@@ -460,44 +374,44 @@ limitations under the License.
 
         var spy = sinon.spy();
         io = new IntersectionObserver(spy, {root: rootEl, threshold: 0.5});
 
         runSequence([
           function(done) {
             targetEl1.style.left = '-5px';
             io.observe(targetEl1);
-            spy.waitForNotification(function() {
+            callDelayed(function() {
               expect(spy.callCount).to.be(1);
               var records = sortRecords(spy.lastCall.args[0]);
               expect(records.length).to.be(1);
               expect(records[0].intersectionRatio).to.be.greaterThan(0.5);
               done();
             }, ASYNC_TIMEOUT);
           },
           function(done) {
             targetEl1.style.left = '-15px';
-            spy.waitForNotification(function() {
+            callDelayed(function() {
               expect(spy.callCount).to.be(2);
               var records = sortRecords(spy.lastCall.args[0]);
               expect(records.length).to.be(1);
               expect(records[0].intersectionRatio).to.be.lessThan(0.5);
               done();
             }, ASYNC_TIMEOUT);
           },
           function(done) {
             targetEl1.style.left = '-25px';
             callDelayed(function() {
               expect(spy.callCount).to.be(2);
               done();
             }, ASYNC_TIMEOUT);
           },
           function(done) {
             targetEl1.style.left = '-10px';
-            spy.waitForNotification(function() {
+            callDelayed(function() {
               expect(spy.callCount).to.be(3);
               var records = sortRecords(spy.lastCall.args[0]);
               expect(records.length).to.be(1);
               expect(records[0].intersectionRatio).to.be(0.5);
               done();
             }, ASYNC_TIMEOUT);
           }
         ], done);
@@ -520,17 +434,17 @@ limitations under the License.
             targetEl1.style.left = '-15px';
             targetEl2.style.top = '-5px';
             targetEl2.style.left = '0px';
             targetEl3.style.top = '0px';
             targetEl3.style.left = '205px';
             io.observe(targetEl1);
             io.observe(targetEl2);
             io.observe(targetEl3);
-            spy.waitForNotification(function() {
+            callDelayed(function() {
               expect(spy.callCount).to.be(1);
               var records = sortRecords(spy.lastCall.args[0]);
               expect(records.length).to.be(2);
               expect(records[0].target).to.be(targetEl1);
               expect(records[0].intersectionRatio).to.be(0.25);
               expect(records[1].target).to.be(targetEl2);
               expect(records[1].intersectionRatio).to.be(0.75);
               done();
@@ -538,17 +452,17 @@ limitations under the License.
           },
           function(done) {
             targetEl1.style.top = '0px';
             targetEl1.style.left = '-5px';
             targetEl2.style.top = '-15px';
             targetEl2.style.left = '0px';
             targetEl3.style.top = '0px';
             targetEl3.style.left = '195px';
-            spy.waitForNotification(function() {
+            callDelayed(function() {
               expect(spy.callCount).to.be(2);
               var records = sortRecords(spy.lastCall.args[0]);
               expect(records.length).to.be(3);
               expect(records[0].target).to.be(targetEl1);
               expect(records[0].intersectionRatio).to.be(0.75);
               expect(records[1].target).to.be(targetEl2);
               expect(records[1].intersectionRatio).to.be(0.25);
               expect(records[2].target).to.be(targetEl3);
@@ -558,17 +472,17 @@ limitations under the License.
           },
           function(done) {
             targetEl1.style.top = '0px';
             targetEl1.style.left = '5px';
             targetEl2.style.top = '-25px';
             targetEl2.style.left = '0px';
             targetEl3.style.top = '0px';
             targetEl3.style.left = '185px';
-            spy.waitForNotification(function() {
+            callDelayed(function() {
               expect(spy.callCount).to.be(3);
               var records = sortRecords(spy.lastCall.args[0]);
               expect(records.length).to.be(3);
               expect(records[0].target).to.be(targetEl1);
               expect(records[0].intersectionRatio).to.be(1);
               expect(records[1].target).to.be(targetEl2);
               expect(records[1].intersectionRatio).to.be(0);
               expect(records[2].target).to.be(targetEl3);
@@ -578,17 +492,17 @@ limitations under the License.
           },
           function(done) {
             targetEl1.style.top = '0px';
             targetEl1.style.left = '15px';
             targetEl2.style.top = '-35px';
             targetEl2.style.left = '0px';
             targetEl3.style.top = '0px';
             targetEl3.style.left = '175px';
-            spy.waitForNotification(function() {
+            callDelayed(function() {
               expect(spy.callCount).to.be(4);
               var records = sortRecords(spy.lastCall.args[0]);
               expect(records.length).to.be(1);
               expect(records[0].target).to.be(targetEl3);
               expect(records[0].intersectionRatio).to.be(1);
               done();
             }, ASYNC_TIMEOUT);
           }
@@ -697,63 +611,63 @@ limitations under the License.
         runSequence([
           function(done) {
             targetEl1.style.top = '0px';
             targetEl1.style.left = '-21px';
             targetEl2.style.top = '-20px';
             targetEl2.style.left = '0px';
             io.observe(targetEl1);
             io.observe(targetEl2);
-            spy.waitForNotification(function() {
+            callDelayed(function() {
               expect(spy.callCount).to.be(1);
               var records = sortRecords(spy.lastCall.args[0]);
               expect(records.length).to.be(1);
               expect(records[0].intersectionRatio).to.be(0);
               expect(records[0].target).to.be(targetEl2);
               done();
             }, ASYNC_TIMEOUT);
           },
           function(done) {
             targetEl1.style.top = '0px';
             targetEl1.style.left = '-20px';
             targetEl2.style.top = '-21px';
             targetEl2.style.left = '0px';
-            spy.waitForNotification(function() {
+            callDelayed(function() {
               expect(spy.callCount).to.be(2);
               var records = sortRecords(spy.lastCall.args[0]);
               expect(records.length).to.be(2);
               expect(records[0].intersectionRatio).to.be(0);
               expect(records[0].target).to.be(targetEl1);
               expect(records[1].intersectionRatio).to.be(0);
               expect(records[1].target).to.be(targetEl2);
               done();
             }, ASYNC_TIMEOUT);
           },
           function(done) {
             targetEl1.style.top = '-20px';
             targetEl1.style.left = '200px';
             targetEl2.style.top = '200px';
             targetEl2.style.left = '200px';
-            spy.waitForNotification(function() {
+            callDelayed(function() {
               expect(spy.callCount).to.be(3);
               var records = sortRecords(spy.lastCall.args[0]);
               expect(records.length).to.be(1);
               expect(records[0].intersectionRatio).to.be(0);
               expect(records[0].target).to.be(targetEl2);
               done();
             }, ASYNC_TIMEOUT);
           },
           function(done) {
             targetEl3.style.top = '20px';
             targetEl3.style.left = '-20px';
             targetEl4.style.top = '-20px';
             targetEl4.style.left = '20px';
             io.observe(targetEl3);
             io.observe(targetEl4);
-            spy.waitForNotification(function() {
+            callDelayed(function() {
               expect(spy.callCount).to.be(4);
               var records = sortRecords(spy.lastCall.args[0]);
               expect(records.length).to.be(2);
               expect(records[0].intersectionRatio).to.be(0);
               expect(records[0].target).to.be(targetEl3);
               expect(records[1].intersectionRatio).to.be(0);
               expect(records[1].target).to.be(targetEl4);
               done();
@@ -798,50 +712,50 @@ limitations under the License.
             document.getElementById('fixtures').appendChild(rootEl);
             callDelayed(function() {
               expect(spy.callCount).to.be(0);
               done();
             }, ASYNC_TIMEOUT);
           },
           function(done) {
             parentEl.insertBefore(targetEl1, targetEl2);
-            spy.waitForNotification(function() {
+            callDelayed(function() {
               expect(spy.callCount).to.be(1);
               var records = sortRecords(spy.lastCall.args[0]);
               expect(records.length).to.be(1);
               expect(records[0].intersectionRatio).to.be(1);
               expect(records[0].target).to.be(targetEl1);
               done();
             }, ASYNC_TIMEOUT);
           },
           function(done) {
             grandParentEl.parentNode.removeChild(grandParentEl);
-            spy.waitForNotification(function() {
+            callDelayed(function() {
               expect(spy.callCount).to.be(2);
               var records = sortRecords(spy.lastCall.args[0]);
               expect(records.length).to.be(1);
               expect(records[0].intersectionRatio).to.be(0);
               expect(records[0].target).to.be(targetEl1);
               done();
             }, ASYNC_TIMEOUT);
           },
           function(done) {
             rootEl.appendChild(targetEl1);
-            spy.waitForNotification(function() {
+            callDelayed(function() {
               expect(spy.callCount).to.be(3);
               var records = sortRecords(spy.lastCall.args[0]);
               expect(records.length).to.be(1);
               expect(records[0].intersectionRatio).to.be(1);
               expect(records[0].target).to.be(targetEl1);
               done();
             }, ASYNC_TIMEOUT);
           },
           function(done) {
             rootEl.parentNode.removeChild(rootEl);
-            spy.waitForNotification(function() {
+            callDelayed(function() {
               expect(spy.callCount).to.be(4);
               var records = sortRecords(spy.lastCall.args[0]);
               expect(records.length).to.be(1);
               expect(records[0].intersectionRatio).to.be(0);
               expect(records[0].target).to.be(targetEl1);
               done();
             }, ASYNC_TIMEOUT);
           }
@@ -877,76 +791,73 @@ limitations under the License.
         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();
+        io = new IntersectionObserver(function(records) {
+          var viewportWidth =
+              document.documentElement.clientWidth || document.body.clientWidth;
+          var viewportHeight =
+              document.documentElement.clientHeight || document.body.clientHeight;
+
+          expect(records.length).to.be(1);
+          expect(records[0].rootBounds.top).to.be(0);
+          expect(records[0].rootBounds.left).to.be(0);
+          expect(records[0].rootBounds.right).to.be(viewportWidth + 4);
+          expect(records[0].rootBounds.width).to.be(viewportWidth + 4);
+          expect(records[0].rootBounds.bottom).to.be(viewportHeight + 4);
+          expect(records[0].rootBounds.height).to.be(viewportHeight + 4);
           done();
-        };
+        });
 
-        var win = window.open("intersectionobserver_window.html");
+        // Ensures targetEl1 is visible in the viewport before observing.
+        window.scrollTo(0, 0);
+        rootEl.style.position = 'absolute';
+        rootEl.style.top = '0px';
+        rootEl.style.left = '0px';
+
+        io.observe(targetEl1);
       });
 
     });
 
     describe('observe subframe', function () {
       
-      it('should not trigger if target and root are not in the same document',
-          function(done) {
-
-        var spy = sinon.spy();
-        io = new IntersectionObserver(spy, {root: rootEl});
-
-        targetEl4.onload = function () {
-          targetEl5 = targetEl4.contentDocument.getElementById('target5');
-          io.observe(targetEl5);
-          callDelayed(function() {
-            expect(spy.callCount).to.be(0);
-            done();
-          }, ASYNC_TIMEOUT);
-        }
-
-        targetEl4.src = "intersectionobserver_iframe.html";
-      
-      });
-
       it('boundingClientRect matches target.getBoundingClientRect() for an element inside an iframe',
           function(done) {
 
         io = new IntersectionObserver(function(records) {
           expect(records.length).to.be(1);
           expect(records[0].boundingClientRect.top, targetEl5.getBoundingClientRect().top);
           expect(records[0].boundingClientRect.left, targetEl5.getBoundingClientRect().left);
           expect(records[0].boundingClientRect.width, targetEl5.getBoundingClientRect().width);
           expect(records[0].boundingClientRect.height, targetEl5.getBoundingClientRect().height);
           done();
-        }, {threshold: [1]});
+        }, {root: rootEl, threshold: [1]});
 
         targetEl4.onload = function () {
           targetEl5 = targetEl4.contentDocument.getElementById('target5');
           io.observe(targetEl5);
         }
 
-        targetEl4.src = "intersectionobserver_iframe.html";
+        targetEl4.src = "intersectionobserver_subframe.html";
       });
 
       it('rootBounds should is set to null for cross-origin observations', function(done) {
 
         window.onmessage = function (e) {
           expect(e.data).to.be.ok();
           done();
         };
 
-        targetEl4.src = "http://example.org/tests/dom/base/test/intersectionobserver_iframe.html";
+        targetEl4.src = "http://example.org/tests/dom/base/test/intersectionobserver_subframe.html";
 
       });
     
     });
 
     describe('takeRecords', function() {
 
       it('supports getting records before the callback is invoked',
@@ -980,32 +891,32 @@ limitations under the License.
         io = new IntersectionObserver(spy, {root: rootEl});
 
         runSequence([
           function(done) {
             targetEl1.style.top = targetEl2.style.top = '0px';
             targetEl1.style.left = targetEl2.style.left = '0px';
             io.observe(targetEl1);
             io.observe(targetEl2);
-            spy.waitForNotification(function() {
+            callDelayed(function() {
               expect(spy.callCount).to.be(1);
               var records = sortRecords(spy.lastCall.args[0]);
               expect(records.length).to.be(2);
               expect(records[0].target).to.be(targetEl1);
               expect(records[0].intersectionRatio).to.be(1);
               expect(records[1].target).to.be(targetEl2);
               expect(records[1].intersectionRatio).to.be(1);
               done();
             }, ASYNC_TIMEOUT);
           },
           function(done) {
             io.unobserve(targetEl1);
             targetEl1.style.top = targetEl2.style.top = '0px';
             targetEl1.style.left = targetEl2.style.left = '-40px';
-            spy.waitForNotification(function() {
+            callDelayed(function() {
               expect(spy.callCount).to.be(2);
               var records = sortRecords(spy.lastCall.args[0]);
               expect(records.length).to.be(1);
               expect(records[0].target).to.be(targetEl2);
               expect(records[0].intersectionRatio).to.be(0);
               done();
             }, ASYNC_TIMEOUT);
           },
@@ -1032,17 +943,17 @@ limitations under the License.
         io = new IntersectionObserver(spy, {root: rootEl});
 
         runSequence([
           function(done) {
             targetEl1.style.top = targetEl2.style.top = '0px';
             targetEl1.style.left = targetEl2.style.left = '0px';
             io.observe(targetEl1);
             io.observe(targetEl2);
-            spy.waitForNotification(function() {
+            callDelayed(function() {
               expect(spy.callCount).to.be(1);
               var records = sortRecords(spy.lastCall.args[0]);
               expect(records.length).to.be(2);
               expect(records[0].target).to.be(targetEl1);
               expect(records[0].intersectionRatio).to.be(1);
               expect(records[1].target).to.be(targetEl2);
               expect(records[1].intersectionRatio).to.be(1);
               done();