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

Get build info from chrome.management API #113

Merged
merged 16 commits into from
Jan 14, 2017
Merged

Get build info from chrome.management API #113

merged 16 commits into from
Jan 14, 2017

Conversation

tomasko126
Copy link
Member

This fixes #105

@kpeckett Could you please test and verify? Thanks!

Signed-off-by: Tomáš Taro <tomas@getadblock.com>
Signed-off-by: Tomáš Taro <tomas@getadblock.com>
return "Beta";
} else if (chrome.runtime.id === "gighmmpiobklfepjocnamgkkbiglidom" ||
chrome.runtime.id === "aobdicepooefnbaeokijohmhjlleamfj") {
if (!SAFARI && !FIREFOX) {
Copy link
Member

Choose a reason for hiding this comment

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

In case of future browsers, could we not use a new CHROME constant instead, as this would otherwise become a !SAFARI && !FIREFOX && !EDGE just to check for CHROME || OPERA

@itskdog itskdog assigned tomasko126 and unassigned itskdog Dec 6, 2016
Signed-off-by: Tomáš Taro <tomas@getadblock.com>
@tomasko126 tomasko126 assigned itskdog and unassigned tomasko126 Dec 6, 2016
var OPERA = navigator.userAgent.indexOf("OPR") > -1;
var EDGE = navigator.userAgent.indexOf("Edge") > -1;
var FIREFOX = navigator.userAgent.indexOf("Firefox") > -1;
var CHROME = !OPERA && !EDGE && !FIREFOX && !SAFARI; // SAFARI is defined in port.js
Copy link
Member

Choose a reason for hiding this comment

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

Is there really no reliable way of detecting if it's Chrome without just assuming it's the default?

Copy link
Member Author

Choose a reason for hiding this comment

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

@kpeckett This is the safest way, how to detect Chrome afaik.

…installed

Signed-off-by: Tomáš Taro <tomas@getadblock.com>
Signed-off-by: Tomáš Taro <tomas@getadblock.com>
Signed-off-by: Tomáš Taro <tomas@getadblock.com>
Signed-off-by: Tomáš Taro <tomas@getadblock.com>
Signed-off-by: Tomáš Taro <tomas@getadblock.com>
Signed-off-by: Tomáš Taro <tomas@getadblock.com>
Signed-off-by: Tomáš Taro <tomas@getadblock.com>
@tomasko126 tomasko126 changed the title Update extension's ID in order to obtain right build info Get build info from chrome.management API Jan 10, 2017
Signed-off-by: Tomáš Taro <tomas@getadblock.com>
@tomasko126
Copy link
Member Author

@kpeckett Please take a look, and review. Thanks!

callback("Developer");
} else {
callback("Unsupported");
}
Copy link
Member

Choose a reason for hiding this comment

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

This isn't handling potential future copies, which is what the original code was made for.

Copy link
Member Author

Choose a reason for hiding this comment

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

@kpeckett You are right, I will add chrome.runtime.id handling in the next commit.

Copy link
Member Author

Choose a reason for hiding this comment

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

@kpeckett Please review changes in the latest commit (handling potential future copies).

Signed-off-by: Tomáš Taro <tomas@getadblock.com>
Signed-off-by: Tomáš Taro <tomas@getadblock.com>
Copy link
Member

@itskdog itskdog left a comment

Choose a reason for hiding this comment

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

I'm still getting "Developer" showing when I change the manifest to give it the right extension ID for the stable version. Any ideas?

@@ -1491,16 +1498,17 @@ function getDebugInfo(callback) {
return the_debug_info;
}

if (!SAFARI) {
if (!SAFARI && !EDGE) {
Copy link
Member

Choose a reason for hiding this comment

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

Could simplify to !(SAFARI || EDGE) by De Morgan's Law. Might save a single CPU cycle? 😛

Signed-off-by: Tomáš Taro <tomas@getadblock.com>
@tomasko126
Copy link
Member Author

@kpeckett We are checking, how our extension was installed as well. So if you've added an exact ID of the extension to the manifest file and the extension was installed from an unpacked environment, CatBlock will still report that you are using a "Developer" version of the extension :)

Signed-off-by: Tomáš Taro <tomas@getadblock.com>
Signed-off-by: Tomáš Taro <tomas@getadblock.com>
@tomasko126 tomasko126 merged commit 3a908d2 into master Jan 14, 2017
@tomasko126 tomasko126 deleted the build-info branch January 14, 2017 15:19
@tomasko126 tomasko126 modified the milestone: 1.5 Jan 14, 2017
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.

Debug info lists CWS version as "Developer"
2 participants