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 efb9f8f776
commit acf2046cee

View File

@ -3931,14 +3931,13 @@ var FullScreen = {
// 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
// we enter DOM full-screen mode.
let targetDoc = event.target.ownerDocument ? event.target.ownerDocument : event.target;
if (targetDoc != document) {
if (event.target != document) {
// However, if we receive a "mozfullscreenchange" event for a document
// 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,
// so we should exit full-screen since the "full-screen document" isn't
// acutally visible.
if (targetDoc.defaultView.top != gBrowser.contentWindow) {
if (event.target.defaultView.top != gBrowser.contentWindow) {
document.mozCancelFullScreen();
}
return;