mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-23 21:01:08 +00:00
Bug 1697392 - Fix logging when a remte search suggestion fails. r=mak
Differential Revision: https://phabricator.services.mozilla.com/D172371
This commit is contained in:
parent
4feaf446ef
commit
a19160c918
@ -649,7 +649,7 @@ export class SearchSuggestionController {
|
||||
};
|
||||
|
||||
for (let resultData of suggestResults) {
|
||||
if (typeof result === "string") {
|
||||
if (typeof resultData === "string") {
|
||||
// Failure message
|
||||
console.error(
|
||||
"SearchSuggestionController found an unexpected string value: " +
|
||||
|
@ -39,6 +39,14 @@ var getEngine, postEngine, unresolvableEngine, alternateJSONEngine;
|
||||
|
||||
add_task(async function setup() {
|
||||
Services.prefs.setBoolPref("browser.search.suggest.enabled", true);
|
||||
// These tests intentionally test broken connections.
|
||||
consoleAllowList = consoleAllowList.concat([
|
||||
"Non-200 status or empty HTTP response: 404",
|
||||
"Non-200 status or empty HTTP response: 500",
|
||||
"Unexpected response, searchString does not match remote response",
|
||||
"HTTP request timeout",
|
||||
"HTTP error",
|
||||
]);
|
||||
|
||||
let server = useHttpServer();
|
||||
server.registerContentType("sjs", "sjs");
|
||||
|
@ -57,6 +57,8 @@ function countCookieEntries() {
|
||||
return cookieCount;
|
||||
}
|
||||
|
||||
let engines;
|
||||
|
||||
add_task(async function setup() {
|
||||
await AddonTestUtils.promiseStartupManager();
|
||||
|
||||
@ -76,7 +78,7 @@ add_task(async function setup() {
|
||||
server.registerContentType("sjs", "sjs");
|
||||
|
||||
let unicodeName = ["\u30a8", "\u30c9"].join("");
|
||||
let engines = [
|
||||
engines = [
|
||||
await SearchTestUtils.promiseNewSearchEngine({
|
||||
url: `${gDataUrl}engineMaker.sjs?${JSON.stringify({
|
||||
baseURL: gDataUrl,
|
||||
@ -99,15 +101,19 @@ add_task(async function setup() {
|
||||
);
|
||||
Assert.equal(await countCacheEntries(), 0, "The cache should be empty");
|
||||
Assert.equal(await countCookieEntries(), 0, "Should not find any cookie");
|
||||
|
||||
await test_engine(engines, true);
|
||||
await test_engine(engines, false);
|
||||
});
|
||||
|
||||
async function test_engine(engines, privateMode) {
|
||||
add_task(async function test_private_mode() {
|
||||
await test_engine(true);
|
||||
});
|
||||
add_task(async function test_normal_mode() {
|
||||
await test_engine(false);
|
||||
});
|
||||
|
||||
async function test_engine(privateMode) {
|
||||
info(`Testing ${privateMode ? "private" : "normal"} mode`);
|
||||
let controller = new SearchSuggestionController();
|
||||
let result = await controller.fetch("test", privateMode, engines[0]);
|
||||
let result = await controller.fetch("no results", privateMode, engines[0]);
|
||||
Assert.equal(result.local.length, 0, "Should have no local suggestions");
|
||||
Assert.equal(result.remote.length, 0, "Should have no remote suggestions");
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user