author | Ed Morley <emorley@mozilla.com> |
Thu, 12 Sep 2013 12:04:22 +0100 | |
changeset 146769 | b83f6d80af5fe8fef0a7718eae9741153d4dbfe0 |
parent 146768 | 749739c77f735172976c1daf9a077af3db60dc01 (current diff) |
parent 146699 | a4e9c9c9dbf94494b508ca9108f30f1941a70d4a (diff) |
child 146775 | a9d76ddf0ee2caeee5ccfb7fa4e2f40a11cb6d94 |
push id | 25270 |
push user | emorley@mozilla.com |
push date | Thu, 12 Sep 2013 11:04:52 +0000 |
treeherder | mozilla-central@b83f6d80af5f [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
milestone | 26.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/browser/components/feeds/src/WebContentConverter.js +++ b/browser/components/feeds/src/WebContentConverter.js @@ -364,16 +364,23 @@ WebContentConverterRegistrar.prototype = /** * See nsIWebContentHandlerRegistrar */ registerProtocolHandler: 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 // a protocol handler. We log it to the error console so that web developers // would have some way to tell what's going wrong. Cc["@mozilla.org/consoleservice;1"]. getService(Ci.nsIConsoleService). logStringMessage("Web page denied access to register a protocol handler inside private browsing mode"); @@ -401,35 +408,28 @@ WebContentConverterRegistrar.prototype = catch (e) { allowed = pb.getBoolPref(PREF_HANDLER_EXTERNAL_PREFIX + "-default"); } if (!allowed) { // XXX this should be a "security exception" according to spec 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; var name = aButtonInfo.protocolInfo.name; var handler = Cc["@mozilla.org/uriloader/web-handler-app;1"]. createInstance(Ci.nsIWebHandlerApp); handler.name = name; @@ -445,21 +445,18 @@ WebContentConverterRegistrar.prototype = // to want to use it. Reset the handlerInfo to ask before the next // use. handlerInfo.alwaysAskBeforeHandling = true; var hs = Cc["@mozilla.org/uriloader/handler-service;1"]. 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, notificationValue, notificationIcon, notificationBox.PRIORITY_INFO_LOW, buttons); },
--- a/browser/locales/en-US/chrome/browser/feeds/subscribe.properties +++ b/browser/locales/en-US/chrome/browser/feeds/subscribe.properties @@ -44,10 +44,8 @@ feedSubscriptionVideoPodcast1=This is a feedSubscriptionFeed2=You can subscribe to this feed to receive updates when this content changes. feedSubscriptionAudioPodcast2=You can subscribe to this podcast to receive updates when this content changes. feedSubscriptionVideoPodcast2=You can subscribe to this video podcast to receive updates when this content changes. # Protocol Handling # "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.