mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 825804 - Popup notifications and notification bars shouldn't persist across page reloads. r=gavin
This commit is contained in:
parent
35136d8877
commit
dcff7dfbbd
@ -4196,7 +4196,6 @@ var XULBrowserWindow = {
|
||||
},
|
||||
|
||||
onLocationChange: function (aWebProgress, aRequest, aLocationURI, aFlags) {
|
||||
const nsIWebProgressListener = Ci.nsIWebProgressListener;
|
||||
var location = aLocationURI ? aLocationURI.spec : "";
|
||||
this._hostChanged = true;
|
||||
|
||||
@ -4225,38 +4224,6 @@ var XULBrowserWindow = {
|
||||
}
|
||||
}
|
||||
|
||||
// This code here does not compare uris exactly when determining
|
||||
// whether or not the message should be hidden since the message
|
||||
// may be prematurely hidden when an install is invoked by a click
|
||||
// on a link that looks like this:
|
||||
//
|
||||
// <a href="#" onclick="return install();">Install Foo</a>
|
||||
//
|
||||
// - which fires a onLocationChange message to uri + '#'...
|
||||
var selectedBrowser = gBrowser.selectedBrowser;
|
||||
if (selectedBrowser.lastURI) {
|
||||
let oldSpec = selectedBrowser.lastURI.spec;
|
||||
let oldIndexOfHash = oldSpec.indexOf("#");
|
||||
if (oldIndexOfHash != -1)
|
||||
oldSpec = oldSpec.substr(0, oldIndexOfHash);
|
||||
let newSpec = location;
|
||||
let newIndexOfHash = newSpec.indexOf("#");
|
||||
if (newIndexOfHash != -1)
|
||||
newSpec = newSpec.substr(0, newIndexOfHash);
|
||||
if (newSpec != oldSpec) {
|
||||
// Remove all the notifications, except for those which want to
|
||||
// persist across the first location change.
|
||||
let nBox = gBrowser.getNotificationBox(selectedBrowser);
|
||||
nBox.removeTransientNotifications();
|
||||
|
||||
// Only need to call locationChange if the PopupNotifications object
|
||||
// for this window has already been initialized (i.e. its getter no
|
||||
// longer exists)
|
||||
if (!__lookupGetter__("PopupNotifications"))
|
||||
PopupNotifications.locationChange();
|
||||
}
|
||||
}
|
||||
|
||||
// Disable menu entries for images, enable otherwise
|
||||
if (content.document && mimeTypeIsTextBased(content.document.contentType))
|
||||
this.isImage.removeAttribute('disabled');
|
||||
@ -4290,6 +4257,18 @@ var XULBrowserWindow = {
|
||||
SocialShareButton.updateShareState();
|
||||
}
|
||||
|
||||
// Filter out anchor navigation, history.push/pop/replaceState and
|
||||
// tab switches.
|
||||
if (aRequest) {
|
||||
// Only need to call locationChange if the PopupNotifications object
|
||||
// for this window has already been initialized (i.e. its getter no
|
||||
// longer exists)
|
||||
// XXX bug 839445: We never tell PopupNotifications about location
|
||||
// changes in background tabs.
|
||||
if (!__lookupGetter__("PopupNotifications"))
|
||||
PopupNotifications.locationChange();
|
||||
}
|
||||
|
||||
// Show or hide browser chrome based on the whitelist
|
||||
if (this.hideChromeForLocation(location)) {
|
||||
document.documentElement.setAttribute("disablechrome", "true");
|
||||
@ -4332,7 +4311,7 @@ var XULBrowserWindow = {
|
||||
(aLocationURI.schemeIs("about") || aLocationURI.schemeIs("chrome"))) {
|
||||
// Don't need to re-enable/disable find commands for same-document location changes
|
||||
// (e.g. the replaceStates in about:addons)
|
||||
if (!(aFlags & nsIWebProgressListener.LOCATION_CHANGE_SAME_DOCUMENT)) {
|
||||
if (!(aFlags & Ci.nsIWebProgressListener.LOCATION_CHANGE_SAME_DOCUMENT)) {
|
||||
if (content.document.readyState == "interactive" || content.document.readyState == "complete")
|
||||
disableFindCommands(shouldDisableFind(content.document));
|
||||
else {
|
||||
@ -4708,12 +4687,17 @@ var TabsProgressListener = {
|
||||
if (aBrowser.contentWindow == aWebProgress.DOMWindow) {
|
||||
// Filter out any onLocationChanges triggered by anchor navigation
|
||||
// or history.push/pop/replaceState.
|
||||
if (aRequest) {
|
||||
if (!(aFlags & Ci.nsIWebProgressListener.LOCATION_CHANGE_SAME_DOCUMENT)) {
|
||||
// Initialize the click-to-play state.
|
||||
aBrowser._clickToPlayPluginsActivated = new Map();
|
||||
aBrowser._clickToPlayAllPluginsActivated = false;
|
||||
aBrowser._pluginScriptedState = gPluginHandler.PLUGIN_SCRIPTED_STATE_NONE;
|
||||
|
||||
// Remove all the notifications, except for those which want to
|
||||
// persist across the first location change.
|
||||
gBrowser.getNotificationBox(aBrowser).removeTransientNotifications();
|
||||
}
|
||||
|
||||
FullZoom.onLocationChange(aLocationURI, false, aBrowser);
|
||||
}
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user