Comment on attachment 663329 [details] Patch v1 Simple fix to ensure we check first that the window really has a getBrowser() method attached to it.
Comment on attachment 663329 [details] Patch v1 r+ with one nit: Please move the aWindow.getBrowser() to a separate if statement so we only need to call it once.
(In reply to Andrew Halberstadt [:ahal] from comment #4) > Please move the aWindow.getBrowser() to a separate if statement so we only > need to call it once. Is this really necessary? It makes the code more complex while it only returns the gBrowser property.
Ok, so the following code does what you want in a single command: var browser = ("getBrowser" in aWindow) ? aWindow.getBrowser() : null; Pushed to master: https://github.com/mozilla/mozmill/commit/fcc4a97b3d047a266c62f0a101562c1b58fcfc41