diff --git a/browser/components/feeds/src/WebContentConverter.js b/browser/components/feeds/src/WebContentConverter.js index 0591d6501ff..7c1cca72214 100644 --- a/browser/components/feeds/src/WebContentConverter.js +++ b/browser/components/feeds/src/WebContentConverter.js @@ -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, diff --git a/browser/locales/en-US/chrome/browser/feeds/subscribe.properties b/browser/locales/en-US/chrome/browser/feeds/subscribe.properties index 27cf505bb76..359a6650412 100644 --- a/browser/locales/en-US/chrome/browser/feeds/subscribe.properties +++ b/browser/locales/en-US/chrome/browser/feeds/subscribe.properties @@ -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.