Bug 1094567 - Remove the star for non-bookmark behavior. r=paolo

This commit is contained in:
Blair McBride 2015-01-08 22:38:48 +13:00
parent 1668f6b4f0
commit faaca41c3b
10 changed files with 177 additions and 63 deletions

View File

@ -123,6 +123,7 @@ skip-if = e10s # Bug 1101993 - times out for unknown reasons when run in the dir
[browser_autocomplete_no_title.js]
[browser_autocomplete_autoselect.js]
[browser_autocomplete_oldschool_wrap.js]
[browser_autocomplete_tag_star_visibility.js]
[browser_backButtonFitts.js]
skip-if = os != "win" || e10s # The Fitts Law back button is only supported on Windows (bug 571454) / e10s - Bug 1099154: test touches content (attempts to add an event listener directly to the contentWindow)
[browser_blob-channelname.js]

View File

@ -0,0 +1,105 @@
add_task(function*() {
// This test is only relevant if UnifiedComplete is enabled.
Services.prefs.setBoolPref("browser.urlbar.unifiedcomplete", true);
registerCleanupFunction(() => {
PlacesUtils.bookmarks.removeFolderChildren(PlacesUtils.unfiledBookmarksFolderId);
Services.prefs.clearUserPref("browser.urlbar.unifiedcomplete");
Services.prefs.clearUserPref("browser.urlbar.suggest.bookmark");
});
function* addTagItem(tagName) {
let uri = NetUtil.newURI(`http://example.com/this/is/tagged/${tagName}`);
PlacesUtils.bookmarks.insertBookmark(PlacesUtils.unfiledBookmarksFolderId,
uri,
PlacesUtils.bookmarks.DEFAULT_INDEX,
`test ${tagName}`);
PlacesUtils.tagging.tagURI(uri, [tagName]);
yield PlacesTestUtils.addVisits([{uri: uri, title: `Test page with tag ${tagName}`}]);
}
// We use different tags for each part of the test, as otherwise the
// autocomplete code tries to be smart by using the previously cached element
// without updating it (since all parameters it knows about are the same).
let testcases = [{
description: "Test with suggest.bookmark=true",
tagName: "tagtest1",
prefs: {
"suggest.bookmark": true,
},
input: "tagtest1",
expected: {
type: "bookmark-tag",
typeImageVisible: true,
},
}, {
description: "Test with suggest.bookmark=false",
tagName: "tagtest2",
prefs: {
"suggest.bookmark": false,
},
input: "tagtest2",
expected: {
type: "tag",
typeImageVisible: false,
},
}, {
description: "Test with suggest.bookmark=true (again)",
tagName: "tagtest3",
prefs: {
"suggest.bookmark": true,
},
input: "tagtest3",
expected: {
type: "bookmark-tag",
typeImageVisible: true,
},
}, {
description: "Test with bookmark restriction token",
tagName: "tagtest4",
prefs: {
"suggest.bookmark": true,
},
input: "* tagtest4",
expected: {
type: "bookmark-tag",
typeImageVisible: true,
},
}, {
description: "Test with history restriction token",
tagName: "tagtest5",
prefs: {
"suggest.bookmark": true,
},
input: "^ tagtest5",
expected: {
type: "tag",
typeImageVisible: false,
},
}];
for (let testcase of testcases) {
info(`Test case: ${testcase.description}`);
yield addTagItem(testcase.tagName);
for (let prefName of Object.keys(testcase.prefs)) {
Services.prefs.setBoolPref(`browser.urlbar.${prefName}`, testcase.prefs[prefName]);
}
yield promiseAutocompleteResultPopup(testcase.input);
let result = gURLBar.popup.richlistbox.children[1];
ok(result && !result.collasped, "Should have result");
is(result.getAttribute("type"), testcase.expected.type, "Result should have expected type");
if (testcase.expected.typeImageVisible) {
is_element_visible(result._typeImage, "Type image should be visible");
} else {
is_element_hidden(result._typeImage, "Type image should be hidden");
}
gURLBar.popup.hidePopup();
yield promisePopupHidden(gURLBar.popup);
}
});

View File

