Skip to content

Commit 59f60d2

Browse files
author
Victor Homyakov
committed
Temporary fix for stacktracejs#27 (exception in ajax() while in window.onerror causes bad behavior of Firefox). However, the cause of ajax() exception is not clear.
1 parent d17d9ae commit 59f60d2

1 file changed

Lines changed: 10 additions & 6 deletions

File tree

‎stacktrace.js‎

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -207,16 +207,20 @@ printStackTrace.implementation.prototype = {
207207
sourceCache: {},
208208

209209
/**
210-
* @return the text from a given URL.
210+
* @return the text from a given URL
211211
*/
212212
ajax: function(url) {
213213
var req = this.createXMLHTTPObject();
214-
if (!req) {
215-
return;
214+
if (req) {
215+
try {
216+
// FIXME why Firefox 3.6-7.0 raises error for file:///
217+
req.open('GET', url, false);
218+
req.send('');
219+
return req.responseText;
220+
} catch (e) {
221+
}
216222
}
217-
req.open('GET', url, false);
218-
req.send('');
219-
return req.responseText;
223+
return '';
220224
},
221225

222226
/**

0 commit comments

Comments
 (0)