Closed Bug 607090 Opened 9 years ago Closed 9 years ago

reading-data tests fail to run with "TypeError: this.__xulPanel is null"

Categories

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

x86
Linux
defect
Not set

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: myk, Unassigned)

References

Details

On trunk, the reading-data example addon's tests fail to run with the exception "TypeError: this.__xulPanel is null":

--------------------------------------------------------------------------------
(addon-sdk)myk@myk:~/Projects/addon-sdk/examples/reading-data$ cfx test
Using binary at '/home/myk/bin/firefox'.
Using profile at '/tmp/tmpNU0Vqe.mozrunner'.

(firefox-bin:3459): GLib-WARNING **: g_set_prgname() called multiple times
Traceback (most recent call last):
  File "resource://reading-data-addon-kit-lib/panel.js", line 264, in 
    _onInit: function _onInit() {
  File "resource://reading-data-jetpack-core-lib/traits.js", line 151, in compose
    return Composition(_compose.apply(null, traits.map(TraitDescriptor)));
  File "resource://reading-data-jetpack-core-lib/traits.js", line 75, in TraitDescriptor
    ) ? object._trait(TraitDescriptor) : _trait(object)
  File "resource://reading-data-jetpack-core-lib/traits/core.js", line 136, in trait
    let descriptor = getOwnPropertyDescriptor(properties, key);
  File "resource://reading-data-addon-kit-lib/panel.js", line 217, in 
    get _viewFrame() this.__xulPanel.children[0],
TypeError: this.__xulPanel is null
No tests were run
FAIL
Total time: 1.499582 seconds
Program terminated unsuccessfully.
--------------------------------------------------------------------------------


The line in question is:

  get _viewFrame() this.__xulPanel.children[0], 

Before that line is this code and comments that explain that this.__xulPanel might be null:

  // While the panel is visible, this is the XUL <panel> we use to display it.
  // Otherwise, it's null.
  get _xulPanel() this.__xulPanel,
  ...
  __xulPanel: null,
  get _viewFrame() this.__xulPanel.children[0], 

So _viewFrame should definitely be checking this.__xulPanel before trying to access a property of one of its properties, i.e. something like:

  get _viewFrame() this.__xulPanel ? this.__xulPanel.children[0] : null,

Nevertheless, the tests pass on Firefox 4.0b6, so there may well be another problem here.

Irakli: any thoughts on this one?


FWIW, even with that null check, the tests still don't pass on trunk, due to:

--------------------------------------------------------------------------------
(addon-sdk)myk@myk:~/Projects/addon-sdk/examples/reading-data$ cfx test
Using binary at '/home/myk/bin/firefox'.
Using profile at '/tmp/tmpFgc_wq.mozrunner'.

(firefox-bin:3677): GLib-WARNING **: g_set_prgname() called multiple times
.info: My ID is 6724fc1b-3ec4-40e2-8583-8061088b3185
error: TEST FAILED: test-main.testReplace (exception)
error: An exception occurred.
Traceback (most recent call last):
  File "chrome://browser/content/browser.js", line 6539, in delayedStartup
    .init(window);
  File "jar:file:///home/myk/Applications/firefox-trunk/omni.jar!/components/nsSessionStore.js", line 389, in sss_init
    this.onLoad(aWindow);
  File "jar:file:///home/myk/Applications/firefox-trunk/omni.jar!/components/nsSessionStore.js", line 727, in sss_onLoad
    Services.obs.notifyObservers(null, NOTIFY_WINDOWS_RESTORED, "");
  File "file:///tmp/tmpFgc_wq.mozrunner/extensions/xulapp@toolness.com/components/harness.js", line 385, in Harness_observe
    this.load(lifeCycleObserver192.loadReason || "startup");
  File "file:///tmp/tmpFgc_wq.mozrunner/extensions/xulapp@toolness.com/components/harness.js", line 317, in Harness_load
    obSvc.notifyObservers(null, APP_READY_TOPIC, null);
  File "resource://reading-data-jetpack-core-lib/observer-service.js", line 174, in 
    this.callback(subject, data);
  File "resource://reading-data-test-harness-lib/run-tests.js", line 106, in doRunTests
    callbacks.print);
  File "resource://reading-data-test-harness-lib/run-tests.js", line 69, in runTests
    onDone: onDone});
  File "resource://reading-data-test-harness-lib/harness.js", line 367, in runTests
    nextIteration();
  File "resource://reading-data-test-harness-lib/harness.js", line 286, in nextIteration
    onDone: nextIteration});
  File "resource://reading-data-jetpack-core-lib/unit-test.js", line 50, in findAndRunTests
    onDone: options.onDone});
  File "resource://reading-data-jetpack-core-lib/unit-test.js", line 284, in startMany
    runNextTest(this);
  File "resource://reading-data-jetpack-core-lib/unit-test.js", line 280, in runNextTest
    self.start({test: test, onDone: runNextTest});
  File "resource://reading-data-jetpack-core-lib/unit-test.js", line 298, in start
    this.test.testFunction(this);
  File "resource://reading-data-jetpack-core-lib/unit-test.js", line 63, in runTest
    test(runner);
  File "resource://reading-data-reading-data-tests/test-main.js", line 11, in 
    m.main({ staticArgs: {} }, callbacks);
  File "resource://reading-data-reading-data-lib/main.js", line 14, in 
    var helloHTML = self.data.load("sample.html");
  File "resource://reading-data-jetpack-core-lib/self.js", line 49, in load
    let data = file.read(fn);
  File "resource://reading-data-jetpack-core-lib/file.js", line 95, in read
    var stream = exports.open(filename);
  File "resource://reading-data-jetpack-core-lib/file.js", line 161, in open
    ensureFile(file);
  File "resource://reading-data-jetpack-core-lib/file.js", line 77, in ensureFile
    ensureExists(file);
  File "resource://reading-data-jetpack-core-lib/file.js", line 85, in ensureExists
    filename: file.path
  File "resource://reading-data-jetpack-core-lib/xpcom.js", line 185, in friendlyError
    return new Error("path does not exist: " + filename);
Error: path does not exist: /home/myk/Projects/addon-sdk/packages/jetpack-core/data/sample.html
.error: fail: "resource://reading-data-jetpack-core-data/sample.html" != "resource://reading-data-reading-data-data/sample.html"
info: Traceback (most recent call last):
  File "resource://reading-data-jetpack-core-lib/timer.js", line 64, in notifyOnTimeout
    this._callback.apply(null, this._params);
  File "resource://reading-data-jetpack-core-lib/unit-test.js", line 255, in anonymous
    timer.setTimeout(function() { onDone(self); }, 0);
  File "resource://reading-data-jetpack-core-lib/unit-test.js", line 280, in runNextTest
    self.start({test: test, onDone: runNextTest});
  File "resource://reading-data-jetpack-core-lib/unit-test.js", line 298, in start
    this.test.testFunction(this);
  File "resource://reading-data-jetpack-core-lib/unit-test.js", line 63, in runTest
    test(runner);
  File "resource://reading-data-reading-data-tests/test-main.js", line 19, in anonymous
    "resource://reading-data-reading-data-data/sample.html");
  File "resource://reading-data-jetpack-core-lib/unit-test.js", line 227, in assertEqual
    this.fail(message);
  File "resource://reading-data-jetpack-core-lib/unit-test.js", line 145, in fail
    console.trace();
  File "resource://reading-data-jetpack-core-lib/plain-text-console.js", line 98, in trace
    var stack = traceback.get();

2 of 4 tests passed.
FAIL
Total time: 1.923245 seconds
Program terminated unsuccessfully.
--------------------------------------------------------------------------------
Recent platform fixes appear to have resolved this problem.
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
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.