Inconsistent behaviour of the browser.tabs.onUpdated callback

By design Issue #10246170


Andrey M.
Dec 16, 2016
This issue is public.
Reported by 3 people

Sign in to watch or report this issue.

Steps to reproduce

onUpdated callback receives inconsistent params:

Steps to reproduce

Create extension with this code:

function handleUpdated(tabId) {
  console.log("Updated tab: " + tabId);

function handleCreated(tab) {
  console.log("Created tab:" +;

  1. Open new tab
  2. Enter and press enter

Expected result

We should receive the same tabId for each call.

Actual result

// Tab is created
Created tab: 10
Updated tab: 10
Updated tab: 10
// Navigating to in the same tab, tabId has changed for no reason
Updated tab: 11


0 attachments

    Comments and activity

    • Microsoft Edge Team

      Changed Assigned To to “Sebastian P.”

      Changed Assigned To from “Sebastian P.” to “Akshay P.”

      Changed Assigned To from “Akshay P.” to “Mohit R.”

      Changed Status to “Confirmed”

    • Same happened for me but with onBeforeRequest

      browser.webRequest.onBeforeRequest.addListener((event) => {
        console.log(event.tabId, event.url)
      }, {
        urls: [""],
        types: ["main_frame"]

      then if I redirect to where it executes redirect in the same tab via location.href = 'http://...' I’m getting updated tabId;

    • Microsoft Edge Team

      Changed Assigned To to “Akshay P.”

      Changed Assigned To to “Akshay P.”

      Changed Assigned To from “Akshay P.” to “Scott L.”

      Changed Status from “Confirmed” to “By design”

    • Thanks for filing this bug! I investigated more and it turns out that this occurs due to what’s called a virtual tab switch. Edge will do this (for example) when switching between the new tab page/start page and internet pages, as well as when navigating across the internet/intranet boundary. A workaround is to add a tabs.onReplaced() listener which will fire when a virtual tab switch occurs. In the parameter to the callback will be the id of the tab that was removed as well as the new tab id that was generated. 

    You need to sign in to your Microsoft account to add a comment.

    Sign in