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

eval rewrite update + latest wombat (3.3.7) #763

Merged
merged 1 commit into from
Sep 29, 2022
Merged

Conversation

ikreymer
Copy link
Member

Description

eval: switch to new eval rewriting which catches global scope rxrewriting: remove lookbehind check so that 'return eval(...)' can be rewritten tests: add additional eval tests

bump to 2.6.9

Motivation and Context

Fixes rewriting of eval statements like eval("import 'somefile.js'"), using same system as in wabac.js and supported in wombat.js. Updates wombat.js to latest + eval rewriting logic to match wabac.js

Screenshots (if appropriate):

Types of changes

  • Replay fix (fixes a replay specific issue)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added or updated tests to cover my changes.
  • All new and existing tests passed.

eval: switch to new eval rewriting which catches global scope
rxrewriting: remove lookbehind check so that 'return eval(...)' can be rewritten
tests: add additional eval tests

bump to 2.6.9
@ikreymer ikreymer requested review from tw4l and edsu September 19, 2022 17:59
@ikreymer ikreymer changed the title dependency: update to latest wombat (3.3.7) eval rewrite update + latest wombat (3.3.7) Sep 19, 2022
Copy link
Member

@tw4l tw4l left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me! One nitpick but feel free to ignore it

Comment on lines +23 to +26
if start == 0:
return prefix
if start > 0:
return x[:start] + prefix
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be simplified to:

if start >= 0:
    return x[:start] + prefix

since a [:0] slice of any string is just an empty string. Arguably it's a bit more readable as-is though, so maybe just leave it?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, was thinking about readability, also ported it from:
https://github.com/webrecorder/wabac.js/blob/main/src/rewrite/jsrewriter.js#L38
to have some parity. so perhaps keep as is for now, unless changed in both places?

@ikreymer ikreymer merged commit 98378a8 into main Sep 29, 2022
@ikreymer ikreymer deleted the eval-improve-and-wombat branch September 29, 2022 18:39
omgoo added a commit to mirrorweb/pywb that referenced this pull request Sep 30, 2022
dependency: update to latest wombat (3.3.7) (webrecorder#763)
tw4l pushed a commit that referenced this pull request Oct 19, 2022
eval: switch to new eval rewriting which catches global scope
rxrewriting: remove lookbehind check so that 'return eval(...)' can be rewritten
tests: add additional eval tests

bump to 2.6.9
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.

2 participants