@ -1286,7 +1286,9 @@ Search.prototype = {
// search or because of the user's preferences), so only set it if we
// haven't already done so.
if (showTags) {
match.style = "tag";
// If we're not suggesting bookmarks, then this shouldn't
// display as one.
match.style = this.hasBehavior("bookmark") ? "bookmark-tag" : "tag";
}
else if (bookmarked) {
match.style = "bookmark";

View File

@ -171,7 +171,7 @@ function* check_autocomplete(test) {
// Got a match on both uri and title?
if (stripPrefix(uri.spec) == stripPrefix(value) && title == comment) {
do_log_info("Got a match at index " + j + "!");
let actualStyle = controller.getStyleAt(i).split(/\W+/).sort();
let actualStyle = controller.getStyleAt(i).split(/\s+/).sort();
if (style)
Assert.equal(actualStyle.toString(), style.toString(), "Match should have expected style");

View File

@ -16,7 +16,7 @@ add_task(function* test_tag_match_has_bookmark_title() {
tags: [ "superTag" ]});
yield check_autocomplete({
search: "superTag",
matches: [ { uri: uri, title: "Bookmark title", tags: [ "superTag" ], style: [ "tag" ] } ]
matches: [ { uri: uri, title: "Bookmark title", tags: [ "superTag" ], style: [ "bookmark-tag" ] } ]
});
yield cleanup();
});

View File

@ -23,15 +23,15 @@ add_task(function* test_tag_match_url() {
addBookmark({ uri: uri1,
title: "title",
tags: [ "superTag" ],
style: [ "tag" ] });
style: [ "bookmark-tag" ] });
addBookmark({ uri: uri2,
title: "title",
tags: [ "superTag" ],
style: [ "tag" ] });
style: [ "bookmark-tag" ] });
yield check_autocomplete({
search: "superTag",
matches: [ { uri: uri1, title: "title", tags: [ "superTag" ], style: [ "tag" ] },
{ uri: uri2, title: "title", tags: [ "superTag" ], style: [ "tag" ] } ]
matches: [ { uri: uri1, title: "title", tags: [ "superTag" ], style: [ "bookmark-tag" ] },
{ uri: uri2, title: "title", tags: [ "superTag" ], style: [ "bookmark-tag" ] } ]
});
yield cleanup();
});

View File

