зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1705751: fix Remove Buildsettings Code from Screenshots r=emalysz
Differential Revision: https://phabricator.services.mozilla.com/D112415
This commit is contained in:
Родитель
959874613b
Коммит
728a6f9073
|
@ -3,7 +3,7 @@
|
|||
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
/* globals log */
|
||||
/* globals main, makeUuid, deviceInfo, analytics, catcher, buildSettings, communication, browser */
|
||||
/* globals main, makeUuid, deviceInfo, analytics, catcher, communication, browser */
|
||||
|
||||
"use strict";
|
||||
|
||||
|
@ -177,7 +177,7 @@ this.auth = (function() {
|
|||
};
|
||||
|
||||
exports.getSentryPublicDSN = function() {
|
||||
return sentryPublicDSN || buildSettings.defaultSentryDsn;
|
||||
return sentryPublicDSN;
|
||||
};
|
||||
|
||||
exports.getAbTests = function() {
|
||||
|
|
|
@ -2,12 +2,13 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
/* globals browser, getStrings, selectorLoader, analytics, communication, catcher, log, makeUuid, auth, senderror, startBackground, blobConverters buildSettings, startSelectionWithOnboarding */
|
||||
/* globals browser, getStrings, selectorLoader, analytics, communication, catcher, log, makeUuid, auth, senderror, startBackground, blobConverters, startSelectionWithOnboarding */
|
||||
|
||||
"use strict";
|
||||
|
||||
this.main = (function() {
|
||||
const exports = {};
|
||||
const pngToJpegCutoff = 2500000;
|
||||
|
||||
const { sendEvent, incrementCount } = analytics;
|
||||
|
||||
|
@ -182,8 +183,7 @@ this.main = (function() {
|
|||
canvas.getContext("2d").putImageData(imageData, 0, 0);
|
||||
let dataUrl = canvas.toDataURL();
|
||||
if (
|
||||
buildSettings.pngToJpegCutoff &&
|
||||
dataUrl.length > buildSettings.pngToJpegCutoff
|
||||
dataUrl.length > pngToJpegCutoff
|
||||
) {
|
||||
const jpegDataUrl = canvas.toDataURL("image/jpeg");
|
||||
if (jpegDataUrl.length < dataUrl.length) {
|
||||
|
|
|
@ -15,7 +15,6 @@ this.selectorLoader = (function() {
|
|||
// These modules are loaded in order, first standardScripts and then selectorScripts
|
||||
// The order is important due to dependencies
|
||||
const standardScripts = [
|
||||
"build/buildSettings.js",
|
||||
"log.js",
|
||||
"catcher.js",
|
||||
"assertIsTrusted.js",
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
/* globals browser, communication, shot, main, auth, catcher, analytics, buildSettings, blobConverters, thumbnailGenerator */
|
||||
/* globals browser, communication, shot, main, auth, catcher, analytics, blobConverters, thumbnailGenerator */
|
||||
|
||||
"use strict";
|
||||
|
||||
|
|
|
@ -1,14 +0,0 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
window.buildSettings = {
|
||||
defaultSentryDsn: "",
|
||||
logLevel: "" || "warn",
|
||||
captureText: "" === "true",
|
||||
uploadBinary: "" === "true",
|
||||
pngToJpegCutoff: parseInt("" || 2500000, 10),
|
||||
maxImageHeight: parseInt("" || 10000, 10),
|
||||
maxImageWidth: parseInt("" || 10000, 10),
|
||||
};
|
||||
null;
|
|
@ -9,17 +9,15 @@
|
|||
|
||||
this.log = (function() {
|
||||
const exports = {};
|
||||
const logLevel = "warn";
|
||||
|
||||
const levels = ["debug", "info", "warn", "error"];
|
||||
if (!levels.includes(buildSettings.logLevel)) {
|
||||
console.warn("Invalid buildSettings.logLevel:", buildSettings.logLevel);
|
||||
}
|
||||
const shouldLog = {};
|
||||
|
||||
{
|
||||
let startLogging = false;
|
||||
for (const level of levels) {
|
||||
if (buildSettings.logLevel === level) {
|
||||
if (logLevel === level) {
|
||||
startLogging = true;
|
||||
}
|
||||
if (startLogging) {
|
||||
|
|
|
@ -15,7 +15,6 @@
|
|||
"l10n_resources": [ "browser/screenshots.ftl" ],
|
||||
"background": {
|
||||
"scripts": [
|
||||
"build/buildSettings.js",
|
||||
"background/startBackground.js"
|
||||
]
|
||||
},
|
||||
|
@ -31,7 +30,6 @@
|
|||
{
|
||||
"matches": ["https://screenshots.firefox.com/*"],
|
||||
"js": [
|
||||
"build/buildSettings.js",
|
||||
"log.js",
|
||||
"catcher.js",
|
||||
"selector/callBackground.js",
|
||||
|
|
|
@ -38,7 +38,6 @@ FINAL_TARGET_FILES.features["screenshots@mozilla.org"]["background"] += [
|
|||
]
|
||||
|
||||
FINAL_TARGET_FILES.features["screenshots@mozilla.org"]["build"] += [
|
||||
"build/buildSettings.js",
|
||||
"build/inlineSelectionCss.js",
|
||||
"build/raven.js",
|
||||
"build/selection.js",
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
/* globals global, browser, documentMetadata, util, uicontrol, ui, catcher */
|
||||
/* globals buildSettings, domainFromUrl, randomString, shot, blobConverters */
|
||||
/* globals domainFromUrl, randomString, shot, blobConverters */
|
||||
|
||||
"use strict";
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
/* globals browser, log, util, catcher, inlineSelectionCss, callBackground, assertIsTrusted, assertIsBlankDocument, buildSettings blobConverters */
|
||||
/* globals browser, log, util, catcher, inlineSelectionCss, callBackground, assertIsTrusted, assertIsBlankDocument, blobConverters */
|
||||
|
||||
"use strict";
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
/* globals log, catcher, util, ui, slides, global */
|
||||
/* globals shooter, callBackground, selectorLoader, assertIsTrusted, buildSettings, selection */
|
||||
/* globals shooter, callBackground, selectorLoader, assertIsTrusted, selection */
|
||||
|
||||
"use strict";
|
||||
|
||||
|
@ -49,8 +49,8 @@ this.uicontrol = (function() {
|
|||
|
||||
const { watchFunction, watchPromise } = catcher;
|
||||
|
||||
const MAX_PAGE_HEIGHT = buildSettings.maxImageHeight;
|
||||
const MAX_PAGE_WIDTH = buildSettings.maxImageWidth;
|
||||
const MAX_PAGE_HEIGHT = 10000;
|
||||
const MAX_PAGE_WIDTH = 10000;
|
||||
// An autoselection smaller than these will be ignored entirely:
|
||||
const MIN_DETECT_ABSOLUTE_HEIGHT = 10;
|
||||
const MIN_DETECT_ABSOLUTE_WIDTH = 30;
|
||||
|
|
|
@ -13,7 +13,7 @@ const L10N = new LocalizationHelper(STRINGS_URI);
|
|||
// These values are used to truncate the resulting image if the captured area is bigger.
|
||||
// This is to avoid failing to produce a screenshot at all.
|
||||
// It is recommended to keep these values in sync with the corresponding screenshots addon
|
||||
// values in /browser/extensions/screenshots/build/buildSettings.js
|
||||
// values in /browser/extensions/screenshots/selector/uicontrol.js
|
||||
const MAX_IMAGE_WIDTH = 10000;
|
||||
const MAX_IMAGE_HEIGHT = 10000;
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче