Closed Bug 598821 Opened 14 years ago Closed 14 years ago

test-tabs and test-windows failures on Linux

Categories

(Add-on SDK Graveyard :: General, defect)

x86
Linux
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: myk, Assigned: adw)

References

Details

Attachments

(1 file)

With the SDK on a different (faster?) filesystem, I can now reproduce the test-tabs and test-windows failures Drew reported in bug 598525, comment 3:

error: TEST FAILED: test-tabs.testActiveTab_getter (failure)
error: fail: null != "data:text/html,<html><head><title>foo</title></head></html>"
info: Traceback (most recent call last):
  File "resource://testpkgs-jetpack-core-lib/tab-browser.js", line 136, in anonymous
    require("errors").catchAndLog(function(e) options.onLoad(e))(e);
  File "resource://testpkgs-jetpack-core-lib/errors.js", line 49, in anonymous
    return callback.apply(this, arguments);
  File "resource://testpkgs-jetpack-core-lib/tab-browser.js", line 136, in anonymous
    require("errors").catchAndLog(function(e) options.onLoad(e))(e);
  File "resource://testpkgs-jetpack-core-tests/test-tabs.js", line 52, in anonymous
    test.assertEqual(tabs.activeTab.location, location);
  File "resource://testpkgs-jetpack-core-lib/unit-test.js", line 227, in assertEqual
    this.fail(message);
  File "resource://testpkgs-jetpack-core-lib/unit-test.js", line 145, in fail
    console.trace();
error: fail: "" != "foo"
info: Traceback (most recent call last):
  File "resource://testpkgs-jetpack-core-lib/tab-browser.js", line 136, in anonymous
    require("errors").catchAndLog(function(e) options.onLoad(e))(e);
  File "resource://testpkgs-jetpack-core-lib/errors.js", line 49, in anonymous
    return callback.apply(this, arguments);
  File "resource://testpkgs-jetpack-core-lib/tab-browser.js", line 136, in anonymous
    require("errors").catchAndLog(function(e) options.onLoad(e))(e);
  File "resource://testpkgs-jetpack-core-tests/test-tabs.js", line 53, in anonymous
    test.assertEqual(tabs.activeTab.title, "foo");
  File "resource://testpkgs-jetpack-core-lib/unit-test.js", line 227, in assertEqual
    this.fail(message);
  File "resource://testpkgs-jetpack-core-lib/unit-test.js", line 145, in fail
    console.trace();
..error: fail: location after activeTab setter matches (null != "data:text/html,<html><head><title>foo</title></head></html>")
info: Traceback (most recent call last):
  File "resource://testpkgs-jetpack-core-lib/timer.js", line 60, in notify
    this._callback.apply(null, this._params);
  File "resource://testpkgs-jetpack-core-tests/test-tabs.js", line 77, in anonymous
    test.assertEqual(tabs.activeTab.location, location, "location after activeTab setter matches");
  File "resource://testpkgs-jetpack-core-lib/unit-test.js", line 227, in assertEqual
    this.fail(message);
  File "resource://testpkgs-jetpack-core-lib/unit-test.js", line 145, in fail
    console.trace();
.............error: fail: tab is now the active tab (null != null)
info: Traceback (most recent call last):
  File "resource://testpkgs-jetpack-core-lib/tab-browser.js", line 694, in handleEvent
    this._safeDOMContentLoaded(event);
  File "resource://testpkgs-jetpack-core-lib/tab-browser.js", line 649, in safeDOMContentLoaded
    this._delegate.onReady(tab);
  File "resource://testpkgs-jetpack-core-lib/tab-browser.js", line 469, in TETT_onReady
    eventsTabDelegate.pushTabEvent("onReady", tab);
  File "resource://testpkgs-jetpack-core-lib/tab-browser.js", line 427, in TETT_pushTabEvent
    })(tab);
  File "resource://testpkgs-jetpack-core-lib/errors.js", line 49, in anonymous
    return callback.apply(this, arguments);
  File "resource://testpkgs-jetpack-core-lib/tab-browser.js", line 426, in anonymous
    callback(new tabConstructor(tab));
  File "resource://testpkgs-jetpack-core-tests/test-tabs.js", line 171, in anonymous
    test.assertEqual(tabs.activeTab.location, tab.location, "tab is now the active tab");
  File "resource://testpkgs-jetpack-core-lib/unit-test.js", line 227, in assertEqual
    this.fail(message);
  File "resource://testpkgs-jetpack-core-lib/unit-test.js", line 145, in fail
    console.trace();
