[bug] Replace instances of String.prototype.contains with String.prototype.includes
authorSukhbir Singh <sukhbir@torproject.org>
Tue, 24 Oct 2017 20:20:30 +0000 (16:20 -0400)
committerKali Kaneko <kali@leap.se>
Mon, 30 Oct 2017 15:50:18 +0000 (16:50 +0100)
In Firefox 48, contains() has been replaced with includes(). See
https://bugzilla.mozilla.org/show_bug.cgi?id=1102219 for more
information. This bug was preventing the extension from configuring a
new Bitmask account (see issues #9 and #10).

chrome/content/accountWizard/createInBackend.js

index f15b882..46dbbae 100644 (file)
@@ -236,7 +236,7 @@ function rememberPassword(server, password)
   login.init(passwordURI, null, passwordURI, server.username, password, "", "");
   try {
     Services.logins.addLogin(login);
-  } catch (e if e.message.contains("This login already exists")) {
+  } catch (e if e.message.includes("This login already exists")) {
     // TODO modify
   }
 }
@@ -263,7 +263,7 @@ function checkIncomingServerAlreadyExists(config)
 
   // if username does not have an '@', also check the e-mail
   // address form of the name.
-  if (!existing && !incoming.username.contains("@"))
+  if (!existing && !incoming.username.includes("@"))
     existing = MailServices.accounts.findRealServer(config.identity.emailAddress,
           incoming.hostname,
           sanitize.enum(incoming.type, ["pop3", "imap", "nntp"]),