Skip to content
This repository was archived by the owner on Jan 4, 2019. It is now read-only.

skip over master brave window when querying brave/browser-laptop#8811 #195

Merged
merged 1 commit into from
Jun 7, 2017

Conversation

kevinlawler
Copy link
Contributor

No description provided.

Copy link
Collaborator

@jonathansampson jonathansampson left a comment

Choose a reason for hiding this comment

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

It may be better to filter on the tab's windowId value. The main Brave window will have a value of -1 while all other tabs should have a positive value. @bridiver, is this correct?

@kevinlawler
Copy link
Contributor Author

kevinlawler commented May 12, 2017

One of the issues with that is -1 already indicates WINDOW_ID_NONE. Normally I would agree, but in this instance it's probably better to filter on something more definitively unique to the main Brave window. (Perhaps it should have a special key set on its object.) That said, -1 will (should) still work if we decide to change it.

@jonathansampson
Copy link
Collaborator

@kevinlawler I'm not 100% .url.indexOf('chrome://') will match only the Brave frame. We could also check that the title matches /^brave$/i to be certain.

{
    "active": false,
    "audible": false,
    "autoDiscardable": true,
    "discarded": false,
    "height": 1050,
    "highlighted": false,
    "id": 1,
    "incognito": true,
    "index": -1,
    "mutedInfo": {
        "muted": false,
        "reason": "user"
    },
    "pinned": false,
    "selected": false,
    "status": "complete",
    "title": "Brave",
    "url": "chrome://brave/C:/Users/jjdsa/AppData/Local/brave/app-0.15.303/resources/app.asar/app/extensions/brave/index.html",
    "width": 1922,
    "windowId": -1
}

@kevinlawler
Copy link
Contributor Author

OK, I'll match against -1 then unless there are objections.

Matching against title=="Brave" I think gives us the same problem before: false positives are improbable but a possible bug nonetheless.

@jonathansampson
Copy link
Collaborator

jonathansampson commented May 12, 2017

I wasn't suggesting a single check, but rather "chrome://" and "Brave" 🙂 Either one alone could yield false positives indeed. Well, "chrome://" may not—I'm not sure.

Checking the windowId may be safe, but I could be wrong. If it is safe, it's going to be a lot faster than testing two strings. @bridiver or @bbondy may know definitively if any other tab should ever have a windowId value of -1.

@kevinlawler kevinlawler force-pushed the 8811-chrome-tabs-query branch from e69fba7 to 9b2a14d Compare May 12, 2017 18:57
@kevinlawler kevinlawler requested a review from bridiver May 22, 2017 16:33
@bridiver
Copy link
Collaborator

definitely not save to check for indexOf('chrome://'), but indexOf('chrome://brave') would be safe

@jonathansampson
Copy link
Collaborator

jonathansampson commented May 22, 2017

Thanks, @bridiver. @kevinlawler, how about filtering on tab.url.startsWith('chrome://brave/')?

@kevinlawler kevinlawler force-pushed the 8811-chrome-tabs-query branch from 9b2a14d to b3eaedc Compare June 1, 2017 22:25
filter master brave window on windowId when querying brave/browser-laptop#8811

ignore the main window
@kevinlawler kevinlawler force-pushed the 8811-chrome-tabs-query branch from b3eaedc to ede6ea5 Compare June 1, 2017 22:28
@bridiver
Copy link
Collaborator

bridiver commented Jun 6, 2017

sorry I've let this one sit forever. Is this safe to merge for the next build? Doesn't require any browser-laptop changes?

@jonathansampson
Copy link
Collaborator

@bridiver No changes to browser-laptop.

@bridiver
Copy link
Collaborator

bridiver commented Jun 7, 2017

ok, I'll merge and look at removing the TabHelper instead when I have time

@bridiver bridiver merged commit df9ab60 into master Jun 7, 2017
@jonathansampson
Copy link
Collaborator

Resolves brave/browser-laptop#8822.

@bridiver, do you know when this should appear in preview builds? Still repros for me in 0.19.0 (brave/browser-laptop@c5968c5).

@bridiver
Copy link
Collaborator

bridiver commented Jun 18, 2017 via email

@bsclifton bsclifton deleted the 8811-chrome-tabs-query branch June 18, 2018 18:12
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants