Merge pull request #11545 from Snuffleupagus/debugger-createObjectURL

Use the native `URL.createObjectURL` method in `web/debugger.js`
This commit is contained in:
Tim van der Meij 2020-01-28 22:57:04 +01:00 committed by GitHub
commit 6d5de7e808
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 12 deletions

View File

@ -38,7 +38,6 @@ import {
import { AppOptions, OptionKind } from "./app_options.js";
import {
build,
createObjectURL,
getDocument,
getFilenameFromUrl,
GlobalWorkerOptions,
@ -1784,13 +1783,7 @@ function loadAndEnablePDFBug(enabledTabs) {
const appConfig = PDFViewerApplication.appConfig;
return loadScript(appConfig.debuggerScriptPath).then(function() {
PDFBug.enable(enabledTabs);
PDFBug.init(
{
OPS,
createObjectURL,
},
appConfig.mainContainer
);
PDFBug.init({ OPS }, appConfig.mainContainer);
});
}

View File

@ -17,7 +17,7 @@
"use strict";
var FontInspector = (function FontInspectorClosure() {
var fonts, createObjectURL;
var fonts;
var active = false;
var fontAttribute = "data-font-name";
function removeSelection() {
@ -75,8 +75,6 @@ var FontInspector = (function FontInspectorClosure() {
fonts = document.createElement("div");
panel.appendChild(fonts);
createObjectURL = pdfjsLib.createObjectURL;
},
cleanup: function cleanup() {
fonts.textContent = "";
@ -121,7 +119,9 @@ var FontInspector = (function FontInspectorClosure() {
url = /url\(['"]?([^\)"']+)/.exec(url);
download.href = url[1];
} else if (fontObj.data) {
download.href = createObjectURL(fontObj.data, fontObj.mimeType);
download.href = URL.createObjectURL(
new Blob([fontObj.data], { type: fontObj.mimeType })
);
}
download.textContent = "Download";
var logIt = document.createElement("a");