Closed
Bug 610953
Opened 14 years ago
Closed 7 years ago
hudservice head.js should not declare variables or call waitForFinish
Categories
(DevTools :: Console, defect, P3)
DevTools
Console
Tracking
(Not tracked)
RESOLVED
WONTFIX
People
(Reporter: Gavin, Unassigned)
References
Details
(Whiteboard: [console-3])
It's really quite unexpected that a head.js would call waitForFinish() - that isn't even supposed to be called before the test's test() method is. It's also quite confusing to have variables declared in head.js, since it's not obvious when reading tests where they come from.
Also, rather than defining some globals and having all tests follow essentially the same |addTab(URI); browser.addEventListener();| pattern, I think it would be better to add a common onTabLoad() helper that accepts a callback to invoke on load of a given URI.
Comment 1•14 years ago
|
||
Assigning to ddahl as I believe he created head.js when splitting up the tests. Obviously, we're trying to finish up some of the feature still, but we should ensure that the tests follow best practices as much as is possible.
Assignee: nobody → ddahl
Blocks: devtools4
Comment 2•14 years ago
|
||
(In reply to comment #0)
> It's really quite unexpected that a head.js would call waitForFinish() - that
> isn't even supposed to be called before the test's test() method is. It's also
> quite confusing to have variables declared in head.js, since it's not obvious
> when reading tests where they come from.
>
I thought that was the whole point of head.js:
http://mxr.mozilla.org/mozilla-central/source/modules/libpr0n/test/browser/head.js
http://mxr.mozilla.org/mozilla-central/source/dom/indexedDB/test/head.js
http://mxr.mozilla.org/mozilla-central/source/toolkit/mozapps/extensions/test/xpinstall/head.js
http://mxr.mozilla.org/mozilla-central/source/browser/base/content/test/tabview/head.js
> Also, rather than defining some globals and having all tests follow essentially
> the same |addTab(URI); browser.addEventListener();| pattern, I think it would
> be better to add a common onTabLoad() helper that accepts a callback to invoke
> on load of a given URI.
That sounds cleaner, yes. This sounds like a good post-fx-4 clean up bug
Comment 3•14 years ago
|
||
(In reply to comment #2)
> (In reply to comment #0)
> > It's really quite unexpected that a head.js would call waitForFinish() - \\
I imagine this is true, the previous comment was about defining functions in head.js
Reporter | ||
Comment 4•14 years ago
|
||
Functions are fine, it's the variables that aren't. Currently tests assign to tab/browser/hudId/hud/hudBox/filterBox/outputNode/cs without declaring them, and it looks like they're using undeclared variables until you remember that they're declared in head.js. There isn't really any benefit to avoiding the declaration in the test files, and there are cleaner/more obvious ways to share state.
Reporter | ||
Updated•14 years ago
|
Severity: normal → minor
Updated•14 years ago
|
Whiteboard: [console-3]
Comment 6•13 years ago
|
||
As Gavin mentioned in bug 660619, we should also be removing the imports from head.js: "Test code shouldn't be re-importing all of these things - if they're really needed they're already imported by the chrome window the test is running in."
Comment 7•12 years ago
|
||
triage. Filter on PINKISBEAUTIFUL
Assignee: ddahl → nobody
Component: Developer Tools → Developer Tools: Console
Updated•12 years ago
|
Blocks: consolecleanup
Updated•12 years ago
|
Priority: P2 → --
Updated•12 years ago
|
Priority: -- → P3
Comment 8•7 years ago
|
||
Inactive for 5 years. Closing now.
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → WONTFIX
Updated•6 years ago
|
Product: Firefox → DevTools
You need to log in
before you can comment on or make changes to this bug.
Description
•