From 52e5075989a73202470e7d7f349ee775ce0cb76a Mon Sep 17 00:00:00 2001 From: Dmitriy Simushev Date: Thu, 7 Feb 2013 10:49:09 +0000 Subject: [PATCH] Fix bugs with wrong requests sequence in server.js --- src/messenger/webim/js/compiled/default/server.js | 6 +++--- src/messenger/webim/js/compiled/default_app.js | 6 +++--- src/messenger/webim/js/source/default/server.js | 5 ----- 3 files changed, 6 insertions(+), 11 deletions(-) diff --git a/src/messenger/webim/js/compiled/default/server.js b/src/messenger/webim/js/compiled/default/server.js index 4326e57e..0e8313cf 100644 --- a/src/messenger/webim/js/compiled/default/server.js +++ b/src/messenger/webim/js/compiled/default/server.js @@ -9,6 +9,6 @@ for(var d in a)a.hasOwnProperty(d)&&this.mibewAPI.checkFunction(a[d],!1);var c=this.generateToken();this.callbacks[c]=e;this.buffer.push({token:c,functions:a});b&&this.update()}catch(f){return this.options.onCallError(f),!1}return!0};b.Server.prototype.callFunctionsPeriodically=function(a,e){this.callPeriodically.push({functionsListBuilder:a,callbackFunction:e})};b.Server.prototype.generateToken=function(){var a;do a="wnd"+(new Date).getTime().toString()+Math.round(50*Math.random()).toString();while(a in this.callbacks);return a};b.Server.prototype.processRequest=function(a){var e=new MibewAPIExecutionContext,b=this.mibewAPI.getResultFunction(a.functions,this.callbacks.hasOwnProperty(a.token));if(null===b)for(var d in a.functions)a.functions.hasOwnProperty(d)&&(this.processFunction(a.functions[d],e),this.buffer.push(this.mibewAPI.buildResult(e.getResults(),a.token)));else this.callbacks.hasOwnProperty(a.token)&&(this.callbacks[a.token](b.arguments),delete this.callbacks[a.token])};b.Server.prototype.processFunction= function(a,e){if(this.functions.hasOwnProperty(a["function"])){var b=e.getArgumentsList(a),d={},f;for(f in this.functions[a["function"]])this.functions[a["function"]].hasOwnProperty(f)&&(d=c.extend(d,this.functions[a["function"]][f](b)));e.storeFunctionResults(a,d)}};b.Server.prototype.sendRequests=function(a){this.ajaxRequest=g.ajax({url:this.options.url,timeout:5E3,async:!0,cache:!1,type:"POST",dataType:"text",data:{data:this.mibewAPI.encodePackage(a)},success:c.bind(this.receiveResponse,this), -error:c.bind(this.onError,this)})};b.Server.prototype.runUpdater=function(){null==this.updateTimer&&this.update();this.updateTimer=setTimeout(c.bind(this.update,this),1E3*this.options.requestsFrequency)};b.Server.prototype.restartUpdater=function(){this.updateTimer&&clearTimeout(this.updateTimer);this.ajaxRequest&&this.ajaxRequest.abort();this.update();this.updateTimer=setTimeout(c.bind(this.update,this),1E3*this.options.reconnectPause)};b.Server.prototype.update=function(){this.updateTimer&&clearTimeout(this.updateTimer); -for(var a=0;a