Navigation Menu

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

Code has to be evaluated in global scope #8

Closed
kirill-konshin opened this issue Mar 22, 2014 · 5 comments
Closed

Code has to be evaluated in global scope #8

kirill-konshin opened this issue Mar 22, 2014 · 5 comments
Milestone

Comments

@kirill-konshin
Copy link
Contributor

Window.eval() is needed, otherwise something like CryptoJS (http://code.google.com/p/crypto-js) completely refuses to work.

function exec(content) {
    /*jslint evil: true */
    return window.eval(content);
}

at line ~1960.

@jrburke
Copy link
Member

jrburke commented Mar 24, 2014

Thanks for pointing this out! Do you have a short example on how you found the error with crypto-js?

I would like to reproduce, so that i could try a fix. I would like to try to capture the this that is global to that the fix might work more generically than relying on window, but want to be sure the fix actually works. I could then also include a test case for it.

@kirill-konshin
Copy link
Contributor Author

Yes, capturing global in a more generic way is preferred.

You have to download the zip file from the google code project, my config was as following:

    paths: {
        'crypto-js/aes': '../bower/crypto-js/rollups/aes',
        'crypto-js/sha256': '../bower/crypto-js/rollups/sha256',
        'crypto-js/mode-ecb': '../bower/crypto-js/components/mode-ecb'
    },
    shim: {
        'crypto-js/mode-ecb': {
            deps: ['crypto-js/aes']
        },
    }

Without global eval, you'll get an exception "Uncaught ReferenceError: CryptoJS is not defined" when loading crypto-js/mode-ecb.

I have checked, you are already capturing window as global so global.eval also works.

@kirill-konshin
Copy link
Contributor Author

Any updates on this issue?

@jrburke
Copy link
Member

jrburke commented Mar 28, 2014

I likely will not get to this, and the other issues you filed, until the weekend -- Normally it is hard for me to make too much progress on the open source stuff outside my day job work during the week, and it could stretch out to the next weekend for all the issue resolution, but do want to address them.

@kirill-konshin
Copy link
Contributor Author

It's ok, for now I simply use patched version, which seems to work ok, but I did not run any tricky tests… keep me posted.

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

No branches or pull requests

2 participants