Bug 977448 - add build support for a 'MOZ_MOZILLA_API_KEY'. r=khuey
☠☠ backed out by 01431ff08948 ☠ ☠
authorDoug Turner <doug.turner@gmail.com>
Tue, 25 Feb 2014 16:06:51 -0800
changeset 171706 0d71b60afe52ec807c59be1ee2a7763f84e3ccc8
parent 171705 4c4041cfc09528a9b96439893932e50eb42aaa1b
child 171707 a98258891a7e606c86b16359b323c388ec7fe98c
push id270
push userpvanderbeken@mozilla.com
push dateThu, 06 Mar 2014 09:24:21 +0000
reviewerskhuey
bugs977448
milestone30.0a1
Bug 977448 - add build support for a 'MOZ_MOZILLA_API_KEY'. r=khuey
configure.in
toolkit/components/urlformatter/Makefile.in
toolkit/components/urlformatter/nsURLFormatter.js
--- a/configure.in
+++ b/configure.in
@@ -4045,16 +4045,26 @@ MOZ_ARG_ENABLE_STRING([update-channel],
     MOZ_UPDATE_CHANNEL=`echo $enableval | tr A-Z a-z`)
 
 if test -z "$MOZ_UPDATE_CHANNEL"; then
     MOZ_UPDATE_CHANNEL=default
 fi
 AC_DEFINE_UNQUOTED(MOZ_UPDATE_CHANNEL, $MOZ_UPDATE_CHANNEL)
 AC_SUBST(MOZ_UPDATE_CHANNEL)
 
+# Allow to specify a Mozilla API key file that contains the secret key to be
+# used for various Mozilla API requests.
+MOZ_ARG_WITH_STRING(mozilla-api-keyfile,
+[  --with-mozilla-api-keyfile=file   Use the secret key contained in the given keyfile for Mozilla API requests],
+  MOZ_MOZILLA_API_KEY=`cat $withval`)
+if test -z "$MOZ_MOZILLA_API_KEY"; then
+    MOZ_MOZILLA_API_KEY=no-mozilla-api-key
+fi
+AC_SUBST(MOZ_MOZILLA_API_KEY)
+
 # Allow to specify a Google API key file that contains the secret key to be
 # used for various Google API requests.
 MOZ_ARG_WITH_STRING(google-api-keyfile,
 [  --with-google-api-keyfile=file   Use the secret key contained in the given keyfile for Google API requests],
   MOZ_GOOGLE_API_KEY=`cat $withval`)
 if test -z "$MOZ_GOOGLE_API_KEY"; then
     MOZ_GOOGLE_API_KEY=no-google-api-key
 fi
--- a/toolkit/components/urlformatter/Makefile.in
+++ b/toolkit/components/urlformatter/Makefile.in
@@ -1,15 +1,18 @@
 #
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
-export:: google_api_key
+export:: mozilla_api_key google_api_key
 
-EXTRA_PP_COMPONENTS_FLAGS = -I google_api_key
+EXTRA_PP_COMPONENTS_FLAGS = -I mozilla_api_key -I google_api_key
 
 include $(topsrcdir)/config/rules.mk
 
+mozilla_api_key:
+	@echo '#define MOZ_MOZILLA_API_KEY $(MOZ_MOZILLA_API_KEY)' > $@
+
 google_api_key:
 	@echo '#define MOZ_GOOGLE_API_KEY $(MOZ_GOOGLE_API_KEY)' > $@
 
-GARBAGE += google_api_key
+GARBAGE += google_api_key moz_google_api_key
--- a/toolkit/components/urlformatter/nsURLFormatter.js
+++ b/toolkit/components/urlformatter/nsURLFormatter.js
@@ -98,16 +98,17 @@ nsURLFormatterService.prototype = {
     PLATFORMVERSION:  function() this.appInfo.platformVersion,
     PLATFORMBUILDID:  function() this.appInfo.platformBuildID,
     APP:              function() this.appInfo.name.toLowerCase().replace(/ /, ""),
     OS:               function() this.appInfo.OS,
     XPCOMABI:         function() this.ABI,
     BUILD_TARGET:     function() this.appInfo.OS + "_" + this.ABI,
     OS_VERSION:       function() this.OSVersion,
     CHANNEL:          function() UpdateChannel.get(),
+    MOZILLA_API_KEY:   function() "@MOZ_MOZILLA_API_KEY@",
     GOOGLE_API_KEY:   function() "@MOZ_GOOGLE_API_KEY@",
     DISTRIBUTION:     function() this.distribution.id,
     DISTRIBUTION_VERSION: function() this.distribution.version
   },
 
   formatURL: function uf_formatURL(aFormat) {
     var _this = this;
     var replacementCallback = function(aMatch, aKey) {