Bug 1431913 - Adapt to nsIURI.spec being made readonly in chat. r=florian
authorPhilipp Kewisch <mozilla@kewis.ch>
Sat, 20 Jan 2018 22:36:43 +0100
changeset 30940 fd49c5417f7517387d0e7cc39691f4c71c8d6687
parent 30939 459b4030d2c9ee173f386e9b1bc2b1b68a8efbb8
child 30941 836e8ded762fa62d4d802f297b439b29f7be8515
push id383
push userclokep@gmail.com
push dateMon, 07 May 2018 21:52:48 +0000
reviewersflorian
bugs1431913
Bug 1431913 - Adapt to nsIURI.spec being made readonly in chat. r=florian
chat/components/src/smileProtocolHandler.js
--- a/chat/components/src/smileProtocolHandler.js
+++ b/chat/components/src/smileProtocolHandler.js
@@ -16,20 +16,17 @@ smileProtocolHandler.prototype = {
   scheme: "smile",
   defaultPort: -1,
   protocolFlags: Ci.nsIProtocolHandler.URI_NORELATIVE |
                  Ci.nsIProtocolHandler.URI_NOAUTH |
                  Ci.nsIProtocolHandler.URI_IS_UI_RESOURCE |
                  Ci.nsIProtocolHandler.URI_IS_LOCAL_RESOURCE,
   newURI: function SPH_newURI(aSpec, aOriginCharset, aBaseURI) {
     let uri = Cc["@mozilla.org/network/simple-uri;1"].createInstance(Ci.nsIURI);
-    uri.spec = aSpec;
-    uri.QueryInterface(Ci.nsIMutable);
-    uri.mutable = false;
-    return uri;
+    return uri.mutate().setSpec(aSpec).finalize();
   },
   newChannel: function SPH_newChannel(aURI) {
     return this.newChannel2(aURI, null);
   },
   newChannel2: function SPH_newChannel2(aURI, aLoadInfo) {
     let smile = aURI.spec.replace(kSmileRegexp, "");
     let uri = Services.io.newURI(getSmileRealURI(smile));
     let channel = Services.io.newChannelFromURIWithLoadInfo(uri, aLoadInfo);