Closed Bug 618878 Opened 15 years ago Closed 15 years ago

content page in a unit test doesn't have document object defined

Categories

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

x86_64
Linux
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 614757

People

(Reporter: mcepl, Unassigned)

References

Details

Attachments

(3 files)

Attached file example reproducer
When I run the attached project via cfx run (this is defined for bugzilla.redhat.com, but should work on bugzilla.mozilla.org as well, but I don't have proper permissions to test it here), I have perfectly working content script. However when I run the essentially through essentially same pageMod command, I get error that document object doesn't exist in main(). If there is anything wrong with my script, then I would expect some more reasonable error message than this.
This is really really crazy. Just by switching from one project to another (without changing anything) tests start to fail: jakoubek:test-page-mod-bug (master) $ cfx test -v -g test Using binary at '/usr/bin/firefox'. Using profile at '/home/matej/.mozilla/firefox/2w1rsebw.testProfile'. Running tests on Firefox 4.0b7/Gecko 2.0b7 ({ec8030f7-c20a-464f-9b0e-13a3a9e97384}) under Linux/x86_64-gcc3. info: executing 'test-pageMod.ensurePageLoadsWell' ** (firefox:29843): WARNING **: AT-SPI: Accessibility bus not found - Using session bus. console: [JavaScript Warning: "Error in parsing value for 'white-space'. Declaration dropped." {file: "https://bugzilla.mozilla.org/skins/standard/global.css" line: 294}] console: [JavaScript Warning: "Error in parsing value for 'white-space'. Declaration dropped." {file: "https://bugzilla.mozilla.org/skins/standard/global.css" line: 295}] console: [JavaScript Warning: "Error in parsing value for 'white-space'. Declaration dropped." {file: "https://bugzilla.mozilla.org/skins/standard/global.css" line: 296}] info: location = https://bugzilla.mozilla.org/ info: location = https://bugzilla.mozilla.org/ info: origButton = [object XrayWrapper [object HTMLFormElement]] info: origButton = [object XrayWrapper [object HTMLFormElement]] info: pass: test of loading the page warning: 3 warnings or errors were logged to the platform's nsIConsoleService, which could be of no consequence; however, they could also be indicative of aberrant behavior. 1 of 1 tests passed. OK Total time: 5.985749 seconds Program terminated successfully. jakoubek:test-page-mod-bug (master) $ cd ~/projekty/mass-close-duplicates/ jakoubek:mass-close-duplicates (pageMod2) $ cfx test -v -g testUsing binary at '/usr/bin/firefox'. Using profile at '/home/matej/.mozilla/firefox/2w1rsebw.testProfile'. Running tests on Firefox 4.0b7/Gecko 2.0b7 ({ec8030f7-c20a-464f-9b0e-13a3a9e97384}) under Linux/x86_64-gcc3. info: executing 'test-pageMod.ensureSimplePageLoad' ** (firefox:29922): WARNING **: AT-SPI: Accessibility bus not found - Using session bus. console: [JavaScript Warning: "Error in parsing value for 'white-space'. Declaration dropped." {file: "https://bugzilla.mozilla.org/skins/standard/global.css" line: 294}] console: [JavaScript Warning: "Error in parsing value for 'white-space'. Declaration dropped." {file: "https://bugzilla.mozilla.org/skins/standard/global.css" line: 295}] console: [JavaScript Warning: "Error in parsing value for 'white-space'. Declaration dropped." {file: "https://bugzilla.mozilla.org/skins/standard/global.css" line: 296}] error: [object Object] info: location = https://bugzilla.mozilla.org/ info: pass: test of loading the page error: An exception occurred. Traceback (most recent call last): File "resource://mass-close-duplicates-api-utils-lib/timer.js", line 64, in notifyOnTimeout this._callback.apply(null, this._params); File "resource://mass-close-duplicates-api-utils-lib/content/worker.js", line 61, in emitter emit.apply(scope, params); File "resource://mass-close-duplicates-api-utils-lib/events.js", line 129, in _emit return this._emitOnObject.apply(this, args); File "resource://mass-close-duplicates-api-utils-lib/events.js", line 159, in _emitOnObject listener.apply(targetObj, params); File "/home/matej/archiv/2010/projekty/mass-close-duplicates/data/simplePageWorker.js", line 7, in onMessage File "/home/matej/archiv/2010/projekty/mass-close-duplicates/data/simplePageWorker.js", line 17, in main TypeError: document is null error: An exception occurred. Traceback (most recent call last): File "resource://mass-close-duplicates-api-utils-lib/timer.js", line 64, in notifyOnTimeout this._callback.apply(null, this._params); File "resource://mass-close-duplicates-api-utils-lib/content/worker.js", line 61, in emitter emit.apply(scope, params); File "resource://mass-close-duplicates-api-utils-lib/events.js", line 129, in _emit return this._emitOnObject.apply(this, args); File "resource://mass-close-duplicates-api-utils-lib/events.js", line 159, in _emitOnObject listener.apply(targetObj, params); File "/home/matej/archiv/2010/projekty/mass-close-duplicates/data/pageWorker.js", line 20, in onMessage File "/home/matej/archiv/2010/projekty/mass-close-duplicates/data/pageWorker.js", line 39, in main TypeError: document is null error: warnings and/or errors were logged. 1 of 2 tests passed. The following tests failed: FAIL Total time: 3.759418 seconds Program terminated unsuccessfully. jakoubek:mass-close-duplicates (pageMod2) $ colordiff -u ~/projekty/jetpack/packages/test-page-mod-bug/data/pageWorker.js data/simplePageWorker.js |less -r jakoubek:mass-close-duplicates (pageMod2) $ pgrep -f -l firefox 19921 /usr/lib64/firefox-4/firefox -UILocale cs jakoubek:mass-close-duplicates (pageMod2) $ cd - /home/matej/projekty/jetpack/packages/test-page-mod-bug jakoubek:test-page-mod-bug (master) $ cfx test -v -g testUsing binary at '/usr/bin/firefox'. Using profile at '/home/matej/.mozilla/firefox/2w1rsebw.testProfile'. Running tests on Firefox 4.0b7/Gecko 2.0b7 ({ec8030f7-c20a-464f-9b0e-13a3a9e97384}) under Linux/x86_64-gcc3. info: executing 'test-pageMod.ensurePageLoadsWell' ** (firefox:30053): WARNING **: AT-SPI: Accessibility bus not found - Using session bus. console: [JavaScript Warning: "Error in parsing value for 'white-space'. Declaration dropped." {file: "https://bugzilla.mozilla.org/skins/standard/global.css" line: 294}] console: [JavaScript Warning: "Error in parsing value for 'white-space'. Declaration dropped." {file: "https://bugzilla.mozilla.org/skins/standard/global.css" line: 295}] console: [JavaScript Warning: "Error in parsing value for 'white-space'. Declaration dropped." {file: "https://bugzilla.mozilla.org/skins/standard/global.css" line: 296}] info: location = https://bugzilla.mozilla.org/ info: location = https://bugzilla.mozilla.org/ info: pass: test of loading the page error: An exception occurred. Traceback (most recent call last): File "resource://test-page-mod-bug-api-utils-lib/timer.js", line 64, in notifyOnTimeout this._callback.apply(null, this._params); File "resource://test-page-mod-bug-api-utils-lib/content/worker.js", line 61, in emitter emit.apply(scope, params); File "resource://test-page-mod-bug-api-utils-lib/events.js", line 129, in _emit return this._emitOnObject.apply(this, args); File "resource://test-page-mod-bug-api-utils-lib/events.js", line 159, in _emitOnObject listener.apply(targetObj, params); File "/home/matej/archiv/2010/projekty/jetpack/packages/test-page-mod-bug/data/pageWorker.js", line 20, in onMessage File "/home/matej/archiv/2010/projekty/jetpack/packages/test-page-mod-bug/data/pageWorker.js", line 39, in main TypeError: document is null error: An exception occurred. Traceback (most recent call last): File "resource://test-page-mod-bug-api-utils-lib/timer.js", line 64, in notifyOnTimeout this._callback.apply(null, this._params); File "resource://test-page-mod-bug-api-utils-lib/content/worker.js", line 61, in emitter emit.apply(scope, params); File "resource://test-page-mod-bug-api-utils-lib/events.js", line 129, in _emit return this._emitOnObject.apply(this, args); File "resource://test-page-mod-bug-api-utils-lib/events.js", line 159, in _emitOnObject listener.apply(targetObj, params); File "/home/matej/archiv/2010/projekty/jetpack/packages/test-page-mod-bug/data/pageWorker.js", line 20, in onMessage File "/home/matej/archiv/2010/projekty/jetpack/packages/test-page-mod-bug/data/pageWorker.js", line 39, in main TypeError: document is null error: warnings and/or errors were logged. 1 of 2 tests passed. The following tests failed: FAIL Total time: 3.984895 seconds Program terminated unsuccessfully. jakoubek:test-page-mod-bug (master) $
second project is http://gitorious.org/addon-sdk/test-page-mod-bug which is very simplified test just to make sure I know how to write pageMod tests.
So looks like this was related to: https://bugzilla.mozilla.org/show_bug.cgi?id=614757 Which was regression in FF which is fixed now. I'll keep this one open to make sure we add tests for this bug.
Yes!!! This IS a duplicate of bug 614757, and it has been fixed in FF4b8 Thank you, Irakli!
Status: NEW → RESOLVED
Closed: 15 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: