[scopes] Resolve original scope chains using source map 'scopes' info

The algorithm to obtain the original scope chain is straight-forward:

  1) Find the inner-most generated range that contains the
     CallFrame's paused position.

  2) Does the found range have an associated original scope?

     2a) If no, return null. This is a "hidden" range and technically
         we shouldn't be pausing here in the first place.
         This code doesn't correspond to anything in the authored code.

     2b) If yes, the associated original scope is the inner-most
         original scope in the resulting scope chain.

  3) Walk the parent chain of the found original scope outwards. This is
     our scope view. For each original scope we also try to find a
     corresponding generated range that contains the CallFrame's
     paused position. We need the generated range to resolve variable
     values.

The CL also adds a couple of unit tests to document the existing
behavior and design choices. These might need to be revisited
depending on how source map generators actually choose to emit
scopes.

R=pfaffe@chromium.org

Bug: 40277685
Change-Id: Ia033d3a5f8d1c60be5059c05da770e220940538e
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/5833561
Commit-Queue: Simon Zünd <szuend@chromium.org>
Reviewed-by: Philip Pfaffe <pfaffe@chromium.org>
2 files changed
tree: eec4ff7fea9be25840a85548ca2d4a59e8c3e242
  1. .vscode/
  2. build_overrides/
  3. config/
  4. docs/
  5. extension-api/
  6. extensions/
  7. front_end/
  8. inspector_overlay/
  9. node_modules/
  10. scripts/
  11. test/
  12. third_party/
  13. v8/
  14. .clang-format
  15. .editorconfig
  16. .eslintignore
  17. .eslintrc.js
  18. .git-blame-ignore-revs
  19. .gitallowed
  20. .gitattributes
  21. .gitignore
  22. .gitmodules
  23. .gn
  24. .mailmap
  25. .npmignore
  26. .npmrc
  27. .style.yapf
  28. .stylelintignore
  29. .stylelintrc.json
  30. AUTHORS
  31. BUILD.gn
  32. codereview.settings
  33. CONTRIBUTING.md
  34. DEPS
  35. favicon.ico
  36. LICENSE
  37. OWNERS
  38. package-lock.json
  39. package.json
  40. PRESUBMIT.py
  41. README.md
  42. tsconfig.json
  43. WATCHLISTS
README.md

Chrome DevTools frontend

npm package

The client-side of the Chrome DevTools, including all TypeScript & CSS to run the DevTools webapp.

Source code and documentation

The frontend is available on chromium.googlesource.com. Check out the Chromium DevTools documentation for instructions to set up, use, and maintain a DevTools front-end checkout, as well as design guidelines, and architectural documentation.

Source mirrors

DevTools frontend repository is mirrored on GitHub.

DevTools frontend is also available on NPM as the chrome-devtools-frontend package. It's not currently available via CJS or ES modules, so consuming this package in other tools may require some effort.

The version number of the npm package (e.g. 1.0.373466) refers to the Chromium commit position of latest frontend git commit. It's incremented with every Chromium commit, however the package is updated roughly daily.

Getting in touch

There are a few options to keep an eye on the latest and greatest of DevTools development: