1
0
mirror of https://github.com/golang/go synced 2024-11-26 17:56:55 -07:00
go/misc/chrome/gophertool/background.js
ramenjuniti f9dd99cae3 misc/chrome/gophertool: replace deprecated tabs.getSelected method
tabs.getSelected has been deprecated since Chrome 33. Instead,
use tabs.query.

Fixes #35663

Change-Id: I4f7f17f948987aff8409ac8210f04eb1f7ebf908
Reviewed-on: https://go-review.googlesource.com/c/go/+/207402
Reviewed-by: Andrew Bonventre <andybons@golang.org>
2019-11-18 18:14:37 +00:00

10 lines
286 B
JavaScript

chrome.omnibox.onInputEntered.addListener(function(t) {
var url = urlForInput(t);
if (url) {
chrome.tabs.query({ "active": true, "currentWindow": true }, function(tab) {
if (!tab) return;
chrome.tabs.update(tab.id, { "url": url, "selected": true });
});
}
});