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

remove new Function calls #22

Closed
wants to merge 10 commits into from
Closed

Conversation

firien
Copy link

@firien firien commented Jan 9, 2017

new Function may violate some sites Content Security Policy which can disable evals. All tests are passing, but I don't know if you want to replicate the conditional existence of these functions and throw errors. For instance throw an error if relativeToGetter is called and @options.relativeTo is not defined.

I'm also not sure what is allowed as @type for VersionedStruct - is it always a string representing a single property? or can it be a chain like @options.relativeTo on Pointer

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.2%) to 98.682% when pulling fe54419 on firien:remove-eval into 74c29e3 on devongovett:master.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.4%) to 98.499% when pulling 76dbc93 on firien:remove-eval into 74c29e3 on devongovett:master.

@firien
Copy link
Author

firien commented Mar 22, 2017

@devongovett did you get a chance to look at this?
The code coverage decrease is because these were conditional functions. These conditional functions may have been created (via new Function), but i think this reveals they were never executed afterwards.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.2%) to 98.689% when pulling 22910ed on firien:remove-eval into 74c29e3 on devongovett:master.

@Brvtvs
Copy link

Brvtvs commented Apr 9, 2018

This change would be very helpful so that this library can be used with a secure CSP.

@jfoclpf
Copy link

jfoclpf commented May 2, 2018

Apologies cause I'm still a bit newbie on these github issues.

Considering that "this branch has no conflicts with the base branch", does it mean that the issue is already solved or immediately solvable? Thank you so much in advance

@firien
Copy link
Author

firien commented May 3, 2018

"no conflicts" just means that the branch can be merged without a user having to manually fix conflicts. It does not guarantee integrity of the actual code - it could very well contain a syntax error…

It is the testing that matters, and that is passing; but the code coverage has some complaints…

@devongovett, would you have any time to look into this?

@jfoclpf
Copy link

jfoclpf commented May 3, 2018 via email

@clintonium-119
Copy link

@firien I'm running your fix in a local build of devongovett/pdfkit, and it has removed the unsafe-eval warnings, but Its taking many (guessing at least 10) times longer to generate the pdf.

Did you notice any significant performance degradation in your usage?

@firien
Copy link
Author

firien commented Jun 20, 2018

I actually don't use it in production; I still use an older pdfmake that doesn't have evals.

But, I just wired it up and didn't notice any difference in speed. Although I am generating very small PDFs, both versions were taking ~300ms.


I can see how making an Array and reducing it may generate some overhead. @devongovett would know better than I if this function is cache-able.

@clintonium-119
Copy link

Thanks for checking. I believe it to be a problem with my local build process.

gregfletch pushed a commit to Zetatango/restructure that referenced this pull request Jul 25, 2018
zt-deploy pushed a commit to Zetatango/restructure that referenced this pull request Jul 25, 2018
@jarrettj
Copy link

+1

@ArthurClemens
Copy link

ArthurClemens commented Oct 28, 2018

fontkit tests fail with the changes in VersionedStruct.

Updated version in PR #29

@firien
Copy link
Author

firien commented Oct 29, 2018

From initial PR:

I'm also not sure what is allowed as @type for VersionedStruct - is it always a string representing a single property? or can it be a chain like @options.relativeTo on Pointer

According to @ArthurClemens, the answer is: it can be a property chain.

There should probably be some local tests for this.

@firien
Copy link
Author

firien commented Jul 8, 2019

updated for es6

@firien
Copy link
Author

firien commented Sep 10, 2019

@devongovett, this PR has been updated for ES6, can you please review it? Any feedback would be appreciated.
Thank you.

@devongovett
Copy link
Member

Closing in favor of #34. This is an API change though, so it'll be a major version bump.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants