1
由於某種原因,該功能與firefox一起凍結,直到它完全從請求的站點檢索到流。有沒有防止凍結的機制,所以它按預期工作?Firefox擴展功能正在凍結Firefox,直到請求完成
在XUL<statusbarpanel id="eee_label" tooltip="eee_tooltip"
onclick="eee.retrieve_rate(event);"/>
的Javascript
retrieve_rate: function(e)
{
var ajax = null;
ajax = new XMLHttpRequest();
ajax.open('GET', 'http://site.com', false);
ajax.onload = function()
{
if (ajax.status == 200)
{
var regexp = /blabla/g;
var match = regexp.exec(ajax.responseText);
while (match != null)
{
window.dump('Currency: ' + match[1] + ', Rate: '
+ match[2] + ', Change: ' + match[3] + "\n");
if(match[1] == "USD")
rate_USD = sprintf("%s:%s", match[1], match[2]);
if(match[1] == "EUR")
rate_EUR = sprintf("%s:%s", match[1], match[2]);
if(match[1] == "RUB")
rate_RUB = sprintf("%s/%s", match[1], match[2]);
match = regexp.exec(ajax.responseText);
}
var rate = document.getElementById('eee_label');
rate.label = rate_USD + " " + rate_EUR + " " + rate_RUB;
}
else
{
}
};
ajax.send();
我試圖把window.dump()
ajax.send()
之後,它的控制檯還甩請求完成後。
確切的,謝謝! – Pablo 2010-04-29 14:27:16