Speculative fix for getCurrentTabURL #1753
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I am hoping this will fix #1214, but since the repro is particularly tricky, we won't know until later.
I believe is ultimately a chrome bug that's behavior is here: 546696 - chrome.windows.getLastFocused returns the last opened window, not the last focused, when an extension popup is visible - chromium but essentially its interplay between extensions with
onFocusChanged
getLastFocused
and here,chrome.tabs.query({lastFocusedWindow: true})
..Of note, previous to the currentTab change in #680 I don't believe we had this bug, but we did have trouble when debugging the extension background page with a devtools window. I'm OK with regressing our developer ergonomics to get this user bug squashed.
http://stackoverflow.com/a/28794338 (by Rob W) describes the best solution to be:
The best practices around getting current tab have changed throughout the past 7 years, and there appear to be some still open bugs, so this is what we're running up against.
This PR adds extra error logging around all this so we'll have more information if the problem persists.