@@ -108,11 +108,11 @@ safaridriver.extension.commands.getWindowHandles = function(session) {
108
108
* screenshot of the focused tab as a base64 encoded PNG.
109
109
*/
110
110
safaridriver . extension . commands . takeScreenshot = function ( session ) {
111
- var response = new webdriver . promise . Deferred ( ) ;
112
- session . getCommandTab ( ) . visibleContentsAsDataURL ( function ( dataUrl ) {
113
- response . fulfill ( dataUrl . substring ( 'data:image/png;base64,' . length ) ) ;
111
+ return new webdriver . promise . Promise ( function ( fulfill ) {
112
+ session . getCommandTab ( ) . visibleContentsAsDataURL ( function ( dataUrl ) {
113
+ fulfill ( dataUrl . substring ( 'data:image/png;base64,' . length ) ) ;
114
+ } ) ;
114
115
} ) ;
115
- return response . promise ;
116
116
} ;
117
117
118
118
@@ -138,15 +138,14 @@ safaridriver.extension.commands.loadUrl = function(session, command) {
138
138
'http://code.google.com/p/selenium/issues/detail?id=3773' ) ;
139
139
}
140
140
141
- var response = new webdriver . promise . Deferred ( ) ;
142
- var tab = session . getCommandTab ( ) ;
143
- tab . whenReady ( function ( ) {
144
- var expectLoad = tab . loadsNewPage ( uri ) ;
145
- safaridriver . extension . commands . sendNavigationCommand_ ( session , command ,
146
- expectLoad ) . then ( response . fulfill , response . reject ) ;
141
+ return new webdriver . promise . Promise ( function ( fulfill , reject ) {
142
+ var tab = session . getCommandTab ( ) ;
143
+ tab . whenReady ( function ( ) {
144
+ var expectLoad = tab . loadsNewPage ( uri ) ;
145
+ safaridriver . extension . commands . sendNavigationCommand_ (
146
+ session , command , expectLoad ) . then ( fulfill , reject ) ;
147
+ } ) ;
147
148
} ) ;
148
-
149
- return response . promise ;
150
149
} ;
151
150
152
151
@@ -158,12 +157,12 @@ safaridriver.extension.commands.loadUrl = function(session, command) {
158
157
* the operation has completed.
159
158
*/
160
159
safaridriver . extension . commands . refresh = function ( session , command ) {
161
- var response = new webdriver . promise . Deferred ( ) ;
162
- session . getCommandTab ( ) . whenReady ( function ( ) {
163
- safaridriver . extension . commands . sendNavigationCommand_ ( session , command ,
164
- true ) . then ( response . fulfill , response . reject ) ;
160
+ return new webdriver . promise . Promise ( function ( fulfill , reject ) {
161
+ session . getCommandTab ( ) . whenReady ( function ( ) {
162
+ safaridriver . extension . commands . sendNavigationCommand_ (
163
+ session , command , true ) . then ( fulfill , reject ) ;
164
+ } ) ;
165
165
} ) ;
166
- return response . promise ;
167
166
} ;
168
167
169
168
0 commit comments