Bug 704011 - Make mozfullscreenchange handler assume target is document. r=dao

This commit is contained in:
Chris Pearce
2011-11-22 10:23:44 +13:00
parent 6007f23548
commit 62758fc7b5

View File

@@ -3931,14 +3931,13 @@ var FullScreen = {
// full-screen. Only add listeners and show warning etc when the event we // full-screen. Only add listeners and show warning etc when the event we
// receive is targeted at the chrome document, i.e. only once every time // receive is targeted at the chrome document, i.e. only once every time
// we enter DOM full-screen mode. // we enter DOM full-screen mode.
let targetDoc = event.target.ownerDocument ? event.target.ownerDocument : event.target; if (event.target != document) {
if (targetDoc != document) {
// However, if we receive a "mozfullscreenchange" event for a document // However, if we receive a "mozfullscreenchange" event for a document
// which is not a subdocument of the currently selected tab, we know that // which is not a subdocument of the currently selected tab, we know that
// we've switched tabs since the request to enter full-screen was made, // we've switched tabs since the request to enter full-screen was made,
// so we should exit full-screen since the "full-screen document" isn't // so we should exit full-screen since the "full-screen document" isn't
// acutally visible. // acutally visible.
if (targetDoc.defaultView.top != gBrowser.contentWindow) { if (event.target.defaultView.top != gBrowser.contentWindow) {
document.mozCancelFullScreen(); document.mozCancelFullScreen();
} }
return; return;