Skip to content

Commit

Permalink
explicitly set tab title for url updates in tabs-api
Browse files Browse the repository at this point in the history
  • Loading branch information
stanislav-atr committed Sep 4, 2023
1 parent c8c7fe6 commit e9e12ec
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,12 @@ export class TabContext {
* @param changeInfo Tab change info.
*/
public updateTabInfo(changeInfo: Tabs.OnUpdatedChangeInfoType): void {
this.info = Object.assign(this.info, changeInfo);
const isChangingUrl = changeInfo.status === 'loading' && changeInfo.url && !changeInfo.title;
this.info = Object.assign(this.info, {
...changeInfo,
// Tab might change url w/o changing title, but browser.tabs.onUpdated is not providing title removal event
...(isChangingUrl && { title: changeInfo.url }),
});

// If the tab was updated it means that it wasn't used to send requests in the background.
this.isSyntheticTab = false;
Expand Down

0 comments on commit e9e12ec

Please sign in to comment.