Closed Bug 414303 Opened 16 years ago Closed 16 years ago

Allow docshell/test/navigation tests to run in embedding builds


(Core :: DOM: Navigation, defect)

Windows XP
Not set





(Reporter: mozilla, Assigned: abarth-mozilla)



(1 file, 1 obsolete file)

The frame navigation tests added in bug 408052 assume they're being run on Firefox. When using nsIWindowWatcher to find open windows, the tests assume they're getting a Chrome window and reach inside to find the gBrowser. However, the gBrowser won't be there on embedding builds -- apparently nsIWindowWatcher will return a content window instead. We should detect whether the window watcher gave us a ChromeWindow or a content window to decide whether to find its child windows.

(Ideally, it would be nice if nsIWindowWatcher had some way to enumerate content windows directly, but perhaps that's too much to ask.)
Yeah, windowwatcher basically just returns what people tell it about, and XUL-based apps tell it about the toplevel XUL windows.  And it's frozen, more the fun.
Attached patch Patch for NavigationUtils.js (obsolete) — Splinter Review
Based on comments from bz, we think this patch will let the tests will work in embedded builds, but we aren't sure how to run the tests in that mode.
Attachment #299701 - Flags: review?(bzbarsky)
Hmm...  For ChromeWindow, I'd prefer we stick with the gBrowser thing or something.  frames could include all sorts of random UI stuff, in the future...

And there's no obvious way yet to run mochitests in an embedding build, sadly.  But the "else" branches look fine.  ;)
Ok.  This patch uses gBrowser to find the content windows.  We're still using instanceof ChromeWindow to detect whether we've got a ChromeWindow because sometimes (due to race conditions) we see a ChromeWindow before it has a gBrowser object.  In those cases, its safe to ignore the window because we'll catch it on the next call to poll().
Attachment #299701 - Attachment is obsolete: true
Attachment #299705 - Flags: review?(bzbarsky)
Attachment #299701 - Flags: review?(bzbarsky)
Comment on attachment 299705 [details] [diff] [review]
Updated patch for NavigationUtils.js

This looks great.  Thanks for doing it!
Attachment #299705 - Flags: superreview+
Attachment #299705 - Flags: review?(bzbarsky)
Attachment #299705 - Flags: review+
Checked in that change.
Assignee: nobody → hk9565
Closed: 16 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.