mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-21 07:38:07 +02:00
Restore the btoa
/atob
polyfills for Node.js
These were removed in PR 9170, since they were unused in the browsers that we'll support in PDF.js version `2.0`. However looking at the output of Travis, where a subset of the unit-tests are run using Node.js, there's warnings about `btoa` being undefined. This doesn't appear to cause any errors, which probably explains why we didn't notice this before (despite PR 9201).
This commit is contained in:
parent
ba0a3aebd0
commit
0e1b5589e7
16 changed files with 73 additions and 28 deletions
|
@ -17,9 +17,8 @@ import {
|
|||
buildGetDocumentParams, NodeFileReaderFactory, TEST_PDFS_PATH
|
||||
} from './test_utils';
|
||||
import {
|
||||
createPromiseCapability, FontType, InvalidPDFException, isNodeJS,
|
||||
MissingPDFException, PasswordException, PasswordResponses, StreamType,
|
||||
stringToBytes
|
||||
createPromiseCapability, FontType, InvalidPDFException, MissingPDFException,
|
||||
PasswordException, PasswordResponses, StreamType, stringToBytes
|
||||
} from '../../src/shared/util';
|
||||
import {
|
||||
DOMCanvasFactory, RenderingCancelledException
|
||||
|
@ -27,6 +26,7 @@ import {
|
|||
import {
|
||||
getDocument, PDFDocumentProxy, PDFPageProxy
|
||||
} from '../../src/display/api';
|
||||
import isNodeJS from '../../src/shared/is_node';
|
||||
import { PDFJS } from '../../src/display/global';
|
||||
|
||||
describe('api', function() {
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
|
||||
import { CMap, CMapFactory, IdentityCMap } from '../../src/core/cmap';
|
||||
import { DOMCMapReaderFactory } from '../../src/display/dom_utils';
|
||||
import { isNodeJS } from '../../src/shared/util';
|
||||
import isNodeJS from '../../src/shared/is_node';
|
||||
import { Name } from '../../src/core/primitives';
|
||||
import { NodeCMapReaderFactory } from './test_utils';
|
||||
import { StringStream } from '../../src/core/stream';
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
import { buildGetDocumentParams } from './test_utils';
|
||||
import { DOMCanvasFactory } from '../../src/display/dom_utils';
|
||||
import { getDocument } from '../../src/display/api';
|
||||
import { isNodeJS } from '../../src/shared/util';
|
||||
import isNodeJS from '../../src/shared/is_node';
|
||||
|
||||
function getTopLeftPixel(canvasContext) {
|
||||
let imgData = canvasContext.getImageData(0, 0, 1, 1);
|
||||
|
|
|
@ -14,10 +14,11 @@
|
|||
*/
|
||||
/* globals __non_webpack_require__ */
|
||||
|
||||
import { isNodeJS, NativeImageDecoding } from '../../src/shared/util';
|
||||
import { setStubs, unsetStubs } from '../../examples/node/domstubs';
|
||||
import { buildGetDocumentParams } from './test_utils';
|
||||
import { getDocument } from '../../src/display/api';
|
||||
import isNodeJS from '../../src/shared/is_node';
|
||||
import { NativeImageDecoding } from '../../src/shared/util';
|
||||
import { SVGGraphics } from '../../src/display/svg';
|
||||
|
||||
const XLINK_NS = 'http://www.w3.org/1999/xlink';
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
import {
|
||||
DOMSVGFactory, getFilenameFromUrl, isExternalLinkTargetSet, LinkTarget
|
||||
} from '../../src/display/dom_utils';
|
||||
import { isNodeJS } from '../../src/shared/util';
|
||||
import isNodeJS from '../../src/shared/is_node';
|
||||
import { PDFJS } from '../../src/display/global';
|
||||
|
||||
describe('dom_utils', function() {
|
||||
|
|
|
@ -14,7 +14,8 @@
|
|||
*/
|
||||
/* globals __non_webpack_require__ */
|
||||
|
||||
import { assert, isNodeJS } from '../../src/shared/util';
|
||||
import { assert } from '../../src/shared/util';
|
||||
import isNodeJS from '../../src/shared/is_node';
|
||||
import { PDFNodeStream } from '../../src/display/node_stream';
|
||||
|
||||
// Make sure that we only running this script is Node.js environments.
|
||||
|
|
|
@ -13,7 +13,8 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { CMapCompressionType, isNodeJS } from '../../src/shared/util';
|
||||
import { CMapCompressionType } from '../../src/shared/util';
|
||||
import isNodeJS from '../../src/shared/is_node';
|
||||
import { isRef } from '../../src/core/primitives';
|
||||
|
||||
class NodeFileReaderFactory {
|
||||
|
|
|
@ -17,7 +17,8 @@ import {
|
|||
binarySearchFirstItem, EventBus, getPDFFileNameFromURL, isValidRotation,
|
||||
waitOnEventOrTimeout, WaitOnType
|
||||
} from '../../web/ui_utils';
|
||||
import { createObjectURL, isNodeJS } from '../../src/shared/util';
|
||||
import { createObjectURL } from '../../src/shared/util';
|
||||
import isNodeJS from '../../src/shared/is_node';
|
||||
|
||||
describe('ui_utils', function() {
|
||||
describe('binary search', function() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue