Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade: pdf.js v2.0.104 #474

Merged
merged 1 commit into from
Nov 9, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion build/karma.conf.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
/* eslint-disable */
const webpackConfig = require('./webpack.karma.config');

const DOC_STATIC_ASSETS_VERSION = '1.7.0';
// These should be updated to match the Preview version in package.json whenever a file in that third party directory
// is updated. Also, update the matching configuration in constants.js, which is needed for main preview functionality
const DOC_STATIC_ASSETS_VERSION = '1.17.0';
const MEDIA_STATIC_ASSETS_VERSION = '1.8.0';
const MODEL3D_STATIC_ASSETS_VERSION = '1.12.0';
const SWF_STATIC_ASSETS_VERSION = '0.112.0';
Expand Down
6 changes: 3 additions & 3 deletions src/lib/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,9 @@ export const X_REP_HINT_IMAGE = '[jpg?dimensions=2048x2048,png?dimensions=2048x2
export const X_REP_HINT_VIDEO_DASH = '[dash,mp4][filmstrip]';
export const X_REP_HINT_VIDEO_MP4 = '[mp4]';

// These should be updated to match the Preview version in package.json
// whenever a file in that third party directory is updated
export const DOC_STATIC_ASSETS_VERSION = '1.7.0';
// These should be updated to match the Preview version in package.json whenever a file in that third party directory
// is updated. Also, update the matching configuration in karma.conf.js, which is needed for tests
export const DOC_STATIC_ASSETS_VERSION = '1.17.0';
export const MEDIA_STATIC_ASSETS_VERSION = '1.8.0';
export const MODEL3D_STATIC_ASSETS_VERSION = '1.12.0';
export const SWF_STATIC_ASSETS_VERSION = '0.112.0';
Expand Down
16 changes: 4 additions & 12 deletions src/lib/viewers/doc/DocBaseViewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,8 @@ const MIN_SCALE = 0.1;
const IS_SAFARI_CLASS = 'is-safari';
const SCROLL_EVENT_THROTTLE_INTERVAL = 200;
const SCROLL_END_TIMEOUT = this.isMobile ? 500 : 250;

const RANGE_REQUEST_CHUNK_SIZE_US = 1048576; // 1MB
const RANGE_REQUEST_CHUNK_SIZE_NON_US = 524288; // 512KB
const MINIMUM_RANGE_REQUEST_FILE_SIZE_NON_US = 26214400; // 25MB
const MOBILE_MAX_CANVAS_SIZE = 2949120; // ~3MP 1920x1536

