Bug 1225355 - Use channel.asyncOpen2 in toolkit/components/aboutmemory/content/aboutMemory.js (r=sicking)
authorChristoph Kerschbaumer <mozilla@christophkerschbaumer.com>
Mon, 30 Nov 2015 20:23:55 -0800
changeset 274824 458edd4f55231476adb480433cdea71509bcc81b
parent 274823 7e775b3742d9c3b2b24c434d36acbc87ed5d6541
child 274825 433bb82665c2f67c9d166d15913df99aa7f57231
push id68685
push usermozilla@christophkerschbaumer.com
push dateTue, 01 Dec 2015 04:32:42 +0000
treeherdermozilla-inbound@c91eff1c2734 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssicking
bugs1225355
milestone45.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
Bug 1225355 - Use channel.asyncOpen2 in toolkit/components/aboutmemory/content/aboutMemory.js (r=sicking)
toolkit/components/aboutmemory/content/aboutMemory.js
--- a/toolkit/components/aboutmemory/content/aboutMemory.js
+++ b/toolkit/components/aboutmemory/content/aboutMemory.js
@@ -29,16 +29,17 @@ const KIND_OTHER             = Ci.nsIMem
 
 const UNITS_BYTES            = Ci.nsIMemoryReporter.UNITS_BYTES;
 const UNITS_COUNT            = Ci.nsIMemoryReporter.UNITS_COUNT;
 const UNITS_COUNT_CUMULATIVE = Ci.nsIMemoryReporter.UNITS_COUNT_CUMULATIVE;
 const UNITS_PERCENTAGE       = Ci.nsIMemoryReporter.UNITS_PERCENTAGE;
 
 Cu.import("resource://gre/modules/Services.jsm");
 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
+Cu.import("resource://gre/modules/NetUtil.jsm");
 
 XPCOMUtils.defineLazyGetter(this, "nsBinaryStream",
                             () => CC("@mozilla.org/binaryinputstream;1",
                                      "nsIBinaryInputStream",
                                      "setInputStream"));
 XPCOMUtils.defineLazyGetter(this, "nsFile",
                             () => CC("@mozilla.org/file/local;1",
                                      "nsIFile", "initWithPath"));
@@ -665,23 +666,21 @@ function loadMemoryReportsFromFile(aFile
           reader.readAsText(new Blob(this.data));
         } catch (ex) {
           handleException(ex);
         }
       }
     }, null);
 
     let file = new nsFile(aFilename);
-    let fileChan = Services.io.newChannelFromURI2(Services.io.newFileURI(file),
-                                                  null,      // aLoadingNode
-                                                  Services.scriptSecurityManager.getSystemPrincipal(),
-                                                  null,      // aTriggeringPrincipal
-                                                  Ci.nsILoadInfo.SEC_NORMAL,
-                                                  Ci.nsIContentPolicy.TYPE_OTHER);
-    fileChan.asyncOpen(converter, null);
+    let fileChan = NetUtil.newChannel({
+                     uri: Services.io.newFileURI(file),
+                     loadUsingSystemPrincipal: true
+                   });
+    fileChan.asyncOpen2(converter);
 
   } catch (ex) {
     handleException(ex);
   }
 }
 
 /**
  * Like updateAboutMemoryFromReporters(), but gets its data from a file instead