我开发了一个Chrome 扩展程序,它在 Chrome 39 中运行良好,但在Ubuntu 14.04(64 位)上的 Opera developer 24 中出现错误。
响应 tabs.query 时出错:TypeError: Cannot read property 'id' of undefined at HTMLLIElement.click
所以我chrome.tabs.query
在两个浏览器控制台上进行了测试:
chrome.tabs.query(
{ active: true, highlighted: true, currentWindow: true },
function(thisTab) {
console.log(thisTab);
}
);
在 Chrome 中,它返回一个完整的Tab
对象。
但在 Opera 中,它返回一个空白数组[]
。
为什么会这样?