mirror of
https://github.com/roytam1/palemoon27.git
synced 2026-05-29 10:32:23 +00:00
45e41b7633
- Bug 1182373 - Don't constant-fold in the tag component of a tagged-template, because constant-folding evaluates the tag too early (and moght convert a value into a property reference, causing the wrong |this| to be passed). r=jorendorff (f9e41352b) - Bug 1183400 - Constant-fold nullary nodes entirely according to their kind, not their arity. r=efaust (9c6248dd8) - Bug 1183400 - Fold typeof nodes by examining their kind. r=efaust (0dc443122) - Bug 1183400 - Fold |void <expr>| expressions by kind. r=efaust (d872286ad) - Bug 1183400 - Fold delete nodes by kind. r=efaust (a30634947) - Bug 1164774 - Remove unused code handling binary-arity PNK_ADD nodes in constant-folding. r=shu (996db297b) - Bug 1183400 - Fold !/~/+/- by kind. r=efaust (bf5dd5984) - Bug 1183400 - Pass a Parser reference to Fold, not separate handler/options, preparing for another patch that wants to have access to a parser instance. r=efaust (5bbb167be) - Bug 1183400 - Fold increment/decrement operations by kind. r=efaust (2728e23a7) - Bug 1183400 - Fold ?: expressions by kind. r=efaust (64d6ab853) - Bug 1183400 - Fold |if| nodes by kind. r=efaust (0f701a6bb) - Bug 1183400 - Fold various simple unary cases by kind. r=efaust (590b24acb) - Bug 1183400 - Fold and/or expressions. r=efaust (1f114d2b2) - Bug 1183400 - Fold function nodes by kind. r=efaust (0920010c0) - Bug 1183400 - Fold binary arithmetic operations by kind, not arity. r=efaust (a3723a1ec) - Bug 1183400 - Remove a now-unused variable, following up on the ?:/if-node folding changes. r=trivial, r=orange in a CLOSED TREE (522584dc0) - Bug 1183400 - Inline FoldBinaryNumeric into its sole caller and simplify code accordingly. r=efaust (043ccf349) - Bug 1183400 - Fold various list nodes not given, nor requiring, special treatment. r=shu (7de28f276) - Bug 1183400 - Constant-fold yield/yield*/return by kind and not arity. r=shu (7cae87421) - Bug 1183400 - Fold try/catch by kind. r=shu (5df2a97fc) - Bug 1183400 - Fold class nodes by kind. r=shu (67fffcc45) - Bug 1183400 - Fold element accesses by kind. r=efaust (82538a7a2) - Bug 1183400 - Fold addition by kind. r=efaust (68a0c6b49) - Bug 1183400 - Fold function calls and tagged templates by kind, not arity. r=efaust (0a368e8f9) - Bug 1183400 - Fold various binary nodes with two non-null halves by kind. r=efaust (de48c675b) - Bug 1183400 - Fold while and do-while loops by kind, not arity. r=efaust (998bd13cc) - Bug 1183400 - Remove dead fold-by-arity code. r=efaust (3b5f719b9) - Bug 1183400 - Remove SyntacticContext::Delete, now addressed by modifying how delete nodes are folded. r=efaust (8129f5f7c) - Bug 1183400 - Constant-fold switch/default by kind, not arity. r=efaust (e9430d603) - Bug 1183400 - Fold for-in, for-of, and for(;;) loops by kind, and classify miscellaneous straightforward kinds for folding. r=efaust (59d09a110) - Bug 1183400 - Replace callee-based condition-constant folding with caller-specified condition-constant folding. r=efaust (2090ea750) - Bug 1183400 - Remove special |void| handling by making Boolish recognize |void| expressions as falsy, when they're obviously so. r=efaust (d230cbb0d) - Bug 1183400 - Remove SyntacticContext::Condition, now handled context-sensitively by callers specifically requesting condition-targeted folding. r=efaust (8be79cd7a) - Bug 1183400 - Fold the last few nodes (including PN_NAME nodes) by kind, not arity. r=efaust (4e8e911a4) - Bug 1183400 - Remove SyntacticContext completely. r=efaust (745d4df15) - Bug 1183400 - Common up some is-effectless testing. r=efaust (ed25885e6) - Bug 1135322 - receiveMessage() should convert logins to nsILoginInfo objects. r=MattN (35da0f066) - Bug 1140242 - Convert nsILoginInfo to vanilla JS objects before trying to send them in messages. r=dolske (f952e9ab5) - Bug 1134846 - Add a module to support per-site password manager recipes. r=dolske (d9d686818) - Bug 1135451 - fillForm() cleanup part A: remove unused return type, kill E10S unfriendly fillForm from nsILoginManager, kill passwordmgr-found-form notification, largely a backout of bug 439365. r=MattN (3825eb1dd) - Bug 1120129 - Allow per-site recipes to adjust the username/password field detection for autofill. r=dolske (423202980) - Bug 1144981 - username/password recipe for www.anthem.com. r=mattn (55ce95a2b) - Bug 1146065 - Logins captured but not filled on discover.com. r=mattn (4b19c1a01) - reorder after strange misspatch (706cfd4ea) - Bustage fix for bug 1146065. (4b0a7b5f6) - fix some mispatches and also put back some "backports" lost with Bug 1182969 (f61e63baf)
178 lines
7.3 KiB
JavaScript
178 lines
7.3 KiB
JavaScript
/* Any copyright is dedicated to the Public Domain.
|
|
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
|
|
|
/**
|
|
* Tests adding and retrieving LoginRecipes in the parent process.
|
|
*/
|
|
|
|
"use strict";
|
|
|
|
add_task(function* test_init() {
|
|
let parent = new LoginRecipesParent({ defaults: false });
|
|
let initPromise1 = parent.initializationPromise;
|
|
let initPromise2 = parent.initializationPromise;
|
|
Assert.strictEqual(initPromise1, initPromise2, "Check that the same promise is returned");
|
|
|
|
let recipesParent = yield initPromise1;
|
|
Assert.ok(recipesParent instanceof LoginRecipesParent, "Check init return value");
|
|
Assert.strictEqual(recipesParent._recipesByHost.size, 0, "Initially 0 recipes");
|
|
});
|
|
|
|
add_task(function* test_get_missing_host() {
|
|
let recipesParent = yield RecipeHelpers.initNewParent();
|
|
let exampleRecipes = recipesParent.getRecipesForHost("example.invalid");
|
|
Assert.strictEqual(exampleRecipes.size, 0, "Check recipe count for example.invalid");
|
|
|
|
});
|
|
|
|
add_task(function* test_add_get_simple_host() {
|
|
let recipesParent = yield RecipeHelpers.initNewParent();
|
|
Assert.strictEqual(recipesParent._recipesByHost.size, 0, "Initially 0 recipes");
|
|
recipesParent.add({
|
|
hosts: ["example.com"],
|
|
});
|
|
Assert.strictEqual(recipesParent._recipesByHost.size, 1,
|
|
"Check number of hosts after the addition");
|
|
|
|
let exampleRecipes = recipesParent.getRecipesForHost("example.com");
|
|
Assert.strictEqual(exampleRecipes.size, 1, "Check recipe count for example.com");
|
|
let recipe = [...exampleRecipes][0];
|
|
Assert.strictEqual(typeof(recipe), "object", "Check recipe type");
|
|
Assert.strictEqual(recipe.hosts.length, 1, "Check that one host is present");
|
|
Assert.strictEqual(recipe.hosts[0], "example.com", "Check the one host");
|
|
});
|
|
|
|
add_task(function* test_add_get_non_standard_port_host() {
|
|
let recipesParent = yield RecipeHelpers.initNewParent();
|
|
recipesParent.add({
|
|
hosts: ["example.com:8080"],
|
|
});
|
|
Assert.strictEqual(recipesParent._recipesByHost.size, 1,
|
|
"Check number of hosts after the addition");
|
|
|
|
let exampleRecipes = recipesParent.getRecipesForHost("example.com:8080");
|
|
Assert.strictEqual(exampleRecipes.size, 1, "Check recipe count for example.com:8080");
|
|
let recipe = [...exampleRecipes][0];
|
|
Assert.strictEqual(typeof(recipe), "object", "Check recipe type");
|
|
Assert.strictEqual(recipe.hosts.length, 1, "Check that one host is present");
|
|
Assert.strictEqual(recipe.hosts[0], "example.com:8080", "Check the one host");
|
|
});
|
|
|
|
add_task(function* test_add_multiple_hosts() {
|
|
let recipesParent = yield RecipeHelpers.initNewParent();
|
|
recipesParent.add({
|
|
hosts: ["example.com", "foo.invalid"],
|
|
});
|
|
Assert.strictEqual(recipesParent._recipesByHost.size, 2,
|
|
"Check number of hosts after the addition");
|
|
|
|
let exampleRecipes = recipesParent.getRecipesForHost("example.com");
|
|
Assert.strictEqual(exampleRecipes.size, 1, "Check recipe count for example.com");
|
|
let recipe = [...exampleRecipes][0];
|
|
Assert.strictEqual(typeof(recipe), "object", "Check recipe type");
|
|
Assert.strictEqual(recipe.hosts.length, 2, "Check that two hosts are present");
|
|
Assert.strictEqual(recipe.hosts[0], "example.com", "Check the first host");
|
|
Assert.strictEqual(recipe.hosts[1], "foo.invalid", "Check the second host");
|
|
|
|
let fooRecipes = recipesParent.getRecipesForHost("foo.invalid");
|
|
Assert.strictEqual(fooRecipes.size, 1, "Check recipe count for foo.invalid");
|
|
let fooRecipe = [...fooRecipes][0];
|
|
Assert.strictEqual(fooRecipe, recipe, "Check that the recipe is shared");
|
|
Assert.strictEqual(typeof(fooRecipe), "object", "Check recipe type");
|
|
Assert.strictEqual(fooRecipe.hosts.length, 2, "Check that two hosts are present");
|
|
Assert.strictEqual(fooRecipe.hosts[0], "example.com", "Check the first host");
|
|
Assert.strictEqual(fooRecipe.hosts[1], "foo.invalid", "Check the second host");
|
|
});
|
|
|
|
add_task(function* test_add_pathRegex() {
|
|
let recipesParent = yield RecipeHelpers.initNewParent();
|
|
recipesParent.add({
|
|
hosts: ["example.com"],
|
|
pathRegex: /^\/mypath\//,
|
|
});
|
|
Assert.strictEqual(recipesParent._recipesByHost.size, 1,
|
|
"Check number of hosts after the addition");
|
|
|
|
let exampleRecipes = recipesParent.getRecipesForHost("example.com");
|
|
Assert.strictEqual(exampleRecipes.size, 1, "Check recipe count for example.com");
|
|
let recipe = [...exampleRecipes][0];
|
|
Assert.strictEqual(typeof(recipe), "object", "Check recipe type");
|
|
Assert.strictEqual(recipe.hosts.length, 1, "Check that one host is present");
|
|
Assert.strictEqual(recipe.hosts[0], "example.com", "Check the one host");
|
|
Assert.strictEqual(recipe.pathRegex.toString(), "/^\\/mypath\\//", "Check the pathRegex");
|
|
});
|
|
|
|
add_task(function* test_add_selectors() {
|
|
let recipesParent = yield RecipeHelpers.initNewParent();
|
|
recipesParent.add({
|
|
hosts: ["example.com"],
|
|
usernameSelector: "#my-username",
|
|
passwordSelector: "#my-form > input.password",
|
|
});
|
|
Assert.strictEqual(recipesParent._recipesByHost.size, 1,
|
|
"Check number of hosts after the addition");
|
|
|
|
let exampleRecipes = recipesParent.getRecipesForHost("example.com");
|
|
Assert.strictEqual(exampleRecipes.size, 1, "Check recipe count for example.com");
|
|
let recipe = [...exampleRecipes][0];
|
|
Assert.strictEqual(typeof(recipe), "object", "Check recipe type");
|
|
Assert.strictEqual(recipe.hosts.length, 1, "Check that one host is present");
|
|
Assert.strictEqual(recipe.hosts[0], "example.com", "Check the one host");
|
|
Assert.strictEqual(recipe.usernameSelector, "#my-username", "Check the usernameSelector");
|
|
Assert.strictEqual(recipe.passwordSelector, "#my-form > input.password", "Check the passwordSelector");
|
|
});
|
|
|
|
/* Begin checking errors with add */
|
|
|
|
add_task(function* test_add_missing_prop() {
|
|
let recipesParent = yield RecipeHelpers.initNewParent();
|
|
Assert.throws(() => recipesParent.add({}), /required/, "Some properties are required");
|
|
});
|
|
|
|
add_task(function* test_add_unknown_prop() {
|
|
let recipesParent = yield RecipeHelpers.initNewParent();
|
|
Assert.throws(() => recipesParent.add({
|
|
unknownProp: true,
|
|
}), /supported/, "Unknown properties should cause an error to help with typos");
|
|
});
|
|
|
|
add_task(function* test_add_invalid_hosts() {
|
|
let recipesParent = yield RecipeHelpers.initNewParent();
|
|
Assert.throws(() => recipesParent.add({
|
|
hosts: 404,
|
|
}), /array/, "hosts should be an array");
|
|
});
|
|
|
|
add_task(function* test_add_empty_host_array() {
|
|
let recipesParent = yield RecipeHelpers.initNewParent();
|
|
Assert.throws(() => recipesParent.add({
|
|
hosts: [],
|
|
}), /array/, "hosts should be a non-empty array");
|
|
});
|
|
|
|
add_task(function* test_add_pathRegex_non_regexp() {
|
|
let recipesParent = yield RecipeHelpers.initNewParent();
|
|
Assert.throws(() => recipesParent.add({
|
|
hosts: ["example.com"],
|
|
pathRegex: "foo",
|
|
}), /regular expression/, "pathRegex should be a RegExp");
|
|
});
|
|
|
|
add_task(function* test_add_usernameSelector_non_string() {
|
|
let recipesParent = yield RecipeHelpers.initNewParent();
|
|
Assert.throws(() => recipesParent.add({
|
|
hosts: ["example.com"],
|
|
usernameSelector: 404,
|
|
}), /string/, "usernameSelector should be a string");
|
|
});
|
|
|
|
add_task(function* test_add_passwordSelector_non_string() {
|
|
let recipesParent = yield RecipeHelpers.initNewParent();
|
|
Assert.throws(() => recipesParent.add({
|
|
hosts: ["example.com"],
|
|
passwordSelector: 404,
|
|
}), /string/, "passwordSelector should be a string");
|
|
});
|
|
|
|
/* End checking errors with add */
|