.........error: fail: URL of active tab has not changed (null != null)
info: Traceback (most recent call last):
  File "resource://testpkgs-jetpack-core-lib/tab-browser.js", line 694, in handleEvent
    this._safeDOMContentLoaded(event);
  File "resource://testpkgs-jetpack-core-lib/tab-browser.js", line 649, in safeDOMContentLoaded
    this._delegate.onReady(tab);
  File "resource://testpkgs-jetpack-core-lib/tab-browser.js", line 469, in TETT_onReady
    eventsTabDelegate.pushTabEvent("onReady", tab);
  File "resource://testpkgs-jetpack-core-lib/tab-browser.js", line 427, in TETT_pushTabEvent
    })(tab);
  File "resource://testpkgs-jetpack-core-lib/errors.js", line 49, in anonymous
    return callback.apply(this, arguments);
  File "resource://testpkgs-jetpack-core-lib/tab-browser.js", line 426, in anonymous
    callback(new tabConstructor(tab));
  File "resource://testpkgs-jetpack-core-tests/test-tabs.js", line 276, in anonymous
    test.assertEqual(tabs.activeTab.location, activeUrl, "URL of active tab has not changed");
  File "resource://testpkgs-jetpack-core-lib/unit-test.js", line 227, in assertEqual
    this.fail(message);
  File "resource://testpkgs-jetpack-core-lib/unit-test.js", line 145, in fail
    console.trace();
.error: fail: a new window was not opened (({}) != ({}))
info: Traceback (most recent call last):
  File "resource://testpkgs-jetpack-core-lib/tab-browser.js", line 694, in handleEvent
    this._safeDOMContentLoaded(event);
  File "resource://testpkgs-jetpack-core-lib/tab-browser.js", line 649, in safeDOMContentLoaded
    this._delegate.onReady(tab);
  File "resource://testpkgs-jetpack-core-lib/tab-browser.js", line 469, in TETT_onReady
    eventsTabDelegate.pushTabEvent("onReady", tab);
  File "resource://testpkgs-jetpack-core-lib/tab-browser.js", line 427, in TETT_pushTabEvent
    })(tab);
  File "resource://testpkgs-jetpack-core-lib/errors.js", line 49, in anonymous
    return callback.apply(this, arguments);
  File "resource://testpkgs-jetpack-core-lib/tab-browser.js", line 426, in anonymous
    callback(new tabConstructor(tab));
  File "resource://testpkgs-jetpack-core-tests/test-tabs.js", line 278, in anonymous
    test.assertEqual(activeWindow, window, "a new window was not opened");
  File "resource://testpkgs-jetpack-core-lib/unit-test.js", line 227, in assertEqual
    this.fail(message);
  File "resource://testpkgs-jetpack-core-lib/unit-test.js", line 145, in fail
    console.trace();
..error: fail: new window is active (({}) != ({}))
info: Traceback (most recent call last):
  File "resource://testpkgs-jetpack-core-lib/tab-browser.js", line 545, in anonymous
    require("errors").catchAndLog(function(e) options.onOpen(e))(tab);
  File "resource://testpkgs-jetpack-core-lib/errors.js", line 49, in anonymous
    return callback.apply(this, arguments);
  File "resource://testpkgs-jetpack-core-lib/tab-browser.js", line 545, in anonymous
    require("errors").catchAndLog(function(e) options.onOpen(e))(tab);
  File "resource://testpkgs-jetpack-core-tests/test-tabs.js", line 314, in anonymous
    test.assertEqual(activeWindow, newWindow, "new window is active");
  File "resource://testpkgs-jetpack-core-lib/unit-test.js", line 227, in assertEqual
    this.fail(message);
  File "resource://testpkgs-jetpack-core-lib/unit-test.js", line 145, in fail
    console.trace();
..error: fail: URL of activeTab matches (null != "data:text/html,newwindow")
info: Traceback (most recent call last):
  File "resource://testpkgs-jetpack-core-lib/tab-browser.js", line 545, in anonymous
    require("errors").catchAndLog(function(e) options.onOpen(e))(tab);
  File "resource://testpkgs-jetpack-core-lib/errors.js", line 49, in anonymous
    return callback.apply(this, arguments);
  File "resource://testpkgs-jetpack-core-lib/tab-browser.js", line 545, in anonymous
    require("errors").catchAndLog(function(e) options.onOpen(e))(tab);
  File "resource://testpkgs-jetpack-core-tests/test-tabs.js", line 317, in anonymous
    test.assertEqual(tabs.activeTab.location, url, "URL of activeTab matches");
  File "resource://testpkgs-jetpack-core-lib/unit-test.js", line 227, in assertEqual
    this.fail(message);
  File "resource://testpkgs-jetpack-core-lib/unit-test.js", line 145, in fail
    console.trace();
..........................................................................................................................................................................................................................................................................................................................................................................................................................error: fail: Correct active window - 2 ("Mozilla Firefox 4.0 Beta 6" != "window 2 - Mozilla Firefox 4.0 Beta 6")
info: Traceback (most recent call last):
  File "resource://testpkgs-jetpack-core-tests/test-windows.js", line 272, in focusListener
    nextStep();
  File "resource://testpkgs-jetpack-core-tests/test-windows.js", line 246, in nextStep
    testSteps.shift()();
  File "resource://testpkgs-jetpack-core-tests/test-windows.js", line 216, in anonymous
    test.assertEqual(windows.activeWindow.title, window2.title, "Correct active window - 2");
  File "resource://testpkgs-jetpack-core-lib/unit-test.js", line 227, in assertEqual
    this.fail(message);
  File "resource://testpkgs-jetpack-core-lib/unit-test.js", line 145, in fail
    console.trace();
