pywb icon indicating copy to clipboard operation
pywb copied to clipboard

`this` rewriting can affect dynamically generated content on the page

Open the-blank-x opened this issue 1 year ago • 0 comments

Describe the bug

pywb rewrites all this uses to use a wrapper. However, the rewriting can be a bit overzealous, since it does so inside strings. For example, document.querySelector("p").innerText = "well, this is awkward" gets rewritten into document.querySelector("p").innerText = "well, _____WB$wombat$check$this$function_____(this) is awkward"

Steps to reproduce the bug

  1. Download test.warc.gz
  2. wb-manager init test
  3. wb-manager add test test.warc.gz
  4. Go to http://localhost:8080/test/http://localhost:8000/ (for an example), or http://localhost:8080/test/https://stainedglasswoman.substack.com/p/slivers (for an occurance in the wild)

Expected behavior

The rewrite to not hapen inside strings

Screenshots

Environment

  • OS: Arch Linux
  • Browser: Librewolf
  • Version: 121.0-1

the-blank-x avatar Jan 20 '24 02:01 the-blank-x