mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 912347 - Prevent already registered protocol handler info bar. r=jaws
This commit is contained in:
parent
b2d6edce8e
commit
15a1a561b0
@ -369,6 +369,13 @@ WebContentConverterRegistrar.prototype = {
|
||||
function WCCR_registerProtocolHandler(aProtocol, aURIString, aTitle, aContentWindow) {
|
||||
LOG("registerProtocolHandler(" + aProtocol + "," + aURIString + "," + aTitle + ")");
|
||||
|
||||
var uri = this._checkAndGetURI(aURIString, aContentWindow);
|
||||
|
||||
// If the protocol handler is already registered, just return early.
|
||||
if (this._protocolHandlerRegistered(aProtocol, uri.spec)) {
|
||||
return;
|
||||
}
|
||||
|
||||
var browserWindow = this._getBrowserWindowForContentWindow(aContentWindow);
|
||||
if (PrivateBrowsingUtils.isWindowPrivate(browserWindow)) {
|
||||
// Inside the private browsing mode, we don't want to alert the user to save
|
||||
@ -406,25 +413,18 @@ WebContentConverterRegistrar.prototype = {
|
||||
throw("Not allowed to register a protocol handler for " + aProtocol);
|
||||
}
|
||||
|
||||
var uri = this._checkAndGetURI(aURIString, aContentWindow);
|
||||
// Now Ask the user and provide the proper callback
|
||||
var message = this._getFormattedString("addProtocolHandler",
|
||||
[aTitle, uri.host, aProtocol]);
|
||||
|
||||
var buttons, message;
|
||||
if (this._protocolHandlerRegistered(aProtocol, uri.spec))
|
||||
message = this._getFormattedString("protocolHandlerRegistered",
|
||||
[aTitle, aProtocol]);
|
||||
else {
|
||||
// Now Ask the user and provide the proper callback
|
||||
message = this._getFormattedString("addProtocolHandler",
|
||||
[aTitle, uri.host, aProtocol]);
|
||||
var notificationIcon = uri.prePath + "/favicon.ico";
|
||||
var notificationValue = "Protocol Registration: " + aProtocol;
|
||||
var addButton = {
|
||||
label: this._getString("addProtocolHandlerAddButton"),
|
||||
accessKey: this._getString("addHandlerAddButtonAccesskey"),
|
||||
protocolInfo: { protocol: aProtocol, uri: uri.spec, name: aTitle },
|
||||
|
||||
var notificationIcon = uri.prePath + "/favicon.ico";
|
||||
var notificationValue = "Protocol Registration: " + aProtocol;
|
||||
var addButton = {
|
||||
label: this._getString("addProtocolHandlerAddButton"),
|
||||
accessKey: this._getString("addHandlerAddButtonAccesskey"),
|
||||
protocolInfo: { protocol: aProtocol, uri: uri.spec, name: aTitle },
|
||||
|
||||
callback:
|
||||
callback:
|
||||
function WCCR_addProtocolHandlerButtonCallback(aNotification, aButtonInfo) {
|
||||
var protocol = aButtonInfo.protocolInfo.protocol;
|
||||
var uri = aButtonInfo.protocolInfo.uri;
|
||||
@ -450,11 +450,8 @@ WebContentConverterRegistrar.prototype = {
|
||||
getService(Ci.nsIHandlerService);
|
||||
hs.store(handlerInfo);
|
||||
}
|
||||
};
|
||||
buttons = [addButton];
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
var buttons;
|
||||
var browserElement = this._getBrowserForContentWindow(browserWindow, aContentWindow);
|
||||
var notificationBox = browserWindow.getBrowser().getNotificationBox(browserElement);
|
||||
notificationBox.appendNotification(message,
|
||||
|
@ -49,5 +49,3 @@ feedSubscriptionVideoPodcast2=You can subscribe to this video podcast to receive
|
||||
# "Add %appName (%appDomain) as an application for %protocolType links?"
|
||||
addProtocolHandler=Add %S (%S) as an application for %S links?
|
||||
addProtocolHandlerAddButton=Add Application
|
||||
# "%appName has already been added as an application for %protocolType links."
|
||||
protocolHandlerRegistered=%S has already been added as an application for %S links.
|
||||
|
Loading…
Reference in New Issue
Block a user