Bug 1403243 - Fix typo in identity exceptions. r?kmag
MozReview-Commit-ID: 9gt0f990ftu
--- a/toolkit/components/extensions/ext-contextualIdentities.js
+++ b/toolkit/components/extensions/ext-contextualIdentities.js
@@ -134,17 +134,17 @@ this.contextualIdentities = class extend
getAPI(context) {
let self = {
contextualIdentities: {
async get(cookieStoreId) {
checkAPIEnabled();
let containerId = getContainerForCookieStoreId(cookieStoreId);
if (!containerId) {
- throw new ExtensionError(`Invalid contextual identitiy: ${cookieStoreId}`);
+ throw new ExtensionError(`Invalid contextual identity: ${cookieStoreId}`);
}
let identity = ContextualIdentityService.getPublicIdentityFromId(containerId);
return convertIdentity(identity);
},
async query(details) {
checkAPIEnabled();
@@ -171,22 +171,22 @@ this.contextualIdentities = class extend
details.color);
return convertIdentity(identity);
},
async update(cookieStoreId, details) {
checkAPIEnabled();
let containerId = getContainerForCookieStoreId(cookieStoreId);
if (!containerId) {
- throw new ExtensionError(`Invalid contextual identitiy: ${cookieStoreId}`);
+ throw new ExtensionError(`Invalid contextual identity: ${cookieStoreId}`);
}
let identity = ContextualIdentityService.getPublicIdentityFromId(containerId);
if (!identity) {
- throw new ExtensionError(`Invalid contextual identitiy: ${cookieStoreId}`);
+ throw new ExtensionError(`Invalid contextual identity: ${cookieStoreId}`);
}
if (details.name !== null) {
identity.name = details.name;
}
if (details.color !== null) {
identity.color = details.color;
@@ -194,39 +194,39 @@ this.contextualIdentities = class extend
if (details.icon !== null) {
identity.icon = details.icon;
}
if (!ContextualIdentityService.update(identity.userContextId,
identity.name, identity.icon,
identity.color)) {
- throw new ExtensionError(`Contextual identitiy failed to update: ${cookieStoreId}`);
+ throw new ExtensionError(`Contextual identity failed to update: ${cookieStoreId}`);
}
return convertIdentity(identity);
},
async remove(cookieStoreId) {
checkAPIEnabled();
let containerId = getContainerForCookieStoreId(cookieStoreId);
if (!containerId) {
- throw new ExtensionError(`Invalid contextual identitiy: ${cookieStoreId}`);
+ throw new ExtensionError(`Invalid contextual identity: ${cookieStoreId}`);
}
let identity = ContextualIdentityService.getPublicIdentityFromId(containerId);
if (!identity) {
- throw new ExtensionError(`Invalid contextual identitiy: ${cookieStoreId}`);
+ throw new ExtensionError(`Invalid contextual identity: ${cookieStoreId}`);
}
// We have to create the identity object before removing it.
let convertedIdentity = convertIdentity(identity);
if (!ContextualIdentityService.remove(identity.userContextId)) {
- throw new ExtensionError(`Contextual identitiy failed to remove: ${cookieStoreId}`);
+ throw new ExtensionError(`Contextual identity failed to remove: ${cookieStoreId}`);
}
return convertedIdentity;
},
onCreated: new EventManager(context, "contextualIdentities.onCreated", fire => {
let observer = (subject, topic) => {
let convertedIdentity = convertIdentityFromObserver(subject);
--- a/toolkit/components/extensions/test/xpcshell/test_ext_contextual_identities.js
+++ b/toolkit/components/extensions/test/xpcshell/test_ext_contextual_identities.js
@@ -122,19 +122,19 @@ add_task(async function test_contextualI
});
add_task(async function test_contextualIdentity_with_permissions() {
const CONTAINERS_PREF = "privacy.userContext.enabled";
const initial = Services.prefs.getBoolPref(CONTAINERS_PREF);
async function background(ver) {
let ci;
- await browser.test.assertRejects(browser.contextualIdentities.get("foobar"), "Invalid contextual identitiy: foobar", "API should reject here");
- await browser.test.assertRejects(browser.contextualIdentities.update("foobar", {name: "testing"}), "Invalid contextual identitiy: foobar", "API should reject for unknown updates");
- await browser.test.assertRejects(browser.contextualIdentities.remove("foobar"), "Invalid contextual identitiy: foobar", "API should reject for removing unknown containers");
+ await browser.test.assertRejects(browser.contextualIdentities.get("foobar"), "Invalid contextual identity: foobar", "API should reject here");
+ await browser.test.assertRejects(browser.contextualIdentities.update("foobar", {name: "testing"}), "Invalid contextual identity: foobar", "API should reject for unknown updates");
+ await browser.test.assertRejects(browser.contextualIdentities.remove("foobar"), "Invalid contextual identity: foobar", "API should reject for removing unknown containers");
ci = await browser.contextualIdentities.get("firefox-container-1");
browser.test.assertTrue(!!ci, "We have an identity");
browser.test.assertTrue("name" in ci, "We have an identity.name");
browser.test.assertTrue("color" in ci, "We have an identity.color");
browser.test.assertTrue("icon" in ci, "We have an identity.icon");
browser.test.assertEq("Personal", ci.name, "identity.name is correct");
browser.test.assertEq("firefox-container-1", ci.cookieStoreId, "identity.cookieStoreId is correct");