const LOADING_ICON_MAP = {
Expand Down Expand Up @@ -595,7 +593,7 @@ class DocBaseViewer extends BaseViewer {
setupPdfjs() {
// Set PDFJS worker & character maps
const { file, location } = this.options;
const { size, watermark_info: watermarkInfo } = file;
const { watermark_info: watermarkInfo } = file;
const assetUrlCreator = createAssetUrlCreator(location);
PDFJS.workerSrc = assetUrlCreator(`third-party/doc/${DOC_STATIC_ASSETS_VERSION}/pdf.worker.min.js`);
PDFJS.imageResourcesPath = assetUrlCreator(`third-party/doc/${DOC_STATIC_ASSETS_VERSION}/images/`);
Expand All @@ -609,15 +607,9 @@ class DocBaseViewer extends BaseViewer {
// @NOTE(JustinHoldstock) 2017-04-11: Check to remove this after next IOS release after 10.3.1
PDFJS.disableFontFace = PDFJS.disableFontFace || Browser.hasFontIssue();

// Disable range requests for files smaller than MINIMUM_RANGE_REQUEST_FILE_SIZE (25MB) for
// previews outside of the US since the additional latency overhead per range request can be
// more than the additional time for a continuous request. This also overrides any range request
// disabling that may be set by pdf.js's compatibility checking since the browsers we support
// should all be able to properly handle range requests.
PDFJS.disableRange = location.locale !== 'en-US' && size < MINIMUM_RANGE_REQUEST_FILE_SIZE_NON_US;

// Disable range requests for watermarked files since they are streamed
PDFJS.disableRange = PDFJS.disableRange || (watermarkInfo && watermarkInfo.is_watermarked);
// Disable range requests for watermarked files since they are streamed, otherwise override range request
// disabling by pdf.js's compatibility checking since all the browsers we support allow range requests
PDFJS.disableRange = watermarkInfo && watermarkInfo.is_watermarked;

// Disable text layer if user doesn't have download permissions
PDFJS.disableTextLayer =
Expand Down
19 changes: 1 addition & 18 deletions src/lib/viewers/doc/__tests__/DocBaseViewer-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -953,35 +953,18 @@ describe('src/lib/viewers/doc/DocBaseViewer', () => {
expect(PDFJS.disableFontFace).to.be.true;
});

it('should not disable range requests if the locale is en-US', () => {
it('should not disable range requests normally', () => {
docBase.setupPdfjs();
expect(PDFJS.disableRange).to.be.false;
});

it('should disable range requests if locale is not en-US, the file is smaller than 25MB and is not an Excel file', () => {
docBase.options.file.size = 26000000;
docBase.options.extension = 'pdf';
docBase.options.location.locale = 'ja-JP';
docBase.setupPdfjs();
expect(PDFJS.disableRange).to.be.true;
});

it('should disable range requests if the file is watermarked', () => {
docBase.options.location.locale = 'ja-JP';
docBase.options.file.watermark_info.is_watermarked = true;
docBase.setupPdfjs();
expect(PDFJS.disableRange).to.be.true;
});

it('should enable range requests if locale is not en-US, the file is greater than 25MB and is not watermarked', () => {
docBase.options.location.locale = 'ja-JP';
docBase.options.file.size = 26500000;
docBase.options.extension = 'pdf';
docBase.options.file.watermark_info.is_watermarked = false;
docBase.setupPdfjs();
expect(PDFJS.disableRange).to.be.false;
});

it('should disable or enable text layer based on download permissions', () => {
stubs.checkPermission.withArgs(docBase.options.file, PERMISSION_DOWNLOAD).returns(true);
docBase.setupPdfjs();
Expand Down
Binary file added src/third-party/doc/1.17.0/cmaps/78-EUC-H.bcmap
Binary file not shown.
Binary file added src/third-party/doc/1.17.0/cmaps/78-EUC-V.bcmap
Binary file not shown.
Binary file added src/third-party/doc/1.17.0/cmaps/78-H.bcmap
Binary file not shown.
Binary file not shown.
Binary file added src/third-party/doc/1.17.0/cmaps/78-RKSJ-V.bcmap
Binary file not shown.
Binary file added src/third-party/doc/1.17.0/cmaps/78-V.bcmap
Binary file not shown.
Binary file not shown.
Binary file added src/third-party/doc/1.17.0/cmaps/78ms-RKSJ-V.bcmap
Binary file not shown.
Binary file added src/third-party/doc/1.17.0/cmaps/83pv-RKSJ-H.bcmap
Binary file not shown.
Binary file added src/third-party/doc/1.17.0/cmaps/90ms-RKSJ-H.bcmap
Binary file not shown.
Binary file added src/third-party/doc/1.17.0/cmaps/90ms-RKSJ-V.bcmap
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added src/third-party/doc/1.17.0/cmaps/90pv-RKSJ-H.bcmap
Binary file not shown.
Binary file added src/third-party/doc/1.17.0/cmaps/90pv-RKSJ-V.bcmap
Binary file not shown.
Binary file added src/third-party/doc/1.17.0/cmaps/Add-H.bcmap
Binary file not shown.
Binary file not shown.
Binary file added src/third-party/doc/1.17.0/cmaps/Add-RKSJ-V.bcmap
Binary file not shown.
Binary file added src/third-party/doc/1.17.0/cmaps/Add-V.bcmap
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added src/third-party/doc/1.17.0/cmaps/Adobe-GB1-0.bcmap
Binary file not shown.
Binary file added src/third-party/doc/1.17.0/cmaps/Adobe-GB1-1.bcmap
Binary file not shown.
Binary file added src/third-party/doc/1.17.0/cmaps/Adobe-GB1-2.bcmap
Binary file not shown.
Binary file added src/third-party/doc/1.17.0/cmaps/Adobe-GB1-3.bcmap
Binary file not shown.
Binary file added src/third-party/doc/1.17.0/cmaps/Adobe-GB1-4.bcmap
Binary file not shown.
Binary file added src/third-party/doc/1.17.0/cmaps/Adobe-GB1-5.bcmap
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added src/third-party/doc/1.17.0/cmaps/B5-H.bcmap
Binary file not shown.
Binary file added src/third-party/doc/1.17.0/cmaps/B5-V.bcmap
Binary file not shown.
Binary file added src/third-party/doc/1.17.0/cmaps/B5pc-H.bcmap
Binary file not shown.
Binary file added src/third-party/doc/1.17.0/cmaps/B5pc-V.bcmap
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added src/third-party/doc/1.17.0/cmaps/CNS1-H.bcmap
Binary file not shown.
Binary file added src/third-party/doc/1.17.0/cmaps/CNS1-V.bcmap
Binary file not shown.
Binary file added src/third-party/doc/1.17.0/cmaps/CNS2-H.bcmap
Binary file not shown.
3 changes: 3 additions & 0 deletions src/third-party/doc/1.17.0/cmaps/CNS2-V.bcmap
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
�RCopyright 1990-2009 Adobe Systems Incorporated.
All rights reserved.
See ./LICENSE�CNS2-H
Binary file not shown.
Binary file added src/third-party/doc/1.17.0/cmaps/ETHK-B5-V.bcmap
Binary file not shown.
Binary file not shown.
Binary file added src/third-party/doc/1.17.0/cmaps/ETen-B5-V.bcmap
Binary file not shown.
3 changes: 3 additions & 0 deletions src/third-party/doc/1.17.0/cmaps/ETenms-B5-H.bcmap
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
�RCopyright 1990-2009 Adobe Systems Incorporated.
All rights reserved.
See ./LICENSE� ETen-B5-H` ^
Binary file added src/third-party/doc/1.17.0/cmaps/ETenms-B5-V.bcmap
Binary file not shown.
Binary file added src/third-party/doc/1.17.0/cmaps/EUC-H.bcmap
Binary file not shown.
Binary file added src/third-party/doc/1.17.0/cmaps/EUC-V.bcmap
Binary file not shown.
Binary file added src/third-party/doc/1.17.0/cmaps/Ext-H.bcmap
Binary file not shown.
Binary file not shown.
Binary file added src/third-party/doc/1.17.0/cmaps/Ext-RKSJ-V.bcmap
Binary file not shown.
Binary file added src/third-party/doc/1.17.0/cmaps/Ext-V.bcmap
Binary file not shown.
Binary file added src/third-party/doc/1.17.0/cmaps/GB-EUC-H.bcmap
Binary file not shown.
Binary file added src/third-party/doc/1.17.0/cmaps/GB-EUC-V.bcmap
Binary file not shown.
4 changes: 4 additions & 0 deletions src/third-party/doc/1.17.0/cmaps/GB-H.bcmap
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
�RCopyright 1990-2009 Adobe Systems Incorporated.
All rights reserved.
See ./LICENSE!!��]aX!!]`�21�> �p �z�$]��"R�d�-U�7�*�4�%�+ �Z �{�/�%�<�9K�b�1]�.�"� �`]�,�"]�
�"]�h�"]�F�"]�$�"]��"]�`�"]�>�"]��"]�z�"]�X�"]�6�"]��"]�r�"]�P�"]�.�"]� �"]�j�"]�H�"]�&�"]��"]�b�"]�@�"]��"]�|�"]�Z�"]�8�"]��"]�t�"]�R�"]�0�"]��"]�l�"]�J�"]�(�"]��"]�d�"]�B�"]� �"X�~�']�W�"]�5�"]��"]�q�"]�O�"]�-�"]� �"]�i�"]�G�"]�%�"]��"]�a�"]�?�"]��"]�{�"]�Y�"]�7�"]��"]�s�"]�Q�"]�/�"]��"]�k�"]�I�"]�'�"]��"]�c�"]�A�"]��"]�}�"]�[�"]�9
Expand Down
Binary file added src/third-party/doc/1.17.0/cmaps/GB-V.bcmap
Binary file not shown.
Binary file not shown.
Binary file added src/third-party/doc/1.17.0/cmaps/GBK-EUC-V.bcmap
Binary file not shown.
Binary file added src/third-party/doc/1.17.0/cmaps/GBK2K-H.bcmap
Binary file not shown.
Binary file added src/third-party/doc/1.17.0/cmaps/GBK2K-V.bcmap
Binary file not shown.
Binary file not shown.
Binary file added src/third-party/doc/1.17.0/cmaps/GBKp-EUC-V.bcmap
Binary file not shown.
Binary file not shown.
Binary file added src/third-party/doc/1.17.0/cmaps/GBT-EUC-V.bcmap
Binary file not shown.
Binary file added src/third-party/doc/1.17.0/cmaps/GBT-H.bcmap
Binary file not shown.
Binary file added src/third-party/doc/1.17.0/cmaps/GBT-V.bcmap
Binary file not shown.
Binary file not shown.
Binary file added src/third-party/doc/1.17.0/cmaps/GBTpc-EUC-V.bcmap
Binary file not shown.
Binary file added src/third-party/doc/1.17.0/cmaps/GBpc-EUC-H.bcmap
Binary file not shown.
Binary file added src/third-party/doc/1.17.0/cmaps/GBpc-EUC-V.bcmap
Binary file not shown.
Binary file added src/third-party/doc/1.17.0/cmaps/H.bcmap
Binary file not shown.
Binary file not shown.
Binary file added src/third-party/doc/1.17.0/cmaps/HKdla-B5-V.bcmap
Binary file not shown.
Binary file not shown.
Binary file added src/third-party/doc/1.17.0/cmaps/HKdlb-B5-V.bcmap
Binary file not shown.
Binary file not shown.
Binary file added src/third-party/doc/1.17.0/cmaps/HKgccs-B5-V.bcmap
Binary file not shown.
Binary file not shown.
Binary file added src/third-party/doc/1.17.0/cmaps/HKm314-B5-V.bcmap
Binary file not shown.
Binary file not shown.
Binary file added src/third-party/doc/1.17.0/cmaps/HKm471-B5-V.bcmap
Binary file not shown.
Binary file not shown.
Binary file added src/third-party/doc/1.17.0/cmaps/HKscs-B5-V.bcmap
Binary file not shown.
Binary file added src/third-party/doc/1.17.0/cmaps/Hankaku.bcmap
Binary file not shown.
Binary file added src/third-party/doc/1.17.0/cmaps/Hiragana.bcmap
Binary file not shown.
Binary file not shown.
Binary file added src/third-party/doc/1.17.0/cmaps/KSC-EUC-V.bcmap
Binary file not shown.
Binary file added src/third-party/doc/1.17.0/cmaps/KSC-H.bcmap
Binary file not shown.
Binary file not shown.
Binary file added src/third-party/doc/1.17.0/cmaps/KSC-Johab-V.bcmap
Binary file not shown.
Binary file added src/third-party/doc/1.17.0/cmaps/KSC-V.bcmap
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added src/third-party/doc/1.17.0/cmaps/KSCms-UHC-V.bcmap
Binary file not shown.
Binary file not shown.
Binary file added src/third-party/doc/1.17.0/cmaps/KSCpc-EUC-V.bcmap
Binary file not shown.
Binary file added src/third-party/doc/1.17.0/cmaps/Katakana.bcmap
Binary file not shown.
36 changes: 36 additions & 0 deletions src/third-party/doc/1.17.0/cmaps/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
%%Copyright: -----------------------------------------------------------
%%Copyright: Copyright 1990-2009 Adobe Systems Incorporated.
%%Copyright: All rights reserved.
%%Copyright:
%%Copyright: Redistribution and use in source and binary forms, with or
%%Copyright: without modification, are permitted provided that the
%%Copyright: following conditions are met:
%%Copyright:
%%Copyright: Redistributions of source code must retain the above
%%Copyright: copyright notice, this list of conditions and the following
%%Copyright: disclaimer.
%%Copyright:
%%Copyright: Redistributions in binary form must reproduce the above
%%Copyright: copyright notice, this list of conditions and the following
%%Copyright: disclaimer in the documentation and/or other materials
%%Copyright: provided with the distribution.
%%Copyright:
%%Copyright: Neither the name of Adobe Systems Incorporated nor the names
%%Copyright: of its contributors may be used to endorse or promote
%%Copyright: products derived from this software without specific prior
%%Copyright: written permission.
%%Copyright:
%%Copyright: THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
%%Copyright: CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
%%Copyright: INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
%%Copyright: MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
%%Copyright: DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
%%Copyright: CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
%%Copyright: SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
%%Copyright: NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
%%Copyright: LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
%%Copyright: HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
%%Copyright: CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
%%Copyright: OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
%%Copyright: SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
%%Copyright: -----------------------------------------------------------
Binary file added src/third-party/doc/1.17.0/cmaps/NWP-H.bcmap
Binary file not shown.
Binary file added src/third-party/doc/1.17.0/cmaps/NWP-V.bcmap
Binary file not shown.
Binary file added src/third-party/doc/1.17.0/cmaps/RKSJ-H.bcmap
Binary file not shown.
Binary file added src/third-party/doc/1.17.0/cmaps/RKSJ-V.bcmap
Binary file not shown.
Binary file added src/third-party/doc/1.17.0/cmaps/Roman.bcmap
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added src/third-party/doc/1.17.0/cmaps/V.bcmap
Binary file not shown.
Binary file added src/third-party/doc/1.17.0/cmaps/WP-Symbol.bcmap
Binary file not shown.
Loading