browser.tabs.get(Number('5'), callback) doesn't work in Edge

By design Issue #11183879

Details

Author
Adolf D.
Created
Mar 6, 2017
Privacy
This issue is public.
Reports
Reported by 1 person

Sign in to watch or report this issue.

Steps to reproduce

browser.tabs.get() API is treating Number(‘5’) different than parseInt('5’, 10).

In our code, we were converting a “string” number (like ‘5’) to an integer using Number(string) but it fails with “Invalid Input” error for browser.tabs.get() API. It works fine only if we use parseInt('5’, 10).

// this works
browser.tabs.getCurrent(function(tab) {
// works
browser.tabs.get(tab.id, function(tab) {
console.log("tab Id: " + tab.id);
});
var strTabId = “” + tab.id;
// works
browser.tabs.get(parseInt(strTabId, 10), function(tab) {
console.log("tab Id: " + tab.id);
});

// doesn't work. throws "invalid input" error
browser.tabs.get(Number(strTabId), function(tab) {
  console.log("tab Id: " + tab.id);
});

});

What is the difference between the two usage in terms of browser.tabs.get()?

Attachments

1 attachment

Comments and activity

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

Sign in