Skip to content

Commit 84edddc

Browse files
MaxBittkerkamilogorek
authored andcommitted
fix: window defensiveness with promise handler (#1244)
1 parent 772cf3c commit 84edddc

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/raven.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -431,7 +431,7 @@ Raven.prototype = {
431431
*/
432432
_attachPromiseRejectionHandler: function() {
433433
this._promiseRejectionHandler = this._promiseRejectionHandler.bind(this);
434-
_window.addEventListener('unhandledrejection', this._promiseRejectionHandler);
434+
_window.addEventListener && _window.addEventListener('unhandledrejection', this._promiseRejectionHandler);
435435
return this;
436436
},
437437

@@ -441,7 +441,7 @@ Raven.prototype = {
441441
* @return {raven}
442442
*/
443443
_detachPromiseRejectionHandler: function() {
444-
_window.removeEventListener('unhandledrejection', this._promiseRejectionHandler);
444+
_window.removeEventListener && _window.removeEventListener('unhandledrejection', this._promiseRejectionHandler);
445445
return this;
446446
},
447447

0 commit comments

Comments
 (0)