Closed
Bug 979161
Opened 10 years ago
Closed 10 years ago
paint_listener.js shouldn't require running as a chrome mochitest
Categories
(Testing :: Mochitest, defect)
Testing
Mochitest
Tracking
(Not tracked)
RESOLVED
FIXED
mozilla30
People
(Reporter: birtles, Assigned: birtles)
References
Details
Attachments
(5 files, 5 obsolete files)
4.21 KB,
patch
|
roc
:
review+
|
Details | Diff | Splinter Review |
3.14 KB,
patch
|
mattwoodrow
:
review+
|
Details | Diff | Splinter Review |
1.36 KB,
patch
|
mattwoodrow
:
review+
|
Details | Diff | Splinter Review |
771 bytes,
patch
|
Details | Diff | Splinter Review | |
2.88 KB,
patch
|
mattwoodrow
:
review+
|
Details | Diff | Splinter Review |
Currently paint_listener.js can only be used from Chrome mochitests due to the way it fetches DOMWindowUtils. This is due to no_clip_iframe_window.xul (loaded by layout/base/tests/chrome/test_no_clip_iframe.xul) which fails when using SpecialPowers.DOMWindowUtils because of the way SpecialPowers works with parent windows. Basically, when we bind special powers we look for a parent window and use its SpecialPowers if available. For paint_listener.js this means we get a DOMWindowUtils object bound to the parent window and so the resulting accumulated rectangle is the wrong size. I think we can work around this by using SpecialPowers.getDOMWindowUtils. Patches forthcoming for this and a few other tweaks to paint_listener.js
Assignee | ||
Comment 1•10 years ago
|
||
We can't just use SpecialPowers.DOMWindowUtils since otherwise we end up with a DOMWindowUtils object that is bound to the parent object.
Assignee | ||
Updated•10 years ago
|
Assignee: nobody → birtles
Status: NEW → ASSIGNED
Assignee | ||
Comment 2•10 years ago
|
||
Assignee | ||
Comment 3•10 years ago
|
||
And also simplify the code somewhat
Assignee | ||
Comment 4•10 years ago
|
||
This patch adds waitForAllPaints which does *not* call getBoundingClientRect since that can cause a flush. Sometimes this flush is undesirable since it can mask bugs in the code under test which should be performing this flush itself.
Assignee | ||
Comment 5•10 years ago
|
||
Currently running through tryserver: https://tbpl.mozilla.org/?tree=Try&rev=4a1be3925ab9
Assignee | ||
Comment 6•10 years ago
|
||
(In reply to Brian Birtles (:birtles) from comment #5) > Currently running through tryserver: > https://tbpl.mozilla.org/?tree=Try&rev=4a1be3925ab9 Looks like I broke a bunch of stuff.
Assignee | ||
Comment 7•10 years ago
|
||
Try again: https://tbpl.mozilla.org/?tree=Try&rev=a18a6e2deac2
Assignee | ||
Comment 8•10 years ago
|
||
Assignee | ||
Updated•10 years ago
|
Attachment #8385136 -
Attachment is obsolete: true
Assignee | ||
Comment 9•10 years ago
|
||
Assignee | ||
Updated•10 years ago
|
Attachment #8385137 -
Attachment is obsolete: true
Assignee | ||
Comment 10•10 years ago
|
||
Assignee | ||
Updated•10 years ago
|
Attachment #8385135 -
Attachment is obsolete: true
Assignee | ||
Comment 11•10 years ago
|
||
Assignee | ||
Updated•10 years ago
|
Attachment #8385138 -
Attachment is obsolete: true
Assignee | ||
Updated•10 years ago
|
Attachment #8385929 -
Flags: review?(matt.woodrow)
Assignee | ||
Updated•10 years ago
|
Attachment #8385930 -
Flags: review?(matt.woodrow)
Assignee | ||
Updated•10 years ago
|
Attachment #8385931 -
Flags: review?(matt.woodrow)
Assignee | ||
Updated•10 years ago
|
Attachment #8385932 -
Flags: review?(matt.woodrow)
Comment 12•10 years ago
|
||
Comment on attachment 8385929 [details] [diff] [review] part 1 - Wrap up paint_listener.js so it doesn't leak globals Review of attachment 8385929 [details] [diff] [review]: ----------------------------------------------------------------- I don't know enough about JS to know why we need to do this.
Attachment #8385929 -
Flags: review?(matt.woodrow) → review?(roc)
Updated•10 years ago
|
Attachment #8385930 -
Flags: review?(matt.woodrow) → review+
Updated•10 years ago
|
Attachment #8385931 -
Flags: review?(matt.woodrow) → review+
Comment 13•10 years ago
|
||
Comment on attachment 8385932 [details] [diff] [review] part 4 - Add a non-flushing version of waitForAllPaints to paint_listener.js Review of attachment 8385932 [details] [diff] [review]: ----------------------------------------------------------------- ::: testing/mochitest/tests/SimpleTest/paint_listener.js @@ +27,5 @@ > + function waitForPaints(callback, subdoc, flushMode) { > + // The call to getBoundingClientRect will flush pending layout > + // notifications. Sometimes, however, this is undesirable since it can mask > + // bugs where the code under test should be performing the flush. > + if (flushMode == "flush") { String comparison is a bit sad, can we just use bool instead?
Assignee | ||
Comment 14•10 years ago
|
||
(In reply to Matt Woodrow (:mattwoodrow) from comment #13) > Comment on attachment 8385932 [details] [diff] [review] > part 4 - Add a non-flushing version of waitForAllPaints to paint_listener.js > > Review of attachment 8385932 [details] [diff] [review]: > ----------------------------------------------------------------- > > ::: testing/mochitest/tests/SimpleTest/paint_listener.js > @@ +27,5 @@ > > + function waitForPaints(callback, subdoc, flushMode) { > > + // The call to getBoundingClientRect will flush pending layout > > + // notifications. Sometimes, however, this is undesirable since it can mask > > + // bugs where the code under test should be performing the flush. > > + if (flushMode == "flush") { > > String comparison is a bit sad, can we just use bool instead? The problem is that from the call site you see: waitForPaints(function() { ... }, frame, true); And it's really not clear what 'true' means. I thought we tried to avoid that. What's the concern with string comparisons? Performance? Possible typos?
Assignee | ||
Comment 15•10 years ago
|
||
Here is part 1 without the whitespace changes
Comment 16•10 years ago
|
||
(In reply to Brian Birtles (:birtles) from comment #14) > > The problem is that from the call site you see: > > waitForPaints(function() { ... }, frame, true); > > And it's really not clear what 'true' means. I thought we tried to avoid > that. > > What's the concern with string comparisons? Performance? Possible typos? Yeah, good point about the callsites. The problem is both of those things, plus we're fundamentally testing a boolean condition 'do we want to flush', and representing that as a string is weird. How about using named constants/ enums instead? That would be the preferred approach for c++. Or you can ask someone else who knows more about JS for their thoughts :)
Attachment #8385929 -
Flags: review?(roc) → review+
Assignee | ||
Comment 17•10 years ago
|
||
Address review feedback
Attachment #8385932 -
Attachment is obsolete: true
Attachment #8385932 -
Flags: review?(matt.woodrow)
Attachment #8388270 -
Flags: review?(matt.woodrow)
Updated•10 years ago
|
Attachment #8388270 -
Flags: review?(matt.woodrow) → review+
Assignee | ||
Comment 18•10 years ago
|
||
https://hg.mozilla.org/integration/mozilla-inbound/rev/6c793fa8b589 https://hg.mozilla.org/integration/mozilla-inbound/rev/bb870818480e https://hg.mozilla.org/integration/mozilla-inbound/rev/b0d218561219 https://hg.mozilla.org/integration/mozilla-inbound/rev/2d0080a92365
Comment 19•10 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/6c793fa8b589 https://hg.mozilla.org/mozilla-central/rev/bb870818480e https://hg.mozilla.org/mozilla-central/rev/b0d218561219 https://hg.mozilla.org/mozilla-central/rev/2d0080a92365
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla30
You need to log in
before you can comment on or make changes to this bug.
Description
•