From 9884d1f36d9a6570532549dff099f47c2eae896c Mon Sep 17 00:00:00 2001 From: Jared Wein Date: Wed, 26 Apr 2017 12:36:34 -0400 Subject: [PATCH] Bug 1359849 - Guard against exceptions thrown while cleaning up the video controls. r=gijs MozReview-Commit-ID: 2cwIE7Xdp7O --- toolkit/content/widgets/videocontrols.xml | 34 +++++++++++++++-------- 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/toolkit/content/widgets/videocontrols.xml b/toolkit/content/widgets/videocontrols.xml index f3e1aebb4002..fca59d3f394a 100644 --- a/toolkit/content/widgets/videocontrols.xml +++ b/toolkit/content/widgets/videocontrols.xml @@ -715,17 +715,21 @@ terminateEventListeners() { if (this.videoEvents) { for (let event of this.videoEvents) { - this.video.removeEventListener(event, this, { - capture: true, - mozSystemGroup: true - }); + try { + this.video.removeEventListener(event, this, { + capture: true, + mozSystemGroup: true + }); + } catch (ex) {} } } if (this.controlListeners) { for (let element of this.controlListeners) { - element.item.removeEventListener(element.event, element.func, - { mozSystemGroup: true, capture: element.capture }); + try { + element.item.removeEventListener(element.event, element.func, + { mozSystemGroup: true, capture: element.capture }); + } catch (ex) {} } delete this.controlListeners; @@ -2041,7 +2045,9 @@ handleEvent(aEvent) { if (aEvent.type == "transitionend") { this.firstShow = false; - this.videocontrols.removeEventListener("transitionend", this); + try { + this.videocontrols.removeEventListener("transitionend", this); + } catch (ex) {} return; } @@ -2052,7 +2058,9 @@ terminateEventListeners() { for (var event of this.videoEvents) { - this.Utils.video.removeEventListener(event, this); + try { + this.Utils.video.removeEventListener(event, this); + } catch (ex) {} } }, @@ -2197,12 +2205,16 @@ controlListeners: [], terminateEventListeners() { for (let event of this.videoEvents) { - this.video.removeEventListener(event, this, { mozSystemGroup: true }); + try { + this.video.removeEventListener(event, this, { mozSystemGroup: true }); + } catch (ex) {} } for (let element of this.controlListeners) { - element.item.removeEventListener(element.event, element.func, - { mozSystemGroup: true }); + try { + element.item.removeEventListener(element.event, element.func, + { mozSystemGroup: true }); + } catch (ex) {} } delete this.controlListeners;