8000 Unexpected expression: 'WithStatement' · Issue #33 · mmckegg/notevil · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
This repository was archived by the owner on Dec 28, 2021. It is now read-only.
This repository was archived by the owner on Dec 28, 2021. It is now read-only.
Unexpected expression: 'WithStatement' #33
Open
@ragoutje

Description

@ragoutje

I'm currently trying to implement notevil 1.1.0 into Vue to create a Vue 2.6-csp build. However I'm running into the fact that with statements are used in Vue and notevil throws an error for these statements: https://github.com/mmckegg/notevil/blob/master/index.js#L368

In Vue I am able to find the following code which probably triggers this (https://github.com/vuejs/vue/blob/2.6/src/compiler/codegen/index.js#L49):

with(this){return ${code}}

And somewhere in the code following where that line is executed by:

return new Function(code)

Which I have tried to replace with:

const fn = notevil.Function(code);
        return function() {
            return fn.call(this);
        };

Where I have tried to inject the this property to be used in the with(this) expression.

The result is a Unexpected expression: 'WithStatement' error in my console.

Is it possible to add the ability to parse with statements? Or does anyone have suggestions on how to work around the with(this) expressions?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0