mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-13 13:25:37 +00:00
Bug 1313972 - Avoid racing condition by making sure postMessage events are consumed by the correct tests. r=smaug
This commit is contained in:
parent
d4925f9157
commit
8287bed367
24
dom/base/test/intersectionobserver_cross_domain_iframe.html
Normal file
24
dom/base/test/intersectionobserver_cross_domain_iframe.html
Normal file
@ -0,0 +1,24 @@
|
||||
<!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) {
|
||||
console.log(records[0].rootBounds, location.href);
|
||||
window.parent.postMessage(records[0].rootBounds == null, 'http://mochi.test:8888');
|
||||
}, {});
|
||||
io.observe(document.getElementById("target5"));
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
@ -13,12 +13,5 @@
|
||||
</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.disconnect();
|
||||
}, {});
|
||||
io.observe(document.getElementById("target5"));
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -27,7 +27,6 @@
|
||||
records[0].rootBounds.bottom === viewportHeight &&
|
||||
records[0].rootBounds.height === viewportHeight;
|
||||
window.opener.postMessage(passed, '*');
|
||||
io.disconnect();
|
||||
});
|
||||
io.observe(document.getElementById("target"));
|
||||
</script>
|
||||
|
@ -921,7 +921,7 @@ limitations under the License.
|
||||
callDelayed(function () {
|
||||
expect(spy.callCount).to.be(1);
|
||||
done();
|
||||
}, ASYNC_TIMEOUT);
|
||||
}, ASYNC_TIMEOUT * 3);
|
||||
});
|
||||
|
||||
});
|
||||
@ -970,11 +970,11 @@ limitations under the License.
|
||||
it('rootBounds should is set to null for cross-origin observations', function(done) {
|
||||
|
||||
window.onmessage = function (e) {
|
||||
expect(e.data).to.be.ok();
|
||||
expect(e.data).to.be(true);
|
||||
done();
|
||||
};
|
||||
|
||||
targetEl4.src = "http://example.org/tests/dom/base/test/intersectionobserver_iframe.html";
|
||||
targetEl4.src = "http://example.org/tests/dom/base/test/intersectionobserver_cross_domain_iframe.html";
|
||||
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user