// Based on crbug 1365104 report by Vitor Torres var url = 'https://alesandroortiz.com/security/chromium/crbug-1365104.html'; // Enable debug to see under-the-hood return values of GetLastActive() and IsActive() var debug = false; // If on Canary, set this to true for longer delay var isCanary = false; isCanary = true; if (isCanary) { url = url + '?canary'; } var width = 1100; var height = 800; if (debug) { setInterval(() => { console.info('----'); // For all methods, `focused` property uses IsActive() under the hood // getLastFocused() uses GetLastActive() under the hood chrome.windows.getLastFocused((win) => { console.info('getLastFocused response:', win.id, win.focused, win); }); chrome.windows.getCurrent((win) => { console.info('getCurrent response:', win.id, win.focused, win); }); chrome.windows.getAll((wins) => { console.info('getAll response:', wins); }); }, 2000); } chrome.runtime.onMessageExternal.addListener((request, sender, sendResponse) => { if (request.action == 'openWindow') { chrome.windows.create({ url: 'https://alesandroortiz.com/security/chromium/crbug-1365104-instructions.html', focused: false, // Optional: Offset position to see active window // top: 300, // left: 400 }); sendResponse('Opened window.'); } }); chrome.runtime.onInstalled.addListener(() => { console.info('Extension running.'); chrome.windows.create({url: url, width: width, height: height}, (win) => { console.info('Opened window:', win.id); }); });