New issue
Advanced search Search tips

Issue 809822 link

Starred by 1 user

Issue metadata

Status: Available
Owner: ----
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux , Windows , Chrome , Mac
Pri: 3
Type: Bug



Sign in to add a comment

chrome.windows.getLastFocused appears incorrect

Project Member Reported by rdevlin....@chromium.org, Feb 7 2018

Issue description

  // The WindowControllerList should contain a list of application,
  // browser and devtools windows.
  WindowController* controller = nullptr;
  for (auto* iter : WindowControllerList::GetInstance()->windows()) {
    if (windows_util::CanOperateOnWindow(this, iter,
                                         extractor.type_filters())) {
      controller = iter;  << ?????
      if (controller->window()->IsActive())
        break;  // Use focused window.
    }
  }

From https://chromium.googlesource.com/chromium/src/+/5859322791875be6f682139f736a090b58339c55/chrome/browser/extensions/api/tabs/tabs_api.cc

It appears that in the for loop above, if there was no last focused window, we'd return whichever was last in the loop.  From a quick experiment, this seems to be the case.
 
Finally, someone noticed this function is broken... :)
I reported this issue almost 3 years ago: https://crbug.com/546696


Sign in to add a comment