izuzak / atom-pdf-view

Support for viewing PDF files in Atom.
https://atom.io/packages/pdf-view
MIT License
106 stars 30 forks source link

Uncaught EvalError: Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an al... #68

Open mathifonseca opened 8 years ago

mathifonseca commented 8 years ago

Steps:

  1. Open a PDF file...

Atom Version: 1.0.5 System: Mac OS X 10.11 Thrown From: pdf-view package, v0.23.0

Stack Trace

Uncaught EvalError: Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "script-src 'self'".

At /Users/mathifonseca/.atom/packages/pdf-view/node_modules/pdfjs-dist/build/pdf.js:6589

EvalError: Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "script-src 'self'".

  at Function (native)
  at Object.FontLoader_getPathGenerator [as getPathGenerator] (/Users/mathifonseca/.atom/packages/pdf-view/node_modules/pdfjs-dist/build/pdf.js:6589:42)
  at Object.CanvasGraphics_paintChar [as paintChar] (/Users/mathifonseca/.atom/packages/pdf-view/node_modules/pdfjs-dist/build/pdf.js:4569:26)
  at Object.CanvasGraphics_showText [as showText] (/Users/mathifonseca/.atom/packages/pdf-view/node_modules/pdfjs-dist/build/pdf.js:4732:16)
  at Object.CanvasGraphics_executeOperatorList [as executeOperatorList] (/Users/mathifonseca/.atom/packages/pdf-view/node_modules/pdfjs-dist/build/pdf.js:4058:22)
  at Object.InternalRenderTask__next [as _next] (/Users/mathifonseca/.atom/packages/pdf-view/node_modules/pdfjs-dist/build/pdf.js:3209:39)

Commands

     -9:39.5.0 editor:consolidate-selections (atom-text-editor.editor.is-focused)
     -9:39.5.0 core:cancel (atom-text-editor.editor.is-focused)
     -9:39.3.0 editor:consolidate-selections (atom-text-editor.editor.is-focused)
     -9:39.3.0 core:cancel (atom-text-editor.editor.is-focused)
     -9:38.5.0 command-palette:toggle (atom-text-editor.editor.is-focused)
     -9:34.6.0 editor:consolidate-selections (atom-text-editor.editor.mini.is-focused)
     -9:34.6.0 core:cancel (atom-text-editor.editor.mini.is-focused)
     -9:34.3.0 editor:consolidate-selections (atom-text-editor.editor.is-focused)
     -9:34.3.0 core:cancel (atom-text-editor.editor.is-focused)
     -9:24.7.0 core:confirm (atom-text-editor.editor.mini.is-focused)
  4x -9:13.3.0 core:backspace (atom-text-editor.editor.mini.is-focused)
  2x -9:00.2.0 core:confirm (atom-text-editor.editor.mini.is-focused)
     -7:42.5.0 editor:delete-to-beginning-of-word (atom-text-editor.editor.mini.is-focused)
  2x -7:40.9.0 core:confirm (atom-text-editor.editor.mini.is-focused)
     -3:47.2.0 editor:delete-to-beginning-of-word (atom-text-editor.editor.mini.is-focused)
  2x -3:46.1.0 core:confirm (atom-text-editor.editor.mini.is-focused)

Config

{
  "core": {
    "themes": [
      "atom-dark-ui",
      "atom-dark-syntax"
    ],
    "projectHome": "/Users/mathifonseca/code"
  }
}

Installed Packages

# User
atom-grails, v0.1.0
color-picker, v2.0.11
language-ansible, v0.1.3
language-apache, v1.3.0
language-groovy, v0.4.0
linter-ansible-lint, v0.0.7
minimap, v4.12.2
pdf-view, v0.23.0
pigments, v0.9.3
travis-ci-status, v0.16.0

# Dev
No dev packages
izuzak commented 8 years ago

Thanks for the report, @mathifonseca. I'm having trouble reproducing this on OSX 10.10.4, so I'm guessing it might be related to OSX 10.11 (which seems to be what you're using).

Just to make sure -- this happens for every PDF for you, correct? Do you see the same behavior if you disable all other packages except for pdf-view? And have you perhaps been able to reproduce this on an OSX 10.10.X machine?

mathifonseca commented 8 years ago

Hi @izuzak, something that might help you is that it's a PDF with text and inline images and when the error appears, only the images are loaded. I will try it on a 10.10 machine and let you know. Thanks!

izuzak commented 8 years ago

Doesn't really help me, actually -- this package doesn't handle PDF rendering. That's all handled by pdf.js, a PDF rendering library which this package uses: https://mozilla.github.io/pdf.js/. Can you share that PDF which you are using to reproduce that exception?

mathifonseca commented 8 years ago

Well, there seems to be a problem with that library then, because that's where Atom says it's failing in the exception info. Here is the pdf: https://dl.dropboxusercontent.com/u/16079214/1.1.14.pdf

On 15 August 2015 at 14:24, Ivan Žužak notifications@github.com wrote:

Doesn't really help me, actually -- this package doesn't handle PDF rendering. That's all handled by pdf.js, a PDF rendering library which this package uses: https://mozilla.github.io/pdf.js/. Can you share that PDF which you are using to reproduce that exception?

— Reply to this email directly or view it on GitHub https://github.com/izuzak/atom-pdf-view/issues/68#issuecomment-131402883 .

izuzak commented 8 years ago

Great, thanks - I'm seeing the error as well. I'll try and see if I can find out what that might be about.