Bug 632497 - Use a content-type hint for asyncFetch in AutoCompleteCache [r=mfinkle]
authorMatt Brubeck <mbrubeck@mozilla.com>
Tue, 08 Feb 2011 12:02:42 -0800
changeset 67354 24f4ba6d3672c9e6be7c8b79f79380cb29efba8b
parent 67353 93c03fa2431629b490726be98c910c663aeb4c01
child 67355 e1f202598b618cd5a219df617d69374904798427
push id1
push userroot
push dateTue, 26 Apr 2011 22:38:44 +0000
treeherdermozilla-beta@bfdb6e623a36 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmfinkle
bugs632497
Bug 632497 - Use a content-type hint for asyncFetch in AutoCompleteCache [r=mfinkle]
mobile/components/AutoCompleteCache.js
--- a/mobile/components/AutoCompleteCache.js
+++ b/mobile/components/AutoCompleteCache.js
@@ -196,17 +196,19 @@ var AutoCompleteUtils = {
   },
 
   loadCache: function loadCache() {
     if (!this.cacheFile.exists())
       return;
 
     try {
       let self = this;
-      NetUtil.asyncFetch(this.cacheFile, function(aInputStream, aResultCode) {
+      let channel = NetUtil.newChannel(this.cacheFile);
+      channel.setContentType("application/json");
+      NetUtil.asyncFetch(channel, function(aInputStream, aResultCode) {
         if (Components.isSuccessCode(aResultCode)) {
           let cache = Cc["@mozilla.org/dom/json;1"].createInstance(Ci.nsIJSON).
                       decodeFromStream(aInputStream, aInputStream.available());
 
           if (cache.version != CACHE_VERSION) {
             self.fetch(self.query);
             return;
           }