@ -33,32 +33,32 @@ add_task(function* test_javascript_match() {
do_log_info("Make sure tags come back in the title when matching tags");
yield check_autocomplete({
search: "page1 tag",
matches: [ { uri: uri1, title: "tagged", tags: [ "tag1" ], style: [ "tag" ] } ]
matches: [ { uri: uri1, title: "tagged", tags: [ "tag1" ], style: [ "bookmark-tag" ] } ]
});
do_log_info("Check tags in title for page2");
yield check_autocomplete({
search: "page2 tag",
matches: [ { uri: uri2, title: "tagged", tags: [ "tag1", "tag2" ], style: [ "tag" ] } ]
matches: [ { uri: uri2, title: "tagged", tags: [ "tag1", "tag2" ], style: [ "bookmark-tag" ] } ]
});
do_log_info("Make sure tags appear even when not matching the tag");
yield check_autocomplete({
search: "page3",
matches: [ { uri: uri3, title: "tagged", tags: [ "tag1", "tag3" ], style: [ "tag" ] } ]
matches: [ { uri: uri3, title: "tagged", tags: [ "tag1", "tag3" ], style: [ "bookmark-tag" ] } ]
});
do_log_info("Multiple tags come in commas for page4");
yield check_autocomplete({
search: "page4",
matches: [ { uri: uri4, title: "tagged", tags: [ "tag1", "tag2", "tag3" ], style: [ "tag" ] } ]
matches: [ { uri: uri4, title: "tagged", tags: [ "tag1", "tag2", "tag3" ], style: [ "bookmark-tag" ] } ]
});
do_log_info("Extra test just to make sure we match the title");
yield check_autocomplete({
search: "tag2",
matches: [ { uri: uri2, title: "tagged", tags: [ "tag1", "tag2" ], style: [ "tag" ] },
{ uri: uri4, title: "tagged", tags: [ "tag1", "tag2", "tag3" ], style: [ "tag" ] } ]
matches: [ { uri: uri2, title: "tagged", tags: [ "tag1", "tag2" ], style: [ "bookmark-tag" ] },
{ uri: uri4, title: "tagged", tags: [ "tag1", "tag2", "tag3" ], style: [ "bookmark-tag" ] } ]
});
yield cleanup();

View File

@ -63,10 +63,10 @@ add_task(function* test_special_searches() {
{ uri: uri6, title: "foo.bar", style: [ "bookmark" ] },
{ uri: uri7, title: "title", style: [ "bookmark" ] },
{ uri: uri8, title: "foo.bar", style: [ "bookmark" ] },
{ uri: uri9, title: "title", tags: [ "foo.bar" ], style: [ "tag" ] },
{ uri: uri10, title: "foo.bar", tags: [ "foo.bar" ], style: [ "tag" ] },
{ uri: uri11, title: "title", tags: [ "foo.bar"], style: [ "tag" ] },
{ uri: uri12, title: "foo.bar", tags: [ "foo.bar" ], style: [ "tag" ] } ]
{ uri: uri9, title: "title", tags: [ "foo.bar" ], style: [ "bookmark-tag" ] },
{ uri: uri10, title: "foo.bar", tags: [ "foo.bar" ], style: [ "bookmark-tag" ] },
{ uri: uri11, title: "title", tags: [ "foo.bar"], style: [ "bookmark-tag" ] },
{ uri: uri12, title: "foo.bar", tags: [ "foo.bar" ], style: [ "bookmark-tag" ] } ]
});
do_log_info("Tag restrict");
@ -138,10 +138,10 @@ add_task(function* test_special_searches() {
matches: [ { uri: uri6, title: "foo.bar", style: [ "bookmark" ] },
{ uri: uri7, title: "title", style: [ "bookmark" ] },
{ uri: uri8, title: "foo.bar", style: [ "bookmark" ] },
{ uri: uri9, title: "title", tags: [ "foo.bar" ], style: [ "tag" ] },
{ uri: uri10, title: "foo.bar", tags: [ "foo.bar" ], style: [ "tag" ] },
{ uri: uri11, title: "title", tags: [ "foo.bar" ], style: [ "tag" ] },
{ uri: uri12, title: "foo.bar", tags: [ "foo.bar" ], style: [ "tag" ] } ]
{ uri: uri9, title: "title", tags: [ "foo.bar" ], style: [ "bookmark-tag" ] },
{ uri: uri10, title: "foo.bar", tags: [ "foo.bar" ], style: [ "bookmark-tag" ] },
{ uri: uri11, title: "title", tags: [ "foo.bar" ], style: [ "bookmark-tag" ] },
{ uri: uri12, title: "foo.bar", tags: [ "foo.bar" ], style: [ "bookmark-tag" ] } ]
});
do_log_info("foo | -> is star (change pref)");
@ -151,10 +151,10 @@ add_task(function* test_special_searches() {
matches: [ { uri: uri6, title: "foo.bar", style: [ "bookmark" ] },
{ uri: uri7, title: "title", style: [ "bookmark" ] },
{ uri: uri8, title: "foo.bar", style: [ "bookmark" ] },
{ uri: uri9, title: "title", tags: [ "foo.bar" ], style: [ "tag" ] },
{ uri: uri10, title: "foo.bar", tags: [ "foo.bar" ], style: [ "tag" ] },
{ uri: uri11, title: "title", tags: [ "foo.bar" ], style: [ "tag" ] },
{ uri: uri12, title: "foo.bar", tags: [ "foo.bar" ], style: [ "tag" ] } ]
{ uri: uri9, title: "title", tags: [ "foo.bar" ], style: [ "bookmark-tag" ] },
{ uri: uri10, title: "foo.bar", tags: [ "foo.bar" ], style: [ "bookmark-tag" ] },
{ uri: uri11, title: "title", tags: [ "foo.bar" ], style: [ "bookmark-tag" ] },
{ uri: uri12, title: "foo.bar", tags: [ "foo.bar" ], style: [ "bookmark-tag" ] } ]
});
do_log_info("foo # -> in title");
@ -251,7 +251,7 @@ add_task(function* test_special_searches() {
yield check_autocomplete({
search: "foo ^ *",
matches: [ { uri: uri6, title: "foo.bar", style: [ "bookmark" ] },
{ uri: uri11, title: "title", tags: [ "foo.bar" ], style: [ "tag" ] } ]
{ uri: uri11, title: "title", tags: [ "foo.bar" ], style: [ "bookmark-tag" ] } ]
});
do_log_info("foo ^ # -> history, in title");
@ -289,10 +289,10 @@ add_task(function* test_special_searches() {
search: "foo * #",
matches: [ { uri: uri6, title: "foo.bar", style: [ "bookmark" ] },
{ uri: uri8, title: "foo.bar", style: [ "bookmark" ] },
{ uri: uri9, title: "title", tags: [ "foo.bar" ], style: [ "tag" ] },
{ uri: uri10, title: "foo.bar", tags: [ "foo.bar" ], style: [ "tag" ] },
{ uri: uri11, title: "title", tags: [ "foo.bar" ], style: [ "tag" ] },
{ uri: uri12, title: "foo.bar", tags: [ "foo.bar" ], style: [ "tag" ] } ]
{ uri: uri9, title: "title", tags: [ "foo.bar" ], style: [ "bookmark-tag" ] },
{ uri: uri10, title: "foo.bar", tags: [ "foo.bar" ], style: [ "bookmark-tag" ] },
{ uri: uri11, title: "title", tags: [ "foo.bar" ], style: [ "bookmark-tag" ] },
{ uri: uri12, title: "foo.bar", tags: [ "foo.bar" ], style: [ "bookmark-tag" ] } ]
});
do_log_info("foo * @ -> is star, in url");
@ -300,23 +300,23 @@ add_task(function* test_special_searches() {
search: "foo * @",
matches: [ { uri: uri7, title: "title", style: [ "bookmark" ] },
{ uri: uri8, title: "foo.bar", style: [ "bookmark" ] },
{ uri: uri11, title: "title", tags: [ "foo.bar" ], style: [ "tag" ] },
{ uri: uri12, title: "foo.bar", tags: [ "foo.bar" ], style: [ "tag" ] } ]
{ uri: uri11, title: "title", tags: [ "foo.bar" ], style: [ "bookmark-tag" ] },
{ uri: uri12, title: "foo.bar", tags: [ "foo.bar" ], style: [ "bookmark-tag" ] } ]
});
do_log_info("foo * + -> same as +");
yield check_autocomplete({
search: "foo * +",
matches: [ { uri: uri9, title: "title", tags: [ "foo.bar" ], style: [ "tag" ] },
{ uri: uri10, title: "foo.bar", tags: [ "foo.bar" ], style: [ "tag" ] },
{ uri: uri11, title: "title", tags: [ "foo.bar" ], style: [ "tag" ] },
{ uri: uri12, title: "foo.bar", tags: [ "foo.bar" ], style: [ "tag" ] } ]
matches: [ { uri: uri9, title: "title", tags: [ "foo.bar" ], style: [ "bookmark-tag" ] },
{ uri: uri10, title: "foo.bar", tags: [ "foo.bar" ], style: [ "bookmark-tag" ] },
{ uri: uri11, title: "title", tags: [ "foo.bar" ], style: [ "bookmark-tag" ] },
{ uri: uri12, title: "foo.bar", tags: [ "foo.bar" ], style: [ "bookmark-tag" ] } ]
});
do_log_info("foo * ~ -> is star, is typed");
yield check_autocomplete({
search: "foo * ~",
matches: [ { uri: uri11, title: "title", tags: [ "foo.bar" ], style: [ "tag" ] } ]
matches: [ { uri: uri11, title: "title", tags: [ "foo.bar" ], style: [ "bookmark-tag" ] } ]
});
do_log_info("foo # @ -> in title, in url");
@ -393,10 +393,10 @@ add_task(function* test_special_searches() {
{ uri: uri6, title: "foo.bar", style: [ "bookmark" ] },
{ uri: uri7, title: "title", style: [ "bookmark" ] },
{ uri: uri8, title: "foo.bar", style: [ "bookmark" ] },
{ uri: uri9, title: "title", tags: [ "foo.bar" ], style: [ "tag" ] },
{ uri: uri10, title: "foo.bar", tags: [ "foo.bar" ], style: [ "tag" ] },
{ uri: uri11, title: "title", tags: [ "foo.bar"], style: [ "tag" ] },
{ uri: uri12, title: "foo.bar", tags: [ "foo.bar" ], style: [ "tag" ] } ]
{ uri: uri9, title: "title", tags: [ "foo.bar" ], style: [ "bookmark-tag" ] },
{ uri: uri10, title: "foo.bar", tags: [ "foo.bar" ], style: [ "bookmark-tag" ] },
{ uri: uri11, title: "title", tags: [ "foo.bar"], style: [ "bookmark-tag" ] },
{ uri: uri12, title: "foo.bar", tags: [ "foo.bar" ], style: [ "bookmark-tag" ] } ]
});
do_log_info("foo -> default history, is star, is typed");
@ -407,7 +407,7 @@ add_task(function* test_special_searches() {
yield check_autocomplete({
search: "foo",
matches: [ { uri: uri4, title: "foo.bar" },
{ uri: uri11, title: "title", tags: [ "foo.bar" ], style: [ "tag" ] } ]
{ uri: uri11, title: "title", tags: [ "foo.bar" ], style: [ "bookmark-tag" ] } ]
});
do_log_info("foo -> is star");
@ -419,10 +419,10 @@ add_task(function* test_special_searches() {
matches: [ { uri: uri6, title: "foo.bar", style: [ "bookmark" ] },
{ uri: uri7, title: "title", style: [ "bookmark" ] },
{ uri: uri8, title: "foo.bar", style: [ "bookmark" ] },
{ uri: uri9, title: "title", tags: [ "foo.bar" ], style: [ "tag" ] },
{ uri: uri10, title: "foo.bar", tags: [ "foo.bar" ], style: [ "tag" ] },
{ uri: uri11, title: "title", tags: [ "foo.bar" ], style: [ "tag" ] },
{ uri: uri12, title: "foo.bar", tags: [ "foo.bar" ], style: [ "tag" ] } ]
{ uri: uri9, title: "title", tags: [ "foo.bar" ], style: [ "bookmark-tag" ] },
{ uri: uri10, title: "foo.bar", tags: [ "foo.bar" ], style: [ "bookmark-tag" ] },
{ uri: uri11, title: "title", tags: [ "foo.bar" ], style: [ "bookmark-tag" ] },
{ uri: uri12, title: "foo.bar", tags: [ "foo.bar" ], style: [ "bookmark-tag" ] } ]
});
do_log_info("foo -> is star, is typed");
@ -435,10 +435,10 @@ add_task(function* test_special_searches() {
matches: [ { uri: uri6, title: "foo.bar", style: [ "bookmark" ] },
{ uri: uri7, title: "title", style: [ "bookmark" ] },
{ uri: uri8, title: "foo.bar", style: [ "bookmark" ] },
{ uri: uri9, title: "title", tags: [ "foo.bar" ], style: [ "tag" ] },
{ uri: uri10, title: "foo.bar", tags: [ "foo.bar" ], style: [ "tag" ] },
{ uri: uri11, title: "title", tags: [ "foo.bar" ], style: [ "tag" ] },
{ uri: uri12, title: "foo.bar", tags: [ "foo.bar" ], style: [ "tag" ] } ]
{ uri: uri9, title: "title", tags: [ "foo.bar" ], style: [ "bookmark-tag" ] },
{ uri: uri10, title: "foo.bar", tags: [ "foo.bar" ], style: [ "bookmark-tag" ] },
{ uri: uri11, title: "title", tags: [ "foo.bar" ], style: [ "bookmark-tag" ] },
{ uri: uri12, title: "foo.bar", tags: [ "foo.bar" ], style: [ "bookmark-tag" ] } ]
});
yield cleanup();

View File

@ -52,7 +52,7 @@ add_task(function* test_escape() {
search: "match",
matches: [ { uri: uri1, title: "title1" },
{ uri: uri3, title: "matchme2" },
{ uri: uri5, title: "title1", tags: [ "matchme2" ], style: [ "tag" ] },
{ uri: uri5, title: "title1", tags: [ "matchme2" ], style: [ "bookmark-tag" ] },
{ uri: uri10, title: "title1" } ]
});
@ -61,7 +61,7 @@ add_task(function* test_escape() {
search: "dont",
matches: [ { uri: uri2, title: "title1" },
{ uri: uri4, title: "dontmatchme3" },
{ uri: uri6, title: "title1", tags: [ "dontmatchme3" ], style: [ "tag" ] } ]
{ uri: uri6, title: "title1", tags: [ "dontmatchme3" ], style: [ "bookmark-tag" ] } ]
});
do_log_info("Match 'match' at the beginning or after / or on a CamelCase");
@ -69,8 +69,8 @@ add_task(function* test_escape() {
search: "2",
matches: [ { uri: uri3, title: "matchme2" },
{ uri: uri4, title: "dontmatchme3" },
{ uri: uri5, title: "title1", tags: [ "matchme2" ], style: [ "tag" ] },
{ uri: uri6, title: "title1", tags: [ "dontmatchme3" ], style: [ "tag" ] } ]
{ uri: uri5, title: "title1", tags: [ "matchme2" ], style: [ "bookmark-tag" ] },
{ uri: uri6, title: "title1", tags: [ "dontmatchme3" ], style: [ "bookmark-tag" ] } ]
});
do_log_info("Match 't' at the beginning or after /");
@ -80,8 +80,8 @@ add_task(function* test_escape() {
{ uri: uri2, title: "title1" },
{ uri: uri3, title: "matchme2" },
{ uri: uri4, title: "dontmatchme3" },
{ uri: uri5, title: "title1", tags: [ "matchme2" ], style: [ "tag" ] },
{ uri: uri6, title: "title1", tags: [ "dontmatchme3" ], style: [ "tag" ] },
{ uri: uri5, title: "title1", tags: [ "matchme2" ], style: [ "bookmark-tag" ] },
{ uri: uri6, title: "title1", tags: [ "dontmatchme3" ], style: [ "bookmark-tag" ] },
{ uri: uri10, title: "title1" } ]
});
@ -98,8 +98,8 @@ add_task(function* test_escape() {
{ uri: uri2, title: "title1" },
{ uri: uri3, title: "matchme2" },
{ uri: uri4, title: "dontmatchme3" },
{ uri: uri5, title: "title1", tags: [ "matchme2" ], style: [ "tag" ] },
{ uri: uri6, title: "title1", tags: [ "dontmatchme3" ], style: [ "tag" ] },
{ uri: uri5, title: "title1", tags: [ "matchme2" ], style: [ "bookmark-tag" ] },
{ uri: uri6, title: "title1", tags: [ "dontmatchme3" ], style: [ "bookmark-tag" ] },
{ uri: uri7, title: "!@#$%^&*()_+{}|:<>?word" },
{ uri: uri8, title: katakana.join("") },
{ uri: uri9, title: ideograph.join("") },
@ -164,8 +164,8 @@ add_task(function* test_escape() {
{ uri: uri2, title: "title1" },
{ uri: uri3, title: "matchme2" },
{ uri: uri4, title: "dontmatchme3" },
{ uri: uri5, title: "title1", tags: [ "matchme2" ], style: [ "tag" ] },
{ uri: uri6, title: "title1", tags: [ "dontmatchme3" ], style: [ "tag" ] },
{ uri: uri5, title: "title1", tags: [ "matchme2" ], style: [ "bookmark-tag" ] },
{ uri: uri6, title: "title1", tags: [ "dontmatchme3" ], style: [ "bookmark-tag" ] },
{ uri: uri10, title: "title1" } ]
});

View File

@ -1596,6 +1596,7 @@ extends="chrome://global/content/bindings/popup.xml#popup">
// we need extra stuff.
this._extraBox.hidden = true;
this._titleBox.flex = 1;
this._typeImage.hidden = false;
this.removeAttribute("actiontype");
this.classList.remove("overridable-action");
@ -1681,7 +1682,7 @@ extends="chrome://global/content/bindings/popup.xml#popup">
type = [...types].join(" ");
// If we have a tag match, show the tags and icon
if (type == "tag") {
if (type == "tag" || type == "bookmark-tag") {
// Configure the extra box for tags display
this._extraBox.hidden = false;
this._extraBox.childNodes[0].hidden = false;
@ -1699,8 +1700,13 @@ extends="chrome://global/content/bindings/popup.xml#popup">
// Emphasize the matching text in the tags
this._setUpDescription(this._extra, sortedTags);
// Treat tagged matches as bookmarks for the star
type = "bookmark";
// If we're suggesting bookmarks, then treat tagged matches as
// bookmarks for the star.
if (type == "bookmark-tag") {
type = "bookmark";
} else {
this._typeImage.hidden = true;
}
// keyword and favicon type results for search engines
// have an extra magnifying glass icon after them
} else if (type == "keyword" || (initialTypes.has("search") &&