error: fail: Correct active window - 3 ("Mozilla Firefox 4.0 Beta 6" != "window 3 - Mozilla Firefox 4.0 Beta 6")
info: Traceback (most recent call last):
  File "resource://testpkgs-jetpack-core-tests/test-windows.js", line 272, in focusListener
    nextStep();
  File "resource://testpkgs-jetpack-core-tests/test-windows.js", line 246, in nextStep
    testSteps.shift()();
  File "resource://testpkgs-jetpack-core-tests/test-windows.js", line 218, in anonymous
    continueAfterFocus(rawWindow3);
  File "resource://testpkgs-jetpack-core-tests/test-windows.js", line 268, in continueAfterFocus
    nextStep();
  File "resource://testpkgs-jetpack-core-tests/test-windows.js", line 246, in nextStep
    testSteps.shift()();
  File "resource://testpkgs-jetpack-core-tests/test-windows.js", line 221, in anonymous
    test.assertEqual(windows.activeWindow.title, window3.title, "Correct active window - 3");
  File "resource://testpkgs-jetpack-core-lib/unit-test.js", line 227, in assertEqual
    this.fail(message);
  File "resource://testpkgs-jetpack-core-lib/unit-test.js", line 145, in fail
    console.trace();

The failures are consistent, although I only see the test-windows failures on Firefox 3.6, whereas I see both the test-windows and the test-tabs failures on Firefox 4.0b6.

Does anyone have any ideas what might be going on here?
I don't have an answer, but one thing that confused me debugging yesterday was messages like:

  error: fail: tab is now the active tab (null != null)
  error: fail: a new window was not opened (({}) != ({}))
  error: fail: null != "data:text/html,<html><head><title>foo</title></head></html>"

These are actually comparisons of location objects in the null cases and windows in the ({}) cases.  The unit-test runner unevals assertion arguments when it sticks them in messages, and when you uneval a location object you get null, and when a window, ({}).
Another thing is that the panel tests run first, but a blank rectangle that looks like a panel sticks around on top of all other windows for half of the test suite, after the panel tests have finished.  I commented out the panel tests, but I got an entirely different set of errors.  Then I updated to the latest tip, which includes the fix to bug 598525 -- and no errors!
(In reply to comment #2)
> Another thing is that the panel tests run first, but a blank rectangle that
> looks like a panel sticks around on top of all other windows for half of the
> test suite, after the panel tests have finished.

Caused by test-panel.testSeveralShowHides.
Attached patch patchSplinter Review
This test seems pretty brittle.  It should hide the panel only after it's shown, and it should finish the test only after the last panel is hidden.
Attachment #477825 - Flags: review?(myk)
I meant to add that all tests pass on 3.6 and beta 6 with that patch.
Comment on attachment 477825 [details] [diff] [review]
patch

Great catch!

My only concern is that the current version of the test function validates that calling panel.hide() while a panel is in the (asynchronous) process of being shown causes the show to be aborted and the panel's "show" handler not to be called, which seems useful.  The updated version of the test function, however, doesn't check for that.

Thus I wonder whether it would be better to just call panel.hide() in onShow after checking the number of times the "hide" handler was called, i.e.:

     onShow: function () {
-      test.assertEqual(3, hideCalled, 'shold call only second show');
+      test.assertEqual(3, hideCalled, "panel's hide handler called thrice");
+      panel.hide();
       test.done();
     },
We might also add a check that the "show" handler was only called once (for the last panel.show() call):

 tests.testSeveralShowHides = function(test) {
-  let hideCalled = 0;
+  let showCalled = 0, hideCalled = 0;
   test.waitUntilDone();
   let panel = panels.add(panels.Panel({
     onShow: function () {
-      test.assertEqual(3, hideCalled, 'shold call only second show');
+      showCalled++;
+      test.assertEqual(1, showCalled, "panel's show handler called once");
+      test.assertEqual(3, hideCalled, "panel's hide handler called thrice");
+      panel.hide();
       test.done();
     },
What do you think?
Attachment #477825 - Flags: review?(myk) → review+
After talking on IRC, Myk and I decided to land the patch as is.

http://hg.mozilla.org/labs/jetpack-sdk/rev/56e8179ff5b4
Assignee: nobody → adw
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
Target Milestone: -- → 0.8
The Add-on SDK is no longer a Mozilla Labs experiment and has become a big enough project to warrant its own Bugzilla product, so the "Add-on SDK" product has been created for it, and I am moving its bugs to that product.

To filter bugmail related to this change, filter on the word "looptid".
Component: Jetpack SDK → General
Product: Mozilla Labs → Add-on SDK
QA Contact: jetpack-sdk → general
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: