[Pkg-javascript-commits] [pdf.js] 76/174: Fail gracefully, and with a notification, if paintXObject is encountered in canvas.js

David Prévot taffit at moszumanska.debian.org
Thu Nov 19 18:45:16 UTC 2015


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository pdf.js.

commit 487ba9065a4f3ee5f1b099d980436c709cfe875e
Author: Jonas Jenwald <jonas.jenwald at gmail.com>
Date:   Tue Oct 20 20:25:29 2015 +0200

    Fail gracefully, and with a notification, if paintXObject is encountered in canvas.js
    
    We should never actually try to execute `paintXObject` in canvas.js, but in some cases where we fail to parse the PDF file correctly it can happen. Currently this will potentially cause an entire page to fail to render, which seems suboptimal.
    With this patch, we will instead continue rendering with a warning that things might not work correctly.
---
 src/display/canvas.js | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/src/display/canvas.js b/src/display/canvas.js
index 4e55d02..d66c318 100644
--- a/src/display/canvas.js
+++ b/src/display/canvas.js
@@ -14,10 +14,10 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-/* globals error, PDFJS, assert, info, shadow, TextRenderingMode,
-           FONT_IDENTITY_MATRIX, Uint32ArrayView, IDENTITY_MATRIX, ImageData,
-           ImageKind, isArray, isNum, TilingPattern, OPS, Util, warn,
-           getShadingPatternFromIR, WebGLUtils */
+/* globals IDENTITY_MATRIX, FONT_IDENTITY_MATRIX, TextRenderingMode, ImageData,
+           ImageKind, PDFJS, Uint32ArrayView, error, WebGLUtils, OPS, warn,
+           shadow, isNum, Util, TilingPattern, getShadingPatternFromIR, isArray,
+           info, assert, UnsupportedManager, UNSUPPORTED_FEATURES */
 
 'use strict';
 
@@ -2073,6 +2073,11 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {
         this.ctx.fillRect(0, 0, 1, 1);
     },
 
+    paintXObject: function CanvasGraphics_paintXObject() {
+      UnsupportedManager.notify(UNSUPPORTED_FEATURES.unknown);
+      warn('Unsupported \'paintXObject\' command.');
+    },
+
     // Marked content
 
     markPoint: function CanvasGraphics_markPoint(tag) {

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/pdf.js.git



More information about the Pkg-javascript-commits mailing list