зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1905864 - Generate a PDF.js default-prefs file that can be used directly in mozilla-central. r=pdfjs-reviewers,geckoview-reviewers,frontend-codestyle-reviewers,calixte,ohall
Differential Revision: https://phabricator.services.mozilla.com/D215481
This commit is contained in:
Родитель
f950ed5891
Коммит
7cf779bd22
|
@ -261,6 +261,8 @@ toolkit/mozapps/extensions/test/xpcshell/data/test_AddonRepository_fail.json
|
|||
toolkit/components/pdfjs/content/build
|
||||
toolkit/components/pdfjs/content/web
|
||||
|
||||
toolkit/components/pdfjs/PdfJsOverridePrefs.js
|
||||
|
||||
# Uses preprocessing
|
||||
toolkit/components/reader/Readerable.sys.mjs
|
||||
|
||||
|
|
|
@ -1520,7 +1520,8 @@ security/manager/tools/KnownRootHashes.json
|
|||
security/manager/tools/PreloadedHPKPins.json
|
||||
services/settings/dumps/
|
||||
toolkit/components/nimbus/schemas/NimbusExperiment.schema.json
|
||||
toolkit/components/pdfjs/content/PdfJsDefaultPreferences.sys.mjs
|
||||
toolkit/components/pdfjs/PdfJsDefaultPrefs.js
|
||||
toolkit/components/pdfjs/PdfJsOverridePrefs.js
|
||||
toolkit/components/uniffi-js/UniFFIGeneratedScaffolding.cpp
|
||||
toolkit/components/uniffi-js/UniFFIFixtureScaffolding.cpp
|
||||
toolkit/components/uniffi-bindgen-gecko-js/fixtures/generated
|
||||
|
|
|
@ -26,7 +26,6 @@ ChromeUtils.defineESModuleGetters(lazy, {
|
|||
BookmarksPolicies: "resource:///modules/policies/BookmarksPolicies.sys.mjs",
|
||||
CustomizableUI: "resource:///modules/CustomizableUI.sys.mjs",
|
||||
FileUtils: "resource://gre/modules/FileUtils.sys.mjs",
|
||||
PdfJsDefaultPreferences: "resource://pdf.js/PdfJsDefaultPreferences.sys.mjs",
|
||||
ProxyPolicies: "resource:///modules/policies/ProxyPolicies.sys.mjs",
|
||||
UrlbarPrefs: "resource:///modules/UrlbarPrefs.sys.mjs",
|
||||
WebsiteFilter: "resource:///modules/policies/WebsiteFilter.sys.mjs",
|
||||
|
@ -1967,26 +1966,6 @@ export var Policies = {
|
|||
throw new Error(`Non-integer value for ${preference}`);
|
||||
}
|
||||
|
||||
// Because pdfjs prefs are set async, we can't check the
|
||||
// default pref branch to see if they are int or bool, so we
|
||||
// have to get their type from PdfJsDefaultPreferences.
|
||||
if (preference.startsWith("pdfjs.")) {
|
||||
let preferenceTail = preference.replace("pdfjs.", "");
|
||||
if (
|
||||
preferenceTail in lazy.PdfJsDefaultPreferences &&
|
||||
typeof lazy.PdfJsDefaultPreferences[preferenceTail] ==
|
||||
"number"
|
||||
) {
|
||||
prefBranch.setIntPref(preference, param[preference].Value);
|
||||
} else {
|
||||
prefBranch.setBoolPref(
|
||||
preference,
|
||||
!!param[preference].Value
|
||||
);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
// This is ugly, but necessary. On Windows GPO and macOS
|
||||
// configs, booleans are converted to 0/1. In the previous
|
||||
// Preferences implementation, the schema took care of
|
||||
|
|
|
@ -209,8 +209,6 @@
|
|||
@RESPATH@/browser/chrome.manifest
|
||||
@RESPATH@/browser/chrome/browser@JAREXT@
|
||||
@RESPATH@/browser/chrome/browser.manifest
|
||||
@RESPATH@/chrome/pdfjs.manifest
|
||||
@RESPATH@/chrome/pdfjs/*
|
||||
@RESPATH@/chrome/toolkit@JAREXT@
|
||||
@RESPATH@/chrome/toolkit.manifest
|
||||
#ifdef MOZ_GTK
|
||||
|
@ -231,6 +229,11 @@
|
|||
@RESPATH@/browser/chrome/devtools.manifest
|
||||
@RESPATH@/browser/@PREF_DIR@/debugger.js
|
||||
|
||||
; PdfJs
|
||||
@RESPATH@/chrome/pdfjs.manifest
|
||||
@RESPATH@/chrome/pdfjs/*
|
||||
@RESPATH@/defaults/pref/PdfJsDefaultPrefs.js
|
||||
|
||||
; shell icons
|
||||
#ifdef XP_UNIX
|
||||
#ifndef XP_MACOSX
|
||||
|
|
|
@ -377,12 +377,6 @@ pref("network.protocol-handler.warn-external.vnd.youtube", false);
|
|||
// (bug 888268)
|
||||
pref("network.tickle-wifi.enabled", true);
|
||||
|
||||
// Editing PDFs is not supported on mobile
|
||||
pref("pdfjs.annotationEditorMode", -1);
|
||||
|
||||
// Enable the floating PDF.js toolbar on GeckoView (bug 1829366)
|
||||
pref("pdfjs.enableFloatingToolbar", true);
|
||||
|
||||
// Try to convert PDFs sent as octet-stream (bug 1754499)
|
||||
pref("pdfjs.handleOctetStream", true);
|
||||
|
||||
|
|
|
@ -174,33 +174,6 @@ pref("browser.helperApps.deleteTempFileOnExit", false);
|
|||
|
||||
pref("browser.triple_click_selects_paragraph", true);
|
||||
|
||||
// Enable fillable forms in the PDF viewer.
|
||||
pref("pdfjs.annotationMode", 2);
|
||||
|
||||
// Enable editing in the PDF viewer.
|
||||
pref("pdfjs.annotationEditorMode", 0);
|
||||
|
||||
// Enable JavaScript support in the PDF viewer.
|
||||
pref("pdfjs.enableScripting", true);
|
||||
|
||||
// Enable XFA form support in the PDF viewer.
|
||||
pref("pdfjs.enableXfa", true);
|
||||
|
||||
// Enable adding an image in a pdf.
|
||||
pref("pdfjs.enableStampEditor", true);
|
||||
|
||||
// Enable highlighting in a pdf.
|
||||
pref("pdfjs.enableHighlightEditor", true);
|
||||
#if defined(EARLY_BETA_OR_EARLIER)
|
||||
pref("pdfjs.enableHighlightFloatingButton", true);
|
||||
#else
|
||||
pref("pdfjs.enableHighlightFloatingButton", false);
|
||||
#endif
|
||||
|
||||
#if defined(XP_WIN)
|
||||
pref("pdfjs.enableHWA", true);
|
||||
#endif
|
||||
|
||||
// Disable support for MathML
|
||||
pref("mathml.disabled", false);
|
||||
|
||||
|
|
|
@ -0,0 +1,53 @@
|
|||
/* Copyright 2024 Mozilla Foundation
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
// THIS FILE IS GENERATED AUTOMATICALLY, DO NOT EDIT MANUALLY!
|
||||
//
|
||||
// Any overrides should be placed in `PdfJsOverridePrefs.js`.
|
||||
|
||||
pref("pdfjs.annotationEditorMode", 0);
|
||||
pref("pdfjs.annotationMode", 2);
|
||||
pref("pdfjs.cursorToolOnLoad", 0);
|
||||
pref("pdfjs.defaultZoomDelay", 400);
|
||||
pref("pdfjs.defaultZoomValue", "");
|
||||
pref("pdfjs.disableAutoFetch", false);
|
||||
pref("pdfjs.disableFontFace", false);
|
||||
pref("pdfjs.disablePageLabels", false);
|
||||
pref("pdfjs.disableRange", false);
|
||||
pref("pdfjs.disableStream", false);
|
||||
pref("pdfjs.enableHWA", false);
|
||||
pref("pdfjs.enableHighlightEditor", false);
|
||||
pref("pdfjs.enableHighlightFloatingButton", false);
|
||||
pref("pdfjs.enableML", false);
|
||||
pref("pdfjs.enablePermissions", false);
|
||||
pref("pdfjs.enablePrintAutoRotate", true);
|
||||
pref("pdfjs.enableScripting", true);
|
||||
pref("pdfjs.enableStampEditor", true);
|
||||
pref("pdfjs.enableXfa", true);
|
||||
pref("pdfjs.externalLinkTarget", 0);
|
||||
pref("pdfjs.forcePageColors", false);
|
||||
pref("pdfjs.highlightEditorColors", "yellow=#FFFF98,green=#53FFBC,blue=#80EBFF,pink=#FFCBE6,red=#FF4F5F");
|
||||
pref("pdfjs.historyUpdateUrl", false);
|
||||
pref("pdfjs.ignoreDestinationZoom", false);
|
||||
pref("pdfjs.pageColorsBackground", "Canvas");
|
||||
pref("pdfjs.pageColorsForeground", "CanvasText");
|
||||
pref("pdfjs.pdfBugEnabled", false);
|
||||
pref("pdfjs.scrollModeOnLoad", -1);
|
||||
pref("pdfjs.sidebarViewOnLoad", -1);
|
||||
pref("pdfjs.spreadModeOnLoad", -1);
|
||||
pref("pdfjs.textLayerMode", 1);
|
||||
pref("pdfjs.viewOnLoad", 0);
|
||||
|
||||
#include PdfJsOverridePrefs.js
|
|
@ -0,0 +1,53 @@
|
|||
/* Copyright 2024 Mozilla Foundation
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#if defined(ANDROID)
|
||||
|
||||
// Editing PDFs is not supported on mobile
|
||||
pref("pdfjs.annotationEditorMode", -1);
|
||||
|
||||
// Enable the floating PDF.js toolbar on GeckoView (bug 1829366)
|
||||
pref("pdfjs.enableFloatingToolbar", true);
|
||||
|
||||
#else
|
||||
|
||||
// Enable fillable forms in the PDF viewer.
|
||||
pref("pdfjs.annotationMode", 2);
|
||||
|
||||
// Enable editing in the PDF viewer.
|
||||
pref("pdfjs.annotationEditorMode", 0);
|
||||
|
||||
// Enable JavaScript support in the PDF viewer.
|
||||
pref("pdfjs.enableScripting", true);
|
||||
|
||||
// Enable XFA form support in the PDF viewer.
|
||||
pref("pdfjs.enableXfa", true);
|
||||
|
||||
// Enable adding an image in a pdf.
|
||||
pref("pdfjs.enableStampEditor", true);
|
||||
|
||||
// Enable highlighting in a pdf.
|
||||
pref("pdfjs.enableHighlightEditor", true);
|
||||
#if defined(EARLY_BETA_OR_EARLIER)
|
||||
pref("pdfjs.enableHighlightFloatingButton", true);
|
||||
#else
|
||||
pref("pdfjs.enableHighlightFloatingButton", false);
|
||||
#endif
|
||||
|
||||
#if defined(XP_WIN)
|
||||
pref("pdfjs.enableHWA", true);
|
||||
#endif
|
||||
|
||||
#endif
|
|
@ -36,35 +36,6 @@ XPCOMUtils.defineLazyServiceGetter(
|
|||
"@mozilla.org/uriloader/handler-service;1",
|
||||
"nsIHandlerService"
|
||||
);
|
||||
const lazy = {};
|
||||
ChromeUtils.defineESModuleGetters(lazy, {
|
||||
PdfJsDefaultPreferences: "resource://pdf.js/PdfJsDefaultPreferences.sys.mjs",
|
||||
});
|
||||
|
||||
function initializeDefaultPreferences() {
|
||||
var defaultBranch = Services.prefs.getDefaultBranch("pdfjs.");
|
||||
var defaultValue;
|
||||
for (var key in lazy.PdfJsDefaultPreferences) {
|
||||
// Skip prefs that are already defined, so we can enable/disable things
|
||||
// in all.js.
|
||||
let prefType = defaultBranch.getPrefType(key);
|
||||
if (prefType !== Ci.nsIPrefBranch.PREF_INVALID) {
|
||||
continue;
|
||||
}
|
||||
defaultValue = lazy.PdfJsDefaultPreferences[key];
|
||||
switch (typeof defaultValue) {
|
||||
case "boolean":
|
||||
defaultBranch.setBoolPref(key, defaultValue);
|
||||
break;
|
||||
case "number":
|
||||
defaultBranch.setIntPref(key, defaultValue);
|
||||
break;
|
||||
case "string":
|
||||
defaultBranch.setCharPref(key, defaultValue);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// We're supposed to get this type of thing from the OS, and generally we do.
|
||||
// But doing so is expensive, so on startup paths we can use this to make the
|
||||
|
@ -117,8 +88,6 @@ export var PdfJs = {
|
|||
|
||||
// Listen for when a different pdf handler is chosen.
|
||||
Services.obs.addObserver(this, TOPIC_PDFJS_HANDLER_CHANGED);
|
||||
|
||||
initializeDefaultPreferences();
|
||||
},
|
||||
|
||||
uninit: function uninit() {
|
||||
|
|
|
@ -1,53 +0,0 @@
|
|||
/* Copyright 2023 Mozilla Foundation
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
//
|
||||
// THIS FILE IS GENERATED AUTOMATICALLY, DO NOT EDIT MANUALLY!
|
||||
//
|
||||
|
||||
export const PdfJsDefaultPreferences = Object.freeze({
|
||||
annotationEditorMode: 0,
|
||||
annotationMode: 2,
|
||||
cursorToolOnLoad: 0,
|
||||
defaultZoomDelay: 400,
|
||||
defaultZoomValue: "",
|
||||
disablePageLabels: false,
|
||||
enableHighlightEditor: false,
|
||||
enableHighlightFloatingButton: false,
|
||||
enableML: false,
|
||||
enablePermissions: false,
|
||||
enablePrintAutoRotate: true,
|
||||
enableScripting: true,
|
||||
enableStampEditor: true,
|
||||
externalLinkTarget: 0,
|
||||
highlightEditorColors: "yellow=#FFFF98,green=#53FFBC,blue=#80EBFF,pink=#FFCBE6,red=#FF4F5F",
|
||||
historyUpdateUrl: false,
|
||||
ignoreDestinationZoom: false,
|
||||
forcePageColors: false,
|
||||
pageColorsBackground: "Canvas",
|
||||
pageColorsForeground: "CanvasText",
|
||||
pdfBugEnabled: false,
|
||||
sidebarViewOnLoad: -1,
|
||||
scrollModeOnLoad: -1,
|
||||
spreadModeOnLoad: -1,
|
||||
textLayerMode: 1,
|
||||
viewOnLoad: 0,
|
||||
disableAutoFetch: false,
|
||||
disableFontFace: false,
|
||||
disableRange: false,
|
||||
disableStream: false,
|
||||
enableHWA: false,
|
||||
enableXfa: true
|
||||
});
|
|
@ -1,7 +1,6 @@
|
|||
pdfjs.jar:
|
||||
% resource pdf.js %content/
|
||||
content/PdfJs.sys.mjs (content/PdfJs.sys.mjs)
|
||||
content/PdfJsDefaultPreferences.sys.mjs (content/PdfJsDefaultPreferences.sys.mjs)
|
||||
content/PdfJsNetwork.sys.mjs (content/PdfJsNetwork.sys.mjs)
|
||||
content/PdfJsTelemetry.sys.mjs (content/PdfJsTelemetry.sys.mjs)
|
||||
content/PdfSandbox.sys.mjs (content/PdfSandbox.sys.mjs)
|
||||
|
|
|
@ -16,6 +16,10 @@ EXTRA_JS_MODULES += [
|
|||
"pdfjs.sys.mjs",
|
||||
]
|
||||
|
||||
JS_PREFERENCE_PP_FILES += [
|
||||
"PdfJsDefaultPrefs.js",
|
||||
]
|
||||
|
||||
XPCOM_MANIFESTS += [
|
||||
"components.conf",
|
||||
]
|
||||
|
|
|
@ -37,7 +37,7 @@ popd || exit
|
|||
mkdir -p "$ROOT/build/mozcentral/browser/extensions/pdfjs/"
|
||||
|
||||
cp "$ROOT/build/mozcentral/browser/extensions/pdfjs/content/LICENSE" "$GECKO_PATH/toolkit/components/pdfjs/"
|
||||
cp "$ROOT/build/mozcentral/browser/extensions/pdfjs/content/PdfJsDefaultPreferences.sys.mjs" "$GECKO_PATH/toolkit/components/pdfjs/content/PdfJsDefaultPreferences.sys.mjs"
|
||||
cp "$ROOT/build/mozcentral/browser/extensions/pdfjs/PdfJsDefaultPrefs.js" "$GECKO_PATH/toolkit/components/pdfjs/PdfJsDefaultPrefs.js"
|
||||
rsync -a -v --delete "$ROOT/build/mozcentral/browser/extensions/pdfjs/content/build/" "$GECKO_PATH/toolkit/components/pdfjs/content/build/"
|
||||
rsync -a -v --delete "$ROOT/build/mozcentral/browser/extensions/pdfjs/content/web/" "$GECKO_PATH/toolkit/components/pdfjs/content/web/"
|
||||
|
||||
|
|
|
@ -85,7 +85,7 @@ security/manager/tools/KnownRootHashes.json
|
|||
security/manager/tools/PreloadedHPKPins.json
|
||||
services/settings/dumps/
|
||||
toolkit/components/nimbus/schemas/NimbusExperiment.schema.json
|
||||
toolkit/components/pdfjs/content/PdfJsDefaultPreferences.sys.mjs
|
||||
toolkit/components/pdfjs/PdfJsDefaultPrefs.js
|
||||
toolkit/components/uniffi-js/UniFFIGeneratedScaffolding.cpp
|
||||
toolkit/components/uniffi-js/UniFFIFixtureScaffolding.cpp
|
||||
toolkit/components/uniffi-bindgen-gecko-js/fixtures/generated
|
||||
|
|
Загрузка…
Ссылка в новой задаче