зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1538378 - Test that tabs.onCreated fires with active:true. r=mixedpuppy
Differential Revision: https://phabricator.services.mozilla.com/D24819 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
feb4f8fa49
Коммит
43c358adc7
|
@ -471,8 +471,8 @@ class TabTracker extends TabTrackerBase {
|
|||
};
|
||||
|
||||
// We need to delay sending this event until the next tick, since the
|
||||
// tab could have been created with a lazy browser but still not have
|
||||
// been assigned a SessionStore tab state with the URL and title.
|
||||
// tab can become selected immediately after "TabOpen", then onCreated
|
||||
// should be fired with `active: true`.
|
||||
Promise.resolve().then(() => {
|
||||
if (!event.originalTarget.parentNode) {
|
||||
// If the tab is already be destroyed, do nothing.
|
||||
|
|
|
@ -222,6 +222,7 @@ skip-if = (verify && !debug && (os == 'mac'))
|
|||
[browser_ext_tabs_move_window.js]
|
||||
[browser_ext_tabs_move_window_multiple.js]
|
||||
[browser_ext_tabs_move_window_pinned.js]
|
||||
[browser_ext_tabs_onCreated.js]
|
||||
[browser_ext_tabs_onHighlighted.js]
|
||||
[browser_ext_tabs_onUpdated.js]
|
||||
[browser_ext_tabs_onUpdated_filter.js]
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
/* -*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- */
|
||||
/* vim: set sts=2 sw=2 et tw=80: */
|
||||
/* eslint-disable mozilla/no-arbitrary-setTimeout */
|
||||
"use strict";
|
||||
|
||||
add_task(async function test_onCreated_active() {
|
||||
let extension = ExtensionTestUtils.loadExtension({
|
||||
manifest: {
|
||||
"permissions": ["tabs"],
|
||||
},
|
||||
background: function() {
|
||||
browser.tabs.onCreated.addListener(tab => {
|
||||
browser.tabs.remove(tab.id);
|
||||
browser.test.sendMessage("onCreated", tab);
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
await extension.startup();
|
||||
BrowserOpenTab();
|
||||
|
||||
let tab = await extension.awaitMessage("onCreated");
|
||||
is(true, tab.active, "Tab should be active");
|
||||
|
||||
await extension.unload();
|
||||
});
|
Загрузка…
Ссылка в новой задаче