PDA

View Full Version : ScriptTagProxy couldn't abort the request.



azdxc
7 Jun 2011, 9:12 PM
hi Friends:
it seems to be that the scripttagproxy couldn't abort the request.
it will call the loadexception if the request is timeout.
Then i aborted the request in loadexception.
But i still can see the request is loading in the firebug's console.
It will be aborted if i click the 'ESC' button.
I'm comfused about why the abort function doesn't work.

The case causes that all the rest requests are blocked.

It's my code about it:

var adminStore = new Ext.data.JsonStore({
proxy: new Ext.data.ScriptTagProxy({
timeout : 5000,
api:{
read:"http://localhost:8080/hbo-chaf-services/adminContext?service=all"
}
}),
autoDestroy: true,
autoLoad: true,
root : 'data',
totalProperty:'totalSize',
fields: resultrecordType,
//autoLoad: true,
listeners: {
exception: function(){
},
loadexception: function(){
this.destroy();
var server = Ext.getCmp('servicesServer').getValue();
server = transferServerName(server);
adminPanel.setTitle(adminPanelTitle +' - <font color="red">'+ server+' is down</font>');
},
load: function(){
var server = Ext.getCmp('servicesServer').getValue();
server = transferServerName(server);
adminPanel.setTitle(adminPanelTitle +' - '+ server);
task.delay(2000);
}
}
});

skirtle
9 Jun 2011, 11:56 PM
Take a look at the ExtJS source code for ScriptTagProxy. Calling abort() won't do anything but that's irrelevant because handleFailure() will have already called destroyTrans() anyway. In short, you don't need to call abort() if the request times out.

ScriptTagProxy works by injecting an HTML script tag into your page. You may want to use Firebug's HTML tab to watch those tags being added/removed from your document's head element.

I wouldn't trust Firebug's claims as to whether the resource is still loading. Does the request eventually complete or does it just sit there forever? Do you have access to the server to verify whether it is still attempting to perform the request? I suspect the browser has given up on the request but didn't tell Firebug.