зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1599205 Part 2: fix onChange event details object r=zombie
Differential Revision: https://phabricator.services.mozilla.com/D54639 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
234c7eb128
Коммит
38d51e8a42
|
@ -561,9 +561,7 @@ this.ExtensionPreferencesManager = {
|
|||
name: `${name}.onChange`,
|
||||
register: fire => {
|
||||
let listener = async () => {
|
||||
fire.async({
|
||||
details: await settingsAPI.get({}),
|
||||
});
|
||||
fire.async(await settingsAPI.get({}));
|
||||
};
|
||||
Management.on(`extension-setting-changed:${name}`, listener);
|
||||
return () => {
|
||||
|
|
|
@ -253,10 +253,8 @@ this.browserSettings = class extends ExtensionAPI {
|
|||
register: fire => {
|
||||
let listener = () => {
|
||||
fire.async({
|
||||
details: {
|
||||
levelOfControl: "not_controllable",
|
||||
value: Services.prefs.getStringPref(HOMEPAGE_URL_PREF),
|
||||
},
|
||||
});
|
||||
};
|
||||
Services.prefs.addObserver(HOMEPAGE_URL_PREF, listener);
|
||||
|
@ -304,10 +302,8 @@ this.browserSettings = class extends ExtensionAPI {
|
|||
register: fire => {
|
||||
let listener = (text, id) => {
|
||||
fire.async({
|
||||
details: {
|
||||
levelOfControl: "not_controllable",
|
||||
value: aboutNewTabService.newTabURL,
|
||||
},
|
||||
});
|
||||
};
|
||||
Services.obs.addObserver(listener, "newtab-url-changed");
|
||||
|
|
|
@ -119,10 +119,8 @@ this.captivePortal = class extends ExtensionAPI {
|
|||
register: fire => {
|
||||
let listener = (text, id) => {
|
||||
fire.async({
|
||||
details: {
|
||||
levelOfControl: "not_controllable",
|
||||
value: Services.prefs.getStringPref(CAPTIVE_URL_PREF),
|
||||
},
|
||||
});
|
||||
};
|
||||
Services.prefs.addObserver(CAPTIVE_URL_PREF, listener);
|
||||
|
|
|
@ -48,7 +48,7 @@ add_task(async function test_browser_settings() {
|
|||
if (!listeners.has(apiName)) {
|
||||
apiObj.onChange.addListener(details => {
|
||||
browser.test.sendMessage("onChange", {
|
||||
details: details.details,
|
||||
details,
|
||||
setting: apiName,
|
||||
});
|
||||
});
|
||||
|
|
|
@ -4,6 +4,9 @@
|
|||
|
||||
add_task(async function test_url_get_without_set() {
|
||||
async function background() {
|
||||
browser.captivePortal.canonicalURL.onChange.addListener(details => {
|
||||
browser.test.sendMessage("url", details);
|
||||
});
|
||||
let url = await browser.captivePortal.canonicalURL.get({});
|
||||
browser.test.sendMessage("url", url);
|
||||
}
|
||||
|
@ -30,5 +33,21 @@ add_task(async function test_url_get_without_set() {
|
|||
"The canonicalURL setting has the expected levelOfControl."
|
||||
);
|
||||
|
||||
Services.prefs.setStringPref(
|
||||
"captivedetect.canonicalURL",
|
||||
"http://example.com"
|
||||
);
|
||||
url = await extension.awaitMessage("url");
|
||||
equal(
|
||||
url.value,
|
||||
"http://example.com",
|
||||
"The canonicalURL setting has the expected value."
|
||||
);
|
||||
equal(
|
||||
url.levelOfControl,
|
||||
"not_controllable",
|
||||
"The canonicalURL setting has the expected levelOfControl."
|
||||
);
|
||||
|
||||
await extension.unload();
|
||||
});
|
||||
|
|
Загрузка…
Ссылка в новой задаче