Closed Bug 700190 Opened 8 years ago Closed 8 years ago

Fix test_aboutmemory.xul


(Toolkit :: about:memory, defect)

Not set





(Reporter: njn, Assigned: njn)




(1 file)

Attached patch patchSplinter Review
When I run test_aboutmemory.xul I get this output on the console:

TEST-INFO | unknown test url | [SimpleTest/SimpleTest.js, window.onerror] An error occurred: actual.QueryInterface is not a function at chrome://mochitests/content/chrome/toolkit/components/aboutmemory/tests/chrome/test_aboutmemory.xul:370
JavaScript error: chrome://mochitests/content/chrome/toolkit/components/aboutmemory/tests/chrome/test_aboutmemory.xul, line 370: actual.QueryInterface is not a function

AFAICT the problem was introduced by bug 674290 -- the use of a validator function as the first argument of waitForClipboard() is wrong.  I confirmed (with the current tip) that changing the expected output string does not cause the test to fail as it should, and only 1 thing is checked instead of the expected 3.  Either this was broken from the start, or maybe waitForClipboard() changed?

Either way, the attached patch fixes things.
Attachment #572357 - Flags: review?(justin.lebar+bug)
I think waitForClipboard changed.  Which is good, because it was silly to make code QI like this.  But it's bad that the test harness didn't catch this failure.

I guess the reason that this failure didn't cause the tree to burn is that the exception was inside checkClipboard?  If we throw an exception outside checkClipboard, does the test fail?

r=me if exceptions in general cause this test to fail.  Otherwise, we need a bigger hammer.
Attachment #572357 - Flags: review?(justin.lebar+bug) → review+
I inserted |throw("foobar")| at the top-level of the JS code and this shows up in the console:

  TEST-INFO | unknown test url | [SimpleTest/SimpleTest.js, window.onerror] An error occurred: uncaught exception: foobar at :0

but the test still passes.  I could wrap everything in the try-block but it seems like the test framework should catch this.
bz tells me that chrome tests swallow uncaught exceptions.  See bug 652494.
Blocks: 652494
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla11
You need to log in before you can comment on or make changes to this bug.