mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-09 09:45:42 +02:00
Replace globalScope
with the standard globalThis
property instead
Please see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/globalThis and note that most (reasonably) modern browsers have supported this for a while now, see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/globalThis#Browser_compatibility Since ESLint doesn't support this new global yet, it was added to the `globals` list in the top-level configuration file to prevent issues. Finally, for older browsers a polyfill was added in `ssrc/shared/compatibility.js`.
This commit is contained in:
parent
7b503c8923
commit
a8fc306b6e
5 changed files with 31 additions and 51 deletions
|
@ -33,7 +33,6 @@ import {
|
|||
import { FontFaceObject, FontLoader } from './font_loader';
|
||||
import { apiCompatibilityParams } from './api_compatibility';
|
||||
import { CanvasGraphics } from './canvas';
|
||||
import { globalScope } from '../shared/global_scope';
|
||||
import { GlobalWorkerOptions } from './worker_options';
|
||||
import { MessageHandler } from '../shared/message_handler';
|
||||
import { Metadata } from './metadata';
|
||||
|
@ -2103,11 +2102,11 @@ class WorkerTransport {
|
|||
}
|
||||
|
||||
let fontRegistry = null;
|
||||
if (params.pdfBug && globalScope.FontInspector &&
|
||||
globalScope.FontInspector.enabled) {
|
||||
if (params.pdfBug && globalThis.FontInspector &&
|
||||
globalThis.FontInspector.enabled) {
|
||||
fontRegistry = {
|
||||
registerFont(font, url) {
|
||||
globalScope['FontInspector'].fontAdded(font, url);
|
||||
globalThis.FontInspector.fontAdded(font, url);
|
||||
},
|
||||
};
|
||||
}
|
||||
|
@ -2608,9 +2607,9 @@ const InternalRenderTask = (function InternalRenderTaskClosure() {
|
|||
canvasInRendering.add(this._canvas);
|
||||
}
|
||||
|
||||
if (this._pdfBug && globalScope.StepperManager &&
|
||||
globalScope.StepperManager.enabled) {
|
||||
this.stepper = globalScope.StepperManager.create(this.pageNumber - 1);
|
||||
if (this._pdfBug && globalThis.StepperManager &&
|
||||
globalThis.StepperManager.enabled) {
|
||||
this.stepper = globalThis.StepperManager.create(this.pageNumber - 1);
|
||||
this.stepper.init(this.operatorList);
|
||||
this.stepper.nextBreakPoint = this.stepper.getNextBreakPoint();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue