Detect global error handler stack corruption
This commit is contained in:
@@ -96,7 +96,17 @@ getJasmineRequireObj().GlobalErrors = function(j$) {
|
||||
handlers.push(listener);
|
||||
};
|
||||
|
||||
this.popListener = function popListener() {
|
||||
this.popListener = function popListener(listener) {
|
||||
if (!listener) {
|
||||
throw new Error('popListener expects a listener');
|
||||
}
|
||||
|
||||
if (listener !== handlers[handlers.length - 1]) {
|
||||
throw new Error(
|
||||
'popListener was passed a different listener than the current one'
|
||||
);
|
||||
}
|
||||
|
||||
handlers.pop();
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user