Open
Bug 669251
Opened 14 years ago
Updated 3 years ago
Mochitests should not load SimpleTest.js into secondary windows
Categories
(Testing :: Mochitest, defect)
Testing
Mochitest
Tracking
(Not tracked)
NEW
People
(Reporter: heycam, Unassigned)
References
Details
There are some mochitests that open another window, or load another document in an <iframe>, and they load SimpleTest.js into that other window. If calls to ok(), is(), etc. are made from that other window, then the results of these won't get logged properly. The SimpleTest.js in that other window thinks it is being run as a standalone test (because it can't find its parent runner) and thus just dump()s the test results out. It also doesn't know what the current test URL is, resulting in output like "TEST-UNEXPECTED-FAIL | | message" if the ok/is call fails.
Tests with separate windows/documents that do things correctly include code like
var ok = window.opener.ok;
var is = window.opener.is;
or
var ok = window.parent.ok;
var is = window.parent.is;
to import the functions it needs from the main test window.
We should probably forbid SimpleTest.js from being included in secondary windows, and fix the remaining tests up that do this to explicitly import window.parent.ok etc.
| Reporter | ||
Comment 1•14 years ago
|
||
The bug 668471 error is an example of this happening, since file_SpecialPowersFrame1.html doesn't use the parent test_SpecialPowersExtension2.html's version of is().
Two other alternatives:
* make SimpleTest.js look to see if window.opener.SimpleTest or
window.parent.SimpleTest exist and automatically do the import of the
public SimpleTest.* functions
* create a separate SimpleTestForSecondaryWindow.js that unconditionally does
an import like this
Assignee: nobody → cam
Status: NEW → ASSIGNED
| Reporter | ||
Comment 2•14 years ago
|
||
Not working on this at the moment. My preferred solution is the "make SimpleTest.js look to see if ..." one, since that kind of searching for the TestRunner object is already being done at the top of SimpleTest.js.
Assignee: cam → nobody
Status: ASSIGNED → NEW
Updated•3 years ago
|
Severity: normal → S3
You need to log in
before you can comment on or make changes to this bug.
Description
•