fix: Wrong OS Identification In Vivaldi Browser#158
Open
bytrangle wants to merge 1 commit intosteipete:mainfrom
Open
fix: Wrong OS Identification In Vivaldi Browser#158bytrangle wants to merge 1 commit intosteipete:mainfrom
bytrangle wants to merge 1 commit intosteipete:mainfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Problem Description
When I installed the extension for Vivaldi browser, the token was not generated and I got error "Not supported on this OS yet". That's unexpected, since I'm using Linux and Vivaldi runs on Chromium. I thought the extension should have been able to identify the OS in Vivaldi.
When I install the extension for Chrome, the token was generated.
So the problem probably lied with Vivaldi.
What Happened Under The Hood
When installing an extension in Vivaldi and inspecting the html page, the
window.navigator.userAgentDatahas these values:The
resolvePlatformfunction uses a nullish coalescing operator, souserAgentData.platformas an empty string is not null and it still gets used.So in the end
resolvePlatformreturnsother.Please note that
userAgentData.platformonly returns an empty string in the extension context. If you open a normal web page in Vivaldi and accessuserAgentData.platform, it will return the same values as Chrome.What Were Changed
Ensure that
userAgentData.platformis not only defined but also not empty. If it is, fall back tonavigator.platform, thennavigator.userAgent.