Bug 1471383 - Use iconURL.href and add test r=Felipe

Differential Revision: https://phabricator.services.mozilla.com/D2081

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Michael Kaply 2018-07-19 15:04:06 +00:00
parent efde274619
commit 4b5277cf2f
2 changed files with 11 additions and 3 deletions

View File

@ -710,7 +710,7 @@ var Policies = {
for (let newEngine of param.Add) {
let newEngineParameters = {
template: newEngine.URLTemplate,
iconURL: newEngine.IconURL,
iconURL: newEngine.IconURL ? newEngine.IconURL.href : null,
alias: newEngine.Alias,
description: newEngine.Description,
method: newEngine.Method,

View File

@ -194,6 +194,8 @@ add_task(async function test_AddSearchProvider() {
});
add_task(async function test_install_and_remove() {
let iconURL = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNk+A8AAQUBAScY42YAAAAASUVORK5CYII=";
is(Services.search.getEngineByName("Foo"), null,
"Engine \"Foo\" should not be present when test starts");
@ -203,7 +205,8 @@ add_task(async function test_install_and_remove() {
"Add": [
{
"Name": "Foo",
"URLTemplate": "http://example.com/?q={searchTerms}"
"URLTemplate": "http://example.com/?q={searchTerms}",
"IconURL": iconURL
}
]
}
@ -211,9 +214,14 @@ add_task(async function test_install_and_remove() {
});
// If this passes, it means that the new search engine was properly installed
isnot(Services.search.getEngineByName("Foo"), null,
let engine = Services.search.getEngineByName("Foo");
isnot(engine, null,
"Specified search engine should be installed");
is(engine.wrappedJSObject.iconURI.spec, iconURL,
"Icon should be present");
await setupPolicyEngineWithJson({
"policies": {
"SearchEngines": {