Bug 1264091 - Ensure we unblack the screen for a right after-paint event. r?dao
MozReview-Commit-ID: H2hCmQX8OLX
--- a/browser/base/content/tab-content.js
+++ b/browser/base/content/tab-content.js
@@ -610,30 +610,33 @@ var DOMFullscreenHandler = {
if (!content) {
return null;
}
return content.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils);
},
receiveMessage: function(aMessage) {
+ let windowUtils = this._windowUtils;
switch(aMessage.name) {
case "DOMFullscreen:Entered": {
- if (!this._windowUtils.handleFullscreenRequests() &&
+ this._lastTransactionId = windowUtils.lastTransactionId;
+ if (!windowUtils.handleFullscreenRequests() &&
!content.document.fullscreenElement) {
// 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": {
- if (this._windowUtils) {
- this._windowUtils.exitFullscreen();
+ if (windowUtils) {
+ this._lastTransactionId = windowUtils.lastTransactionId;
+ windowUtils.exitFullscreen();
}
this._fullscreenDoc = null;
break;
}
}
},
handleEvent: function(aEvent) {
@@ -660,18 +663,20 @@ var DOMFullscreenHandler = {
// If we receive any fullscreen change event, and find we are
// actually not in fullscreen, also ask the parent to exit to
// ensure that the parent always exits fullscreen when we do.
sendAsyncMessage("DOMFullscreen:Exit");
}
break;
}
case "MozAfterPaint": {
- removeEventListener("MozAfterPaint", this);
- sendAsyncMessage("DOMFullscreen:Painted");
+ if (aEvent.transactionId > this._lastTransactionId) {
+ removeEventListener("MozAfterPaint", this);
+ sendAsyncMessage("DOMFullscreen:Painted");
+ }
break;
}
}
}
};
DOMFullscreenHandler.init();
var RefreshBlocker = {