Prevent erroneous hiding of hideonpagechange guidance panels on complex pages

This commit is contained in:
Dan Stillman 2015-07-04 17:09:26 -04:00
parent a080e4090d
commit 01716183d7

View file

@ -119,7 +119,15 @@
self.removeEventListener("popupshown", popupShownListener);
let appcontent = document.getElementById('appcontent');
let pageHideListener = function () {
let pageHideListener = function (event) {
var doc = event.originalTarget;
if(!(doc instanceof HTMLDocument)) return;
var rootDoc = doc.defaultView.top.document;
// Don't hide when frames and special URLs are unloaded
if (rootDoc != doc || !rootDoc.location.href.startsWith('http')) {
return;
}
appcontent.removeEventListener("pagehide", pageHideListener);
self.hide();
};