DominicMaas / TimelineExtension

Windows Timeline & Project Rome Web Extension
MIT License
482 stars 27 forks source link

Firefox popout closure work-around #69

Open da2x opened 6 years ago

da2x commented 6 years ago
// COMPAT: popouts can’t be window.close() on Firefox for Android, Moving focus
// back to the active tab (the popout is never active) will close the popout.
function closePopOut()
{
  browser.runtime.getPlatformInfo().then(
    function(platformInfo)
    {
      if (platformInfo.os == 'android')
        browser.tabs.update({active: true});
      else
        window.close();
    },
    window.close
  );
}

https://www.ctrl.blog/entry/firefox-browseraction-close-popout-android

DominicMaas commented 6 years ago

browser.tabs.update({active: true}); does not appear to be valid? (at least TypeScript complains about needing two arguments, tabId and updateProperties). Seems to be happy with chrome.tabs.update({active: true}); for Chrome.

da2x commented 5 years ago

You don’t need to specify tab id here.