@@ -151,6 +151,14 @@ FirefoxDriver.prototype.close = function(respond) {
151
151
allWindows . getNext ( ) ;
152
152
}
153
153
154
+ // Here we go!
155
+ try {
156
+ var browser = respond . session . getBrowser ( ) ;
157
+ browser . contentWindow . close ( ) ;
158
+ } catch ( e ) {
159
+ goog . log . warning ( FirefoxDriver . LOG_ , 'Error closing window' , e ) ;
160
+ }
161
+
154
162
// If we're on a Mac we may close all the windows but not quit, so
155
163
// ensure that we do actually quit. For Windows, if we don't quit,
156
164
// Firefox will crash. So, whatever the case may be, if that's the last
@@ -160,22 +168,14 @@ FirefoxDriver.prototype.close = function(respond) {
160
168
161
169
// Use an nsITimer to give the response time to go out.
162
170
var event = function ( timer ) {
163
- appService . quit ( forceQuit ) ;
171
+ appService . quit ( forceQuit ) ;
164
172
} ;
165
173
166
174
FirefoxDriver . nstimer = new fxdriver . Timer ( ) ;
167
175
FirefoxDriver . nstimer . setTimeout ( event , 500 ) ;
168
176
return ; // The client should catch the fact that the socket suddenly closes
169
177
}
170
178
171
- // Here we go!
172
- try {
173
- var browser = respond . session . getBrowser ( ) ;
174
- browser . contentWindow . close ( ) ;
175
- } catch ( e ) {
176
- goog . log . warning ( FirefoxDriver . LOG_ , 'Error closing window' , e ) ;
177
- }
178
-
179
179
// Send the response so the client doesn't get a connection refused socket
180
180
// error.
181
181
respond . send ( ) ;
0 commit comments