Closed Bug 876250 Opened 11 years ago Closed 4 years ago

Mozmill test files re-import mozmill and elementlibs already provided by the loader

Categories

(Thunderbird :: Testing Infrastructure, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED WORKSFORME

People

(Reporter: tessarakt, Unassigned)

References

()

Details

The Mozmill file loader already injects several components into all loaded files:

http://mxr.mozilla.org/comm-central/source/mail/test/resources/mozmill/mozmill/extension/resource/modules/frame.js#86

> module.mozmill = mozmill;
> module.elementslib = elementslib;

test-folder-helpers.js does this:

http://mxr.mozilla.org/comm-central/source/mail/test/mozmill/shared-modules/test-folder-display-helpers.js

> var elib = {};
> Cu.import('resource://mozmill/modules/elementslib.js', elib);

> var mozmill = {};
> Cu.import('resource://mozmill/modules/mozmill.js', mozmill);

Same holds, e.g., for test-window-helpers.js.

These redundant imports should be removed. Where necessary, references to "elib" have to be replaced with "elementslib".
See Also: → 876089
elementslib is imported in tons of tests. If it is unneded, removing the imports could speed up the tests a bit.
Status: UNCONFIRMED → NEW
Ever confirmed: true
Isn't the whole point of modules that you can import them multiple times and they are still only evaluated once? In that case that speed up is likely not even measurable.
Probably yes, but it may reduce the clutter in the headers of many tests.
OTOH, if it's declared in the header you know what to expect - and there's less magic...
(In reply to Magnus Melin from comment #4)
> OTOH, if it's declared in the header you know what to expect - and there's
> less magic...

IMO, the real question is: What is the API "guaranteed" by Mozmill? Should we rather rely on being able to import from resource://mozmill/modules/*.js or on having the symbols elementslib and mozmill provided in the scope of each script?

Maybe ask upstream?

mozmill is gone.

Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.