diff --git a/devtools/client/aboutdebugging/test/browser_tabs.js b/devtools/client/aboutdebugging/test/browser_tabs.js index 8cdeef17d6bf..e82090607fa5 100644 --- a/devtools/client/aboutdebugging/test/browser_tabs.js +++ b/devtools/client/aboutdebugging/test/browser_tabs.js @@ -42,6 +42,10 @@ add_task(function* () { yield waitForContentMutation(newTabTarget); } + // Then wait for title update, but on slow test runner, the title may already + // be set to the expected value + yield waitUntil(() => newTabTarget.title === TAB_URL); + // Check that the new tab appears in the UI is(newTabTarget.textContent, "foo", "The tab title got updated"); is(newTabTarget.title, TAB_URL, "The tab tooltip is the url"); diff --git a/devtools/server/actors/root.js b/devtools/server/actors/root.js index 108ca57ffda5..ffaa2c78b88a 100644 --- a/devtools/server/actors/root.js +++ b/devtools/server/actors/root.js @@ -250,6 +250,12 @@ RootActor.prototype = { message: "This root actor has no browser tabs." }; } + /* + * Now that a client has requested the list of tabs, we reattach the onListChanged + * listener in order to be notified if the list of tabs changes again in the future. + */ + tabList.onListChanged = this._onTabListChanged; + /* * Walk the tab list, accumulating the array of tab actors for the * reply, and moving all the actors to a new ActorPool. We'll @@ -300,13 +306,6 @@ RootActor.prototype = { /* DebuggerServer.addGlobalActor support: name actors in 'listTabs' reply. */ this._appendExtraActors(reply); - /* - * Now that we're actually going to report the contents of tabList to - * the client, we're responsible for letting the client know if it - * changes. - */ - tabList.onListChanged = this._onTabListChanged; - return reply; }); },