зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1461695 change tabs.onUpdated filter name to isArticle, r=aswan
MozReview-Commit-ID: Ha0nJPMTYkJ --HG-- extra : rebase_source : b9950ea7b4a2a52b45b1023b51ba87612aad86af
This commit is contained in:
Родитель
17c3a96af9
Коммит
69e769ac8a
|
@ -126,7 +126,7 @@ const allProperties = new Set([
|
|||
"discarded",
|
||||
"favIconUrl",
|
||||
"hidden",
|
||||
"isarticle",
|
||||
"isArticle",
|
||||
"mutedInfo",
|
||||
"pinned",
|
||||
"sharingState",
|
||||
|
@ -150,6 +150,12 @@ class TabsUpdateFilterEventManager extends EventManager {
|
|||
// Default is to listen for all events.
|
||||
needsModified = filter.properties.some(p => allAttrs.has(p));
|
||||
filter.properties = new Set(filter.properties);
|
||||
// TODO Bug 1465520 remove warning when ready.
|
||||
if (filter.properties.has("isarticle")) {
|
||||
extension.logger.warn("The isarticle filter name is deprecated, use isArticle.");
|
||||
filter.properties.delete("isarticle");
|
||||
filter.properties.add("isArticle");
|
||||
}
|
||||
} else {
|
||||
filter.properties = allProperties;
|
||||
}
|
||||
|
@ -297,7 +303,7 @@ class TabsUpdateFilterEventManager extends EventManager {
|
|||
windowTracker.addListener(name, listener);
|
||||
}
|
||||
|
||||
if (filter.properties.has("isarticle")) {
|
||||
if (filter.properties.has("isArticle")) {
|
||||
tabTracker.on("tab-isarticle", isArticleChangeListener);
|
||||
}
|
||||
|
||||
|
@ -306,7 +312,7 @@ class TabsUpdateFilterEventManager extends EventManager {
|
|||
windowTracker.removeListener(name, listener);
|
||||
}
|
||||
|
||||
if (filter.properties.has("isarticle")) {
|
||||
if (filter.properties.has("isArticle")) {
|
||||
tabTracker.off("tab-isarticle", isArticleChangeListener);
|
||||
}
|
||||
};
|
||||
|
|
|
@ -298,6 +298,7 @@
|
|||
"favIconUrl",
|
||||
"hidden",
|
||||
"isarticle",
|
||||
"isArticle",
|
||||
"mutedInfo",
|
||||
"pinned",
|
||||
"sharingState",
|
||||
|
|
|
@ -199,6 +199,59 @@ add_task(async function test_filter_windowId() {
|
|||
await BrowserTestUtils.removeTab(tab);
|
||||
});
|
||||
|
||||
// TODO Bug 1465520 test should be removed when filter name is.
|
||||
add_task(async function test_filter_isarticle_deprecated() {
|
||||
let extension = ExtensionTestUtils.loadExtension({
|
||||
manifest: {
|
||||
permissions: ["tabs"],
|
||||
},
|
||||
background() {
|
||||
// We expect only status updates, anything else is a failure.
|
||||
browser.tabs.onUpdated.addListener((tabId, changeInfo) => {
|
||||
browser.test.log(`got onUpdated ${JSON.stringify(changeInfo)}`);
|
||||
if ("isArticle" in changeInfo) {
|
||||
browser.test.notifyPass("isarticle");
|
||||
}
|
||||
}, {properties: ["isarticle"]});
|
||||
},
|
||||
});
|
||||
await extension.startup();
|
||||
let ok = extension.awaitFinish("isarticle");
|
||||
|
||||
let tab = await BrowserTestUtils.openNewForegroundTab(gBrowser, "http://mochi.test:8888/");
|
||||
await ok;
|
||||
|
||||
await extension.unload();
|
||||
|
||||
await BrowserTestUtils.removeTab(tab);
|
||||
});
|
||||
|
||||
add_task(async function test_filter_isArticle() {
|
||||
let extension = ExtensionTestUtils.loadExtension({
|
||||
manifest: {
|
||||
permissions: ["tabs"],
|
||||
},
|
||||
background() {
|
||||
// We expect only status updates, anything else is a failure.
|
||||
browser.tabs.onUpdated.addListener((tabId, changeInfo) => {
|
||||
browser.test.log(`got onUpdated ${JSON.stringify(changeInfo)}`);
|
||||
if ("isArticle" in changeInfo) {
|
||||
browser.test.notifyPass("isArticle");
|
||||
}
|
||||
}, {properties: ["isArticle"]});
|
||||
},
|
||||
});
|
||||
await extension.startup();
|
||||
let ok = extension.awaitFinish("isArticle");
|
||||
|
||||
let tab = await BrowserTestUtils.openNewForegroundTab(gBrowser, "http://mochi.test:8888/");
|
||||
await ok;
|
||||
|
||||
await extension.unload();
|
||||
|
||||
await BrowserTestUtils.removeTab(tab);
|
||||
});
|
||||
|
||||
add_task(async function test_filter_property() {
|
||||
let extension = ExtensionTestUtils.loadExtension({
|
||||
manifest: {
|
||||
|
@ -211,7 +264,7 @@ add_task(async function test_filter_property() {
|
|||
"discarded",
|
||||
"favIconUrl",
|
||||
"hidden",
|
||||
"isarticle",
|
||||
"isArticle",
|
||||
"mutedInfo",
|
||||
"pinned",
|
||||
"sharingState",
|
||||
|
|
Загрузка…
Ссылка в новой задаче