Bug 1238844 - Do not call window utils if content has been null. r?dao draft
authorXidorn Quan <quanxunzhen@gmail.com>
Tue, 12 Jan 2016 16:18:11 +1100
changeset 320709 5e1bc7316826fc4d8b2744115dddfd4e67275c2f
parent 320606 18daf388a4ab00cba9a8152ab2cab2a4c5333bf2
child 512812 fbac1aa6cb40e6903ce00e4ab4a18d2c6d378f7b
push id9281
push userxquan@mozilla.com
push dateTue, 12 Jan 2016 09:46:16 +0000
reviewersdao
bugs1238844
milestone46.0a1
Bug 1238844 - Do not call window utils if content has been null. r?dao
browser/base/content/tab-content.js
--- a/browser/base/content/tab-content.js
+++ b/browser/base/content/tab-content.js
@@ -611,16 +611,19 @@ var DOMFullscreenHandler = {
     addEventListener("MozDOMFullscreen:Request", this);
     addEventListener("MozDOMFullscreen:Entered", this);
     addEventListener("MozDOMFullscreen:NewOrigin", this);
     addEventListener("MozDOMFullscreen:Exit", this);
     addEventListener("MozDOMFullscreen:Exited", this);
   },
 
   get _windowUtils() {
+    if (!content) {
+      return null;
+    }
     return content.QueryInterface(Ci.nsIInterfaceRequestor)
                   .getInterface(Ci.nsIDOMWindowUtils);
   },
 
   receiveMessage: function(aMessage) {
     switch(aMessage.name) {
       case "DOMFullscreen:Entered": {
         if (!this._windowUtils.handleFullscreenRequests() &&
@@ -628,17 +631,19 @@ var DOMFullscreenHandler = {
           // If we don't actually have any pending fullscreen request
           // to handle, neither we have been in fullscreen, tell the
           // parent to just exit.
           sendAsyncMessage("DOMFullscreen:Exit");
         }
         break;
       }
       case "DOMFullscreen:CleanUp": {
-        this._windowUtils.exitFullscreen();
+        if (this._windowUtils) {
+          this._windowUtils.exitFullscreen();
+        }
         this._fullscreenDoc = null;
         break;
       }
     }
   },
 
   handleEvent: function(aEvent) {
     switch (aEvent.type) {