Closed
Bug 1354163
Opened 7 years ago
Closed 7 years ago
Intermittent dom/base/test/test_intersectionobservers.html | supports getting records before the callback is invoked [takeRecords] - got +0, expected 1
Categories
(Core :: DOM: Core & HTML, defect)
Core
DOM: Core & HTML
Tracking
()
RESOLVED
FIXED
mozilla55
Tracking | Status | |
---|---|---|
firefox-esr52 | --- | unaffected |
firefox53 | --- | unaffected |
firefox54 | --- | fixed |
firefox55 | --- | fixed |
People
(Reporter: intermittent-bug-filer, Assigned: tschneider)
References
Details
(Keywords: intermittent-failure)
Attachments
(1 file, 1 obsolete file)
Filed by: philringnalda [at] gmail.com https://treeherder.mozilla.org/logviewer.html#?job_id=89184332&repo=mozilla-inbound https://queue.taskcluster.net/v1/task/La-nCKs6TFm0iRe5-h2vMw/runs/0/artifacts/public/logs/live_backing.log
Comment 1•7 years ago
|
||
I don't understand how this test is supposed to be testing that IntersectionObserver "supports getting records before the callback is invoked". My questions as comments below: it('supports getting records before the callback is invoked', function(done) { var lastestRecords = []; io = new IntersectionObserver(function(records) { lastestRecords = lastestRecords.concat(records); }, {root: rootEl}); io.observe(targetEl1); // doesn't callback gets called immediately when an intersection occurs? window.requestAnimationFrame && requestAnimationFrame(function() { // why does this test assume that takeRecords() will happen before the callback above? lastestRecords = lastestRecords.concat(io.takeRecords()); }); callDelayed(function() { // when this fails, lastestRecords.length == 0 // why would lastestRecords.length == 1 indicate that takeRecords did happen before the callback? expect(lastestRecords.length).to.be(1); expect(lastestRecords[0].intersectionRatio).to.be(1); done(); }, ASYNC_TIMEOUT); } );
Flags: needinfo?(tschneider)
Assignee | ||
Comment 2•7 years ago
|
||
(In reply to Jet Villegas (:jet) from comment #1) > > io.observe(targetEl1); // doesn't callback gets called immediately > when an intersection occurs? > No, not immediately. Intersection check happens at next painting iteration, scheduling a task to be executed in a following event loop turn. > window.requestAnimationFrame && requestAnimationFrame(function() { > // why does this test assume that takeRecords() will happen before > the callback above? > lastestRecords = lastestRecords.concat(io.takeRecords()); > }); RAF's are supposed to happen before the the intersection check/observer notification. > callDelayed(function() { > > // when this fails, lastestRecords.length == 0 > // why would lastestRecords.length == 1 indicate that takeRecords > did happen before the callback? It's not testing the order of which the callbacks above fire, only making sure that the current list of records is cleared after receiving them either via the observer callback or takeRecords. If that isn't the case, lastestRecords.length would be 2.
Flags: needinfo?(tschneider)
Assignee | ||
Comment 3•7 years ago
|
||
After second thought. I'm pretty sure takeRecords will become obsolete. There are justified concerns about its usefulness, especially after https://bugzilla.mozilla.org/show_bug.cgi?id=1319134. Also see https://github.com/WICG/IntersectionObserver/issues/133. According to the spec, the 100ms delay mentioned in that thread is not used anymore. intersection Observer notifications are now fired as early as possible, event before rAF's. I confirmed that this is even already the case in Chrome. Anyhow, we should keep that test as long as takeRecords is officially part of the spec. Will add a patch to fix the intermittent failure for now.
Assignee | ||
Comment 4•7 years ago
|
||
Assignee | ||
Updated•7 years ago
|
Attachment #8858444 -
Flags: review?(bugs)
Assignee | ||
Comment 5•7 years ago
|
||
Try run: https://treeherder.mozilla.org/#/jobs?repo=try&revision=355bde69a024f29fe5eeb34ed1f91cf0cf2adc01
Comment 6•7 years ago
|
||
Comment on attachment 8858444 [details] [diff] [review] Fix intermittent test failure r+ with a better commit message, maybe: Wait until there are intersection records to observe. Prevents an intermittent test failure.
Attachment #8858444 -
Flags: review?(bugs) → review+
Assignee | ||
Comment 7•7 years ago
|
||
Better commit message.
Attachment #8858444 -
Attachment is obsolete: true
Assignee | ||
Updated•7 years ago
|
Keywords: checkin-needed
Pushed by philringnalda@gmail.com: https://hg.mozilla.org/integration/mozilla-inbound/rev/65cf5283b925 Wait until there are intersection records to observe. Prevents an intermittent test failure, r=jet
Keywords: checkin-needed
Updated•7 years ago
|
Assignee: nobody → tschneider
Comment 9•7 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/65cf5283b925
Status: NEW → RESOLVED
Closed: 7 years ago
status-firefox55:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla55
Updated•7 years ago
|
status-firefox53:
--- → unaffected
status-firefox54:
--- → affected
status-firefox-esr52:
--- → unaffected
Comment 10•7 years ago
|
||
bugherder uplift |
https://hg.mozilla.org/releases/mozilla-beta/rev/9f86465621ed
Flags: in-testsuite+
Updated•5 years ago
|
Component: DOM → DOM: Core & HTML
You need to log in
before you can comment on or make changes to this bug.
Description
•