@@ -325,11 +325,13 @@ CrossStorageClient.prototype._poll = function() {
325325 * returns {HTMLIFrameElement} The iFrame element itself
326326 */
327327CrossStorageClient . prototype . _createFrame = function ( url ) {
328- var frame = window . document . createElement ( 'iframe' ) ;
328+ var frame , key ;
329+
330+ frame = window . document . createElement ( 'iframe' ) ;
329331 frame . id = this . _frameId ;
330332
331333 // Style the iframe
332- for ( var key in CrossStorageClient . frameStyle ) {
334+ for ( key in CrossStorageClient . frameStyle ) {
333335 if ( CrossStorageClient . frameStyle . hasOwnProperty ( key ) ) {
334336 frame . style [ key ] = CrossStorageClient . frameStyle [ key ] ;
335337 }
@@ -369,8 +371,10 @@ CrossStorageClient.prototype._request = function(method, params) {
369371 } ;
370372
371373 return new this . _promise ( function ( resolve , reject ) {
374+ var timeout , originalToJSON ;
375+
372376 // Timeout if a response isn't received after 4s
373- var timeout = setTimeout ( function ( ) {
377+ timeout = setTimeout ( function ( ) {
374378 if ( ! client . _requests [ req . id ] ) return ;
375379
376380 delete client . _requests [ req . id ] ;
@@ -386,8 +390,6 @@ CrossStorageClient.prototype._request = function(method, params) {
386390
387391 // In case we have a broken Array.prototype.toJSON, e.g. because of
388392 // old versions of prototype
389- var originalToJSON ;
390-
391393 if ( Array . prototype . toJSON ) {
392394 originalToJSON = Array . prototype . toJSON ;
393395 Array . prototype . toJSON = null ;
0 commit comments