Closed Bug 671458 Opened 14 years ago Closed 13 years ago

lib/driver.js:getBrowserWindow() and openBrowserWindow() need generic and local versions

Categories

(Mozilla QA Graveyard :: Mozmill Tests, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: gmealer, Assigned: whimboo)

References

Details

(Whiteboard: [lib][module-refactor])

Attachments

(1 file)

lib/driver.js currently has two functions, getBrowserWindow() and openBrowserWindow(). They return existing and new browser windows respectively. Currently, getBrowserWindow(), by default, returns BrowserWindow, a local specified class for Firefox windows. openBrowserWindow, in contrast, returns a default of ChromeWindowWrapper, a generic class for any Chrome window. Ultimately, we want the A-Team to own these as part of Mozmill 2.0. For that to happen, both need to return ChromeWindowWrappers in their versions. But or our use, we'll want versions that return BrowserWindows by default. So, we need the original functions genericized, and wrappers around them that feed them the right default class for our use (they're factories, after Bug 668221 is checked in). There are a couple of ways to do this: 1) We find somewhere else in our API to add getBrowserWindow and openBrowserWindow. I'd argue the most "correct" way would be as a class function on BrowserWindow, or at least helpers in the browser module. But then that has to be imported as well, which is kind of sucky. 2) We replace the driver functions in the global setup function: driver.getBrowserWindowOrig = driver.getBrowserWindow driver.getBrowserWindow = function (class, open) { this.getBrowserWindowOrig(class || browser.BrowserWindow, open) } I'm throwing it out as a possibility, but it's not one I'd probably choose. If any internal Mozmill code uses these functions, I think they'll get our classes by default if we do this. 3) In setup, we create new functions on driver: driver.getFirefoxWindow = function (class, open) { this.getBrowserWindow(class || browser.BrowserWindow, open) } This the route I'd probably choose, and likely with that naming. We might even choose to rename the BrowserWindow class to FirefoxWindow instead (and browser.js to firefox.js, etc) which I like better for a number of reasons, not the least of which is that SeaMonkey doesn't get covered by our "browser" classes. We might even want DesktopFirefox naming to differentiate from the eventual maps for Mobile Firefox. A bit of the tangent on naming, but not irrelevant; however we choose to name, the local versions of the functions should be named the same.
A Pivotal Tracker story has been created for this Bug: https://www.pivotaltracker.com/story/show/15817987
Blocks: 639870
As discussed on the Mozmill-Dev mailing list both functions in the driver module should return a basic DOMWindow. We would need our local wrappers which return the appropriate window wrapper. http://groups.google.com/group/mozmill-dev/browse_thread/thread/66ed32ade47a3329
Assignee: nobody → hskupin
Status: NEW → ASSIGNED
Component: Mozmill Tests → Mozmill Shared Modules
QA Contact: mozmill-tests → mozmill-shared-modules
Hardware: x86 → All
A Pivotal Tracker story has been created for this Bug: https://www.pivotaltracker.com/story/show/16760143
Henrik Skupin changed story state to started in Pivotal Tracker
Blocks: 677482
Attached patch Patch v1Splinter Review
Attachment #551708 - Flags: review?(gmealer)
Comment on attachment 551708 [details] [diff] [review] Patch v1 r+, let's get it merged in and the driver module to Clint. I thought we were going to just remove driver.getBrowserWindow() and driver.openBrowserWindow() but I'm OK with this approach too. I'm not 100% sure on having these functions be top-level of the windows module; at the very least, we'll probably want to restore the class-factory aspects so they can return subclasses. But let's worry about that later, it doesn't need to block checkin.
Attachment #551708 - Flags: review?(gmealer) → review+
(In reply to Geo Mealer [:geo] from comment #6) > r+, let's get it merged in and the driver module to Clint. I thought we were > going to just remove driver.getBrowserWindow() and > driver.openBrowserWindow() but I'm OK with this approach too. No. As given by Clint those methods should remain even if they are application specific. > I'm not 100% sure on having these functions be top-level of the windows > module; You can't put those methods into a window wrapper or one of its subclasses. What would you have in mind? > at the very least, we'll probably want to restore the class-factory > aspects so they can return subclasses. But let's worry about that later, it > doesn't need to block checkin. Why would we need that? I don't think that you will ever wanna have a basic WindowWrapper returned. The methods are specific for the browser window and should always return an instance of BrowserWindow. But hey, we could move those methods from windows.js into browser.js, it's a better location there.
Doh, I'm a bad reviewer! I saw you moved them into windows, and assumed they were returning chrome wrappers. My comments were based on that. Yes, let's move them into browser.js as top-level functions and keep them the way they are. No re-review necessary if you're just changing files and removing the extra requires. If you break something, I'll quickly fix it in the repo, but I think it'll be fine. Re: Clint, no prob. His email reply was a little ambiguous as to which way he agreed, but I'm happy to do it either way.
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Henrik Skupin changed story state to delivered in Pivotal Tracker
Henrik Skupin changed story state to accepted in Pivotal Tracker
Henrik Skupin changed story state to accepted in Pivotal Tracker
Component: Mozmill Shared Modules → Mozmill Tests
Whiteboard: [module-refactor] → [lib]
Whiteboard: [lib] → [lib][module-refactor]
Product: Mozilla QA → Mozilla QA Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: