Bug 846186 - Tilt error flooding error console (TypeError: mouseLerp is undefined), r=rcampbell
authorVictor Porof <vporof@mozilla.com>
Fri, 01 Mar 2013 11:49:19 +0200
changeset 123615 9161ede810cb0149e49ec450ae68a4a1f1e5a885
parent 123614 8ecc6063cbd7f19c804cde58585752c625c98d0c
child 123616 78a7a63eec08306602db1af5a10e672f67b70064
push id24389
push userryanvm@gmail.com
push dateSun, 03 Mar 2013 18:25:34 +0000
treeherdermozilla-central@86c98c4d36da [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersrcampbell
bugs846186
milestone22.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 846186 - Tilt error flooding error console (TypeError: mouseLerp is undefined), r=rcampbell
browser/devtools/tilt/TiltVisualizer.jsm
--- a/browser/devtools/tilt/TiltVisualizer.jsm
+++ b/browser/devtools/tilt/TiltVisualizer.jsm
@@ -1122,17 +1122,21 @@ TiltVisualizer.Presenter.prototype = {
     if (this._meshWireframe) {
       this._meshWireframe.forEach(function(group) {
         TiltUtils.destroyObject(group.indices);
       });
     }
 
     TiltUtils.destroyObject(this._renderer);
 
-    this.contentWindow.removeEventListener("resize", this._onResize, false);
+    // Closing the tab would result in contentWindow being a dead object,
+    // so operations like removing event listeners won't work anymore.
+    if (this.contentWindow == this.chromeWindow.content) {
+      this.contentWindow.removeEventListener("resize", this._onResize, false);
+    }
   }
 };
 
 /**
  * A mouse and keyboard controller implementation.
  *
  * @param {HTMLCanvasElement} aCanvas
  *                            the visualization canvas element
@@ -1227,17 +1231,21 @@ TiltVisualizer.Controller.prototype = {
     canvas.removeEventListener("mouseover", this._onMouseOver, false);
     canvas.removeEventListener("mouseout", this._onMouseOut, false);
     canvas.removeEventListener("MozMousePixelScroll", this._onMozScroll, false);
     canvas.removeEventListener("keydown", this._onKeyDown, false);
     canvas.removeEventListener("keyup", this._onKeyUp, false);
     canvas.removeEventListener("keypress", this._onKeyPress, true);
     canvas.removeEventListener("blur", this._onBlur, false);
 
-    presenter.contentWindow.removeEventListener("resize", this._onResize, false);
+    // Closing the tab would result in contentWindow being a dead object,
+    // so operations like removing event listeners won't work anymore.
+    if (presenter.contentWindow == presenter.chromeWindow.content) {
+      presenter.contentWindow.removeEventListener("resize", this._onResize, false);
+    }
   },
 
   /**
    * Function called each frame, updating the visualization camera transforms.
    *
    * @param {Number} aTime
    *                 total time passed since rendering started
    * @param {Number} aDelta