Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Speculative fix for getCurrentTabURL #1753

Merged
merged 3 commits into from
Feb 21, 2017
Merged

Speculative fix for getCurrentTabURL #1753

merged 3 commits into from
Feb 21, 2017

Conversation

paulirish
Copy link
Member

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:

chrome.tabs.query({
    active: true,
    currentWindow: true    
}

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.

return this._queryCurrentTab().then(tab => tab.url);
return this._queryCurrentTab().then(tab => {
if (!tab.url) {
log.error('ExtensionConnection', 'getCurrentTabURL returned empty string', tab);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is logging the tab obj going to be useful?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeterminable

@paulirish paulirish merged commit e5ad8cb into master Feb 21, 2017
@paulirish paulirish deleted the must-provide-url-ers branch February 21, 2017 23:26
@paulirish
Copy link
Member Author

@mblayman re #1745. would you be willing to see if this PR fixes things for you?

I've uploaded a build of the extension and attached to this comment. You can load it in developer mode (and disable the other lighthouse) to give it a try.

➡️ lighthouse-1.5.99999.zip

@mblayman
Copy link

@paulirish I just tried the extension you supplied and I still have the same behavior for https://storybird.com. It hits the same timeout that I reported in #1745. 🤔

@paulirish
Copy link
Member Author

okay thanks for giving it a go!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Extension Error: You must provide a url to the driver
4 participants