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

Chrome v17 CanvasPixelArray issue #4974

Closed
ray73864 opened this issue Jun 19, 2014 · 5 comments · Fixed by #4997
Closed

Chrome v17 CanvasPixelArray issue #4974

ray73864 opened this issue Jun 19, 2014 · 5 comments · Fixed by #4997

Comments

@ray73864
Copy link

On Chrome 17 i am getting the following issue:

TypeError: Cannot read property 'prototype' of undefined
pdf.js:200Warning: Unhandled rejection: TypeError: Object #<CanvasPixelArray> has no method 'set'
TypeError: Object #<CanvasPixelArray> has no method 'set'
    at putBinaryImageData (http://10.5.0.3/pse/pdfjs/build/pdf.js:5806:14)
    at Object.CanvasGraphics_paintInlineImageXObject (http://10.5.0.3/pse/pdfjs/build/pdf.js:7291:9)
    at Object.CanvasGraphics_paintImageXObject (http://10.5.0.3/pse/pdfjs/build/pdf.js:7246:12)
    at Object.CanvasGraphics_executeOperatorList [as executeOperatorList] (http://10.5.0.3/pse/pdfjs/build/pdf.js:6037:22)
    at Object.InternalRenderTask__next [as _next] (http://10.5.0.3/pse/pdfjs/build/pdf.js:5211:39)
    at Object.pdfViewcContinueCallback [as continueCallback] (http://10.5.0.3/pse/pdfjs/web/viewer.js:4464:9)
    at Object.InternalRenderTask__continue [as _continue] (http://10.5.0.3/pse/pdfjs/build/pdf.js:5201:21)
    at Object.runHandlers (http://10.5.0.3/pse/pdfjs/build/pdf.js:1066:35)

It isn't happening in the latest version of Chrome, just wondering if there is a simple fix that doesn't involve upgrading chrome as that isn't really an option in this particular case.

@yurydelendik
Copy link
Contributor

Shall be fixed by adding web/compatibility.js to the scripts. See #4420. Closing as answered.

@ray73864
Copy link
Author

I already have that, i'm using the default viewer.html from the 'web' directory.

Still didn't work though on chrome 17.

@timvandermeij timvandermeij reopened this Jun 19, 2014
@yurydelendik
Copy link
Contributor

Then the polyfill to properly hook into CanvasPixelArray prototype shall be fixed

@CodingFabian
Copy link
Contributor

The problem is that the polyfill has no access. the code thinks CanvasPixelArray is window scoped, but it is not.
what i see as an option see to refactor canvas.js not to rely on context for generating these image data arrays:
var chunkImgData = ctx.createImageData(width, fullChunkHeight);

if there would be a createImageData(ctx) function, we could optimize/polyfill there.

@CodingFabian
Copy link
Contributor

i guess it would be possible to polyfill it differently, ill put a PR together.

CodingFabian added a commit to CodingFabian/pdf.js that referenced this issue Jun 24, 2014
CodingFabian added a commit to CodingFabian/pdf.js that referenced this issue Jun 24, 2014
CodingFabian added a commit to CodingFabian/pdf.js that referenced this issue Jun 24, 2014
CodingFabian added a commit to CodingFabian/pdf.js that referenced this issue Jun 24, 2014
CodingFabian added a commit to CodingFabian/pdf.js that referenced this issue Jun 24, 2014
CodingFabian added a commit to CodingFabian/pdf.js that referenced this issue Jun 24, 2014
CodingFabian added a commit to CodingFabian/pdf.js that referenced this issue Jun 24, 2014
CodingFabian added a commit to CodingFabian/pdf.js that referenced this issue Jun 24, 2014
yurydelendik added a commit that referenced this issue Jun 24, 2014
Fixes CanvasPixelArray set polyfill (#4974)
joelkuiper added a commit to joelkuiper/pdf.js that referenced this issue Jun 25, 2014
* 'master' of https://github.com/mozilla/pdf.js: (41 commits)
  Do not run cleanup while printing is ongoing.
  Fixes CanvasPixelArray set polyfill for chrome < 21 (mozilla#4974)
  Added paintJpegXObject
  Added paintSolidColorImageMask
  Optimization of save/restore usage
  Combine re element into constructPath
  Restructured EvaluatorPreprocessor_read to be more natural.
  Removing unnecessary includes from text selection example
  Refactoring PDFFindController in the text layer builder
  Convert the text layer builder to a class
  Refactoring text layer builder
  Use null instead of [] for ops with no args.
  Implement text normalization for page content and queries
  Fix code style issues in pdf_find_controller.js and build strings more efficiently
  Additional heuristics to recognize unknown glyphs for toUnicode (bug 1027533)
  Fixes SVG transforms on restore
  Misc UI improvements for the SVG Viewer
  SVG Viewer example demo
  Factor out repeated Ref key string generation code.
  Avoid allocating return object in EvaluatorPreprocessor_read().
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants