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
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion js/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -1457,7 +1457,7 @@ function getDebugInfo() {
// Is this installed build of CatBlock the official one?
// TODO: Replace ID's by getting info, how the extension was installed
function AdBlockBuild() {
if (!SAFARI && !FIREFOX) {
if (CHROME || OPERA) {
if (chrome.runtime.id === "mdcgnhlfpnbeieiiccmebgkfdebafodo" ||
chrome.runtime.id === "pejeadkbfbppoaoinpmkeonebmngpnkk") {
return "Stable";
Expand Down
3 changes: 2 additions & 1 deletion js/functions.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
// Set to true to get noisier console.log statements
var VERBOSE_DEBUG = false;

// Global variable for detection of Opera, Edge and Firefox
// Global variable for browser detection
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.


// Edge uses "browser" namespace for its API
if (EDGE) {
Expand Down