From ef67a02b150e4fb8b885d7c539d27d3690d2bd14 Mon Sep 17 00:00:00 2001 From: Dan Mosedale Date: Thu, 16 Apr 2015 11:54:49 -0700 Subject: [PATCH] Bug 1154868-Log exceptions in bufferedUpdateVideo callbacks,r=mikedeboer --- .../loop/content/shared/js/mixins.js | 65 +++++++++++-------- 1 file changed, 37 insertions(+), 28 deletions(-) diff --git a/browser/components/loop/content/shared/js/mixins.js b/browser/components/loop/content/shared/js/mixins.js index 295a455d11d6..309cfedbb65f 100644 --- a/browser/components/loop/content/shared/js/mixins.js +++ b/browser/components/loop/content/shared/js/mixins.js @@ -436,35 +436,44 @@ loop.shared.mixins = (function() { } this._bufferedUpdateVideo = rootObject.setTimeout(function() { - this._bufferedUpdateVideo = null; - var localStreamParent = this._getElement(".local .OT_publisher"); - var remoteStreamParent = this._getElement(".remote .OT_subscriber"); - var screenShareStreamParent = this._getElement('.screen .OT_subscriber'); - if (localStreamParent) { - localStreamParent.style.width = "100%"; - } - if (remoteStreamParent) { - remoteStreamParent.style.height = "100%"; - } - if (screenShareStreamParent) { - screenShareStreamParent.style.height = "100%"; - } + // Since this is being called from setTimeout, any exceptions thrown + // will propagate upwards into nothingness, unless we go out of our + // way to catch and log them explicitly, so... + try { + this._bufferedUpdateVideo = null; + var localStreamParent = this._getElement(".local .OT_publisher"); + var remoteStreamParent = this._getElement(".remote .OT_subscriber"); + var screenShareStreamParent = this._getElement('.screen .OT_subscriber'); + if (localStreamParent) { + localStreamParent.style.width = "100%"; + } + if (remoteStreamParent) { + remoteStreamParent.style.height = "100%"; + } + if (screenShareStreamParent) { + screenShareStreamParent.style.height = "100%"; + } - // Update the position and dimensions of the containers of local and remote - // video streams, if necessary. The consumer of this mixin should implement - // the actual updating mechanism. - Object.keys(this._videoDimensionsCache.local).forEach(function(videoType) { - var ratio = this._videoDimensionsCache.local[videoType].aspectRatio; - if (videoType == "camera" && this.updateLocalCameraPosition) { - this.updateLocalCameraPosition(ratio); - } - }, this); - Object.keys(this._videoDimensionsCache.remote).forEach(function(videoType) { - var ratio = this._videoDimensionsCache.remote[videoType].aspectRatio; - if (videoType == "camera" && this.updateRemoteCameraPosition) { - this.updateRemoteCameraPosition(ratio); - } - }, this); + // Update the position and dimensions of the containers of local and + // remote video streams, if necessary. The consumer of this mixin + // should implement the actual updating mechanism. + Object.keys(this._videoDimensionsCache.local).forEach( + function (videoType) { + var ratio = this._videoDimensionsCache.local[videoType].aspectRatio; + if (videoType == "camera" && this.updateLocalCameraPosition) { + this.updateLocalCameraPosition(ratio); + } + }, this); + Object.keys(this._videoDimensionsCache.remote).forEach( + function (videoType) { + var ratio = this._videoDimensionsCache.remote[videoType].aspectRatio; + if (videoType == "camera" && this.updateRemoteCameraPosition) { + this.updateRemoteCameraPosition(ratio); + } + }, this); + } catch (ex) { + console.error("updateVideoContainer: _bufferedVideoUpdate exception:", ex); + } }.bind(this), 0); },