joewalker/devtools-window — pull request #286 by mihaisucan (2012-11-20 18:20:58+00:00)
Title: Fix for Issue #169 and #266

Problems:

* some tests did not use `addTab()` which meant they reused the previous tab, and that would be tab 1, which should always be blank. Namely the test is `browser_styleeditor_passedinsheet.js`. This is what causes the style editor `test_private.html` file to show in style inspector test failures - in screenshots. This may or may not be related/causing breakage in style inspector tests (or other devtools tests).

* `selectStyleSheet()` called multiple times, at startup, caused multiple internal event handlers to fire and override each other in broken ways. Mainly this issue manifested itself with the source editor loading but having its own iframe destroyed during startup. What style editor tried to do was to select sheet 0, then select sheet N (where N would be whatever our test code wants). Selecting sheet N forced the destroy of the source editor in the middle of the load.

* The style editor private mode test failed with the fix for `selectStyleSheet` and the `passedinsheet.js` test enabled, but without the `addTab()` call. This was surprising - tab reusing should work, even if it's a test bug. I found that TabTarget reused the same web progress listener for all TabTarget instances, for the entire lifetime of the browser. Ouch. This broke `will-navigate`, `navigate` and probably more, in all devtools.

Please review and let me know if things still work. t+ here.