mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-21 07:56:16 -04:00
Global exception handler is not registered until the page's controller adds it.
It is bad form to register this handler on definition. This would cause problems if, for instance, this module was required by our Node code.
This commit is contained in:
parent
c12e1aff07
commit
6a4c025e08
2 changed files with 19 additions and 9 deletions
|
@ -401,6 +401,8 @@ var pad = {
|
||||||
|
|
||||||
init: function()
|
init: function()
|
||||||
{
|
{
|
||||||
|
padutils.setupGlobalExceptionHandler();
|
||||||
|
|
||||||
$(document).ready(function()
|
$(document).ready(function()
|
||||||
{
|
{
|
||||||
//start the costum js
|
//start the costum js
|
||||||
|
|
|
@ -459,17 +459,25 @@ var padutils = {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
//send javascript errors to the server
|
var globalExceptionHandler = undefined;
|
||||||
window.onerror = function test (msg, url, linenumber)
|
function setupGlobalExceptionHandler() {
|
||||||
{
|
//send javascript errors to the server
|
||||||
var errObj = {errorInfo: JSON.stringify({msg: msg, url: url, linenumber: linenumber, userAgent: navigator.userAgent})};
|
if (!globalExceptionHandler) {
|
||||||
var loc = document.location;
|
globalExceptionHandler = function test (msg, url, linenumber)
|
||||||
var url = loc.protocol + "//" + loc.hostname + ":" + loc.port + "/" + loc.pathname.substr(1, loc.pathname.indexOf("/p/")) + "jserror";
|
{
|
||||||
|
var errObj = {errorInfo: JSON.stringify({msg: msg, url: url, linenumber: linenumber, userAgent: navigator.userAgent})};
|
||||||
|
var loc = document.location;
|
||||||
|
var url = loc.protocol + "//" + loc.hostname + ":" + loc.port + "/" + loc.pathname.substr(1, loc.pathname.indexOf("/p/")) + "jserror";
|
||||||
|
|
||||||
$.post(url, errObj);
|
$.post(url, errObj);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
|
window.onerror = globalExceptionHandler;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
padutils.setupGlobalExceptionHandler = setupGlobalExceptionHandler;
|
||||||
|
|
||||||
padutils.binarySearch = require('/ace2_common').binarySearch;
|
padutils.binarySearch = require('/ace2_common').binarySearch;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue