several IE11 fixes avoiding or working around javascript errors

This commit is contained in:
Ralf Becker 2014-02-19 15:10:39 +00:00
parent 2f8b7064d8
commit b692346cce
3 changed files with 25 additions and 8 deletions

View File

@ -100,6 +100,8 @@ var AppJS = Class.extend(
*/
destroy: function() {
delete this.et2;
if (this.sidebox)
this.sidebox.off();
delete this.sidebox;
delete window.app[this.appname];
},

View File

@ -118,7 +118,7 @@
* @param _moduleInstances is the the object which contains the application
* and window specific module instances.
* @param _instances refers to all api instances.
* @param _wnd is the window for which the module instances should get
* @param _window is the window for which the module instances should get
* created.
*/
function getWndModules(_egw, _modules, _moduleInstances, _instances, _window)
@ -139,8 +139,9 @@
// called, we have to delete the module slot created above
var fnct = function() {
cleanupEgwInstances(_instances, _moduleInstances, function(_w) {
return _w.window === _window});
};
return _w.window === _window;
});
};
if (_window.attachEvent)
{
_window.attachEvent('onbeforeunload', fnct);
@ -403,7 +404,7 @@
'app': {},
'wnd': [],
'glo': {}
}
};
/**
* instances contains references to all created instances.
@ -416,7 +417,13 @@
*/
window.setInterval(function() {
cleanupEgwInstances(instances, moduleInstances, function(w) {
return w.window && w.window.closed
try {
return w.window && w.window.closed;
}
catch(e) {
// IE(11) seems to throw a permission denied error, when accessing closed property
return true;
}
});
}, 10000);

View File

@ -283,8 +283,16 @@ egw.extend('debug', egw.MODULE_GLOBAL, function(_app, _wnd) {
// bind to global error handler
jQuery(_wnd).on('error', function(e)
{
// originalEvent does NOT exist in IE
// originalEvent does NOT always exist in IE
var event = typeof e.originalEvent == 'object' ? e.originalEvent : e;
// IE(11) gives a syntaxerror on each pageload pointing to first line of html page (doctype).
// As I cant figure out what's wrong there, we are ignoring it for now.
if (navigator.userAgent.match(/Trident/i) && typeof event.name == 'undefined' &&
Object.prototype.toString.call(event) == '[object ErrorEvent]' &&
event.lineno == 1 && event.filename.indexOf('/index.php') != -1)
{
return false;
}
log_on_client('error', [event.message], typeof event.stack != 'undefined' ? event.stack : null);
raise_error();
// rethrow error to let browser log and show it in usual way too