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:
Jonas Jenwald 2019-12-08 13:46:21 +01:00
parent 7b503c8923
commit a8fc306b6e
5 changed files with 31 additions and 51 deletions

View file

@ -14,7 +14,6 @@
*/
import { AbortException, createPromiseCapability, Util } from '../shared/util';
import { globalScope } from '../shared/global_scope';
/**
* Text layer render parameters.
@ -469,8 +468,8 @@ var renderTextLayer = (function renderTextLayerClosure() {
this._textDivs = textDivs || [];
this._textContentItemsStr = textContentItemsStr || [];
this._enhanceTextSelection = !!enhanceTextSelection;
this._fontInspectorEnabled = !!(globalScope.FontInspector &&
globalScope.FontInspector.enabled);
this._fontInspectorEnabled = !!(globalThis.FontInspector &&
globalThis.FontInspector.enabled);
this._reader = null;
this._layoutTextLastFontSize = null;