test-closure-optimized-out.html 1.1 KB

1234567891011121314151617181920212223242526272829303132333435
  1. <!DOCTYPE HTML>
  2. <html>
  3. <head>
  4. <meta charset='utf-8'/>
  5. <title>Debugger Test for Inspecting Optimized-Out Variables</title>
  6. <!-- Any copyright is dedicated to the Public Domain.
  7. http://creativecommons.org/publicdomain/zero/1.0/ -->
  8. <script type="text/javascript">
  9. window.addEventListener("load", function onload() {
  10. window.removeEventListener("load", onload);
  11. function clickHandler(event) {
  12. button.removeEventListener("click", clickHandler, false);
  13. function outer(arg) {
  14. var upvar = arg * 2;
  15. // The inner lambda only aliases arg, so the frontend alias analysis decides
  16. // that upvar is not aliased and is not in the CallObject.
  17. return function () {
  18. arg += 2;
  19. };
  20. }
  21. var f = outer(42);
  22. f();
  23. }
  24. var button = document.querySelector("button");
  25. button.addEventListener("click", clickHandler, false);
  26. });
  27. </script>
  28. </head>
  29. <body>
  30. <button>Click me!</button>
  31. </body>
  32. </html>