[Chromium extension] Remove the special handling of the "disableTelemetry" preference
With the changes made in the previous patch, we can now list "disableTelemetry" in the `AppOptions` only for the `CHROME`-builds and thus remove the special-casing in the `checkChromePreferencesFile` helper function.
This commit is contained in:
parent
b48dc06148
commit
18bc59eb34
16
gulpfile.js
16
gulpfile.js
@ -289,8 +289,7 @@ function getVersionJSON() {
|
|||||||
|
|
||||||
function checkChromePreferencesFile(chromePrefsPath, webPrefs) {
|
function checkChromePreferencesFile(chromePrefsPath, webPrefs) {
|
||||||
const chromePrefs = JSON.parse(fs.readFileSync(chromePrefsPath).toString());
|
const chromePrefs = JSON.parse(fs.readFileSync(chromePrefsPath).toString());
|
||||||
let chromePrefsKeys = Object.keys(chromePrefs.properties);
|
const chromePrefsKeys = Object.keys(chromePrefs.properties).filter(key => {
|
||||||
chromePrefsKeys = chromePrefsKeys.filter(function (key) {
|
|
||||||
const description = chromePrefs.properties[key].description;
|
const description = chromePrefs.properties[key].description;
|
||||||
// Deprecated keys are allowed in the managed preferences file.
|
// Deprecated keys are allowed in the managed preferences file.
|
||||||
// The code maintained is responsible for adding migration logic to
|
// The code maintained is responsible for adding migration logic to
|
||||||
@ -301,15 +300,9 @@ function checkChromePreferencesFile(chromePrefsPath, webPrefs) {
|
|||||||
|
|
||||||
const webPrefsKeys = Object.keys(webPrefs);
|
const webPrefsKeys = Object.keys(webPrefs);
|
||||||
webPrefsKeys.sort();
|
webPrefsKeys.sort();
|
||||||
const telemetryIndex = chromePrefsKeys.indexOf("disableTelemetry");
|
|
||||||
if (telemetryIndex >= 0) {
|
|
||||||
chromePrefsKeys.splice(telemetryIndex, 1);
|
|
||||||
} else {
|
|
||||||
console.log("Warning: disableTelemetry key not found in chrome prefs!");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (webPrefsKeys.length !== chromePrefsKeys.length) {
|
if (webPrefsKeys.length !== chromePrefsKeys.length) {
|
||||||
console.log("Warning: Prefs objects haven't the same length");
|
console.log("Warning: Pref objects doesn't have the same length.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -324,7 +317,8 @@ function checkChromePreferencesFile(chromePrefsPath, webPrefs) {
|
|||||||
} else if (chromePrefs.properties[value].default !== webPrefs[value]) {
|
} else if (chromePrefs.properties[value].default !== webPrefs[value]) {
|
||||||
ret = false;
|
ret = false;
|
||||||
console.log(
|
console.log(
|
||||||
`Warning: not the same values: ${chromePrefs.properties[value].default} !== ${webPrefs[value]}`
|
`Warning: not the same values (for "${value}"): ` +
|
||||||
|
`${chromePrefs.properties[value].default} !== ${webPrefs[value]}`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -271,6 +271,11 @@ if (
|
|||||||
kind: OptionKind.VIEWER,
|
kind: OptionKind.VIEWER,
|
||||||
};
|
};
|
||||||
} else if (PDFJSDev.test("CHROME")) {
|
} else if (PDFJSDev.test("CHROME")) {
|
||||||
|
defaultOptions.disableTelemetry = {
|
||||||
|
/** @type {boolean} */
|
||||||
|
value: false,
|
||||||
|
kind: OptionKind.VIEWER + OptionKind.PREFERENCE,
|
||||||
|
};
|
||||||
defaultOptions.sandboxBundleSrc = {
|
defaultOptions.sandboxBundleSrc = {
|
||||||
/** @type {string} */
|
/** @type {string} */
|
||||||
value: "../build/pdf.sandbox.js",
|
value: "../build/pdf.sandbox.js",
|
||||||
|
Loading…
Reference in New Issue
Block a user