Bug 1103588 - Part 1: Replace deprecated String#contains with String#includes in browser tests and extensions. r=dolske

This commit is contained in:
Chris Peterson 2016-04-09 16:05:17 -07:00
Родитель ed0ecbfd55
Коммит 053a2f3273
5 изменённых файлов: 16 добавлений и 14 удалений

Просмотреть файл

@ -1,6 +1,8 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
// This is testing the aboutCertError page (Bug 1207107).
const GOOD_PAGE = "https://example.com/";
@ -149,15 +151,15 @@ add_task(function* checkAdvancedDetails() {
};
});
is(message.divDisplay, "block", "Debug information is visible");
ok(message.text.contains(BAD_CERT), "Correct URL found");
ok(message.text.contains("Certificate has expired"),
ok(message.text.includes(BAD_CERT), "Correct URL found");
ok(message.text.includes("Certificate has expired"),
"Correct error message found");
ok(message.text.contains("HTTP Strict Transport Security: false"),
ok(message.text.includes("HTTP Strict Transport Security: false"),
"Correct HSTS value found");
ok(message.text.contains("HTTP Public Key Pinning: false"),
ok(message.text.includes("HTTP Public Key Pinning: false"),
"Correct HPKP value found");
let certChain = getCertChain(message.securityInfoAsString);
ok(message.text.contains(certChain), "Found certificate chain");
ok(message.text.includes(certChain), "Found certificate chain");
gBrowser.removeCurrentTab();
});
@ -221,15 +223,15 @@ add_task(function* checkAdvancedDetailsForHSTS() {
};
});
is(message.divDisplay, "block", "Debug information is visible");
ok(message.text.contains(badStsUri.spec), "Correct URL found");
ok(message.text.contains("requested domain name does not match the server's certificate"),
ok(message.text.includes(badStsUri.spec), "Correct URL found");
ok(message.text.includes("requested domain name does not match the server's certificate"),
"Correct error message found");
ok(message.text.contains("HTTP Strict Transport Security: false"),
ok(message.text.includes("HTTP Strict Transport Security: false"),
"Correct HSTS value found");
ok(message.text.contains("HTTP Public Key Pinning: true"),
ok(message.text.includes("HTTP Public Key Pinning: true"),
"Correct HPKP value found");
let certChain = getCertChain(message.securityInfoAsString);
ok(message.text.contains(certChain), "Found certificate chain");
ok(message.text.includes(certChain), "Found certificate chain");
gBrowser.removeCurrentTab();
});

Просмотреть файл

@ -15,5 +15,5 @@ add_task(function* () {
yield promiseRemoveTab(tab);
let closedTabData = ss.getClosedTabData(window);
ok(!closedTabData.contains(r), "tab not stored in _closedTabs");
ok(!closedTabData.includes(r), "tab not stored in _closedTabs");
});

Просмотреть файл

@ -17,5 +17,5 @@ add_task(function* () {
yield promiseRemoveTab(tab);
let closedTabData = ss.getClosedTabData(window);
ok(!closedTabData.contains(r), "tab not stored in _closedTabs");
ok(!closedTabData.includes(r), "tab not stored in _closedTabs");
});

Просмотреть файл

@ -403,7 +403,7 @@ add_task(function* test_createRoom() {
// We can't check the value of the key, but check we've got a # which indicates
// there should be one.
Assert.ok(room.roomUrl.contains("#"), "Created room url should have a key");
Assert.ok(room.roomUrl.includes("#"), "Created room url should have a key");
var key = room.roomUrl.split("#")[1];
Assert.ok(key.length, "Created room url should have non-zero length key");

Просмотреть файл

@ -612,7 +612,7 @@ var pktApi = (function() {
*/
function getSignupAB() {
var setting = getSetting('signupAB');
if (!setting || setting.contains('hero'))
if (!setting || setting.includes('hero'))
{
var rand = (Math.floor(Math.random()*100+1));
if (rand > 90)