Bug 1173886 - Fix DOM fullscreen broken in e10s for tabs other than the first. r=dao

It changes the condition to check whether the MozDOMFullscreen:Entered
is originally targeted the <browser>.

--HG--
extra : source : 54e4c6612c01f7a035e729a2660810e6587f832f
This commit is contained in:
Xidorn Quan 2015-06-12 21:27:02 +12:00
Родитель d997f27268
Коммит 1840048bb9
1 изменённых файлов: 16 добавлений и 20 удалений

Просмотреть файл

@ -112,25 +112,27 @@ var FullScreen = {
this.cancelWarning();
break;
case "MozDOMFullscreen:Entered": {
// The original target is the element which requested the DOM
// The event target is the element which requested the DOM
// fullscreen. If we were entering DOM fullscreen for a remote
// browser, this element would be that browser element, which
// was the parameter of `remoteFrameFullscreenChanged` call.
// If the fullscreen request was initiated from an in-process
// browser, we need to get its corresponding browser element.
let originalTarget = event.originalTarget;
// browser, the target would be `gBrowser` and the original
// target would be the browser which was the parameter of
// `remoteFrameFullscreenChanged` call. If the fullscreen
// request was initiated from an in-process browser, we need
// to get its corresponding browser here.
let browser;
if (this._isBrowser(originalTarget)) {
browser = originalTarget;
if (event.target == gBrowser) {
browser = event.originalTarget;
} else {
let topWin = originalTarget.ownerDocument.defaultView.top;
let topWin = event.target.ownerDocument.defaultView.top;
browser = gBrowser.getBrowserForContentWindow(topWin);
if (!browser) {
document.mozCancelFullScreen();
break;
}
}
this.enterDomFullscreen(browser);
if (!this.enterDomFullscreen(browser)) {
break;
}
// If it is a remote browser, send a message to ask the content
// to enter fullscreen state. We don't need to do so if it is an
// in-process browser, since all related document should have
@ -166,7 +168,7 @@ var FullScreen = {
enterDomFullscreen : function(aBrowser) {
if (!document.mozFullScreen)
return;
return false;
// If we've received a fullscreen notification, we have to ensure that the
// element that's requesting fullscreen belongs to the browser that's currently
@ -174,7 +176,7 @@ var FullScreen = {
// actually visible now.
if (gBrowser.selectedBrowser != aBrowser) {
document.mozCancelFullScreen();
return;
return false;
}
let focusManager = Services.focus;
@ -182,7 +184,7 @@ var FullScreen = {
// The top-level window has lost focus since the request to enter
// full-screen was made. Cancel full-screen.
document.mozCancelFullScreen();
return;
return false;
}
document.documentElement.setAttribute("inDOMFullscreen", true);
@ -204,6 +206,7 @@ var FullScreen = {
// the toolbar hide immediately.
this.hideNavToolbox(true);
this._fullScrToggler.hidden = true;
return true;
},
cleanup: function () {
@ -235,13 +238,6 @@ var FullScreen = {
.broadcastAsyncMessage("DOMFullscreen:CleanUp");
},
_isBrowser: function (aNode) {
if (aNode.tagName != "xul:browser") {
return false;
}
let systemPrincipal = Services.scriptSecurityManager.getSystemPrincipal();
return aNode.nodePrincipal == systemPrincipal;
},
_isRemoteBrowser: function (aBrowser) {
return gMultiProcessBrowser && aBrowser.getAttribute("remote") == "true";
},