currentExecutingScript icon indicating copy to clipboard operation
currentExecutingScript copied to clipboard

Attempt to improve locating of correct inline scripts via function source code

Open JamesMGreene opened this issue 10 years ago • 2 comments

Critical Piece: Being able to get the function reference to the calling function, e.g. via _nearestExecutingScript.caller/arguments.callee.caller/arguments.caller. Seems like "use strict" (JS strict mode) usage will make this next to impossible/useless. :disappointed:

Research:

  • http://jsbin.com/zifadipivo/12/edit
  • http://jsbin.com/zifadipivo/12/
  • http://jsbin.com/zifadipivo/12/?v8Hack=true

JamesMGreene avatar Mar 18 '15 19:03 JamesMGreene

Further reading: http://stackoverflow.com/questions/16871050/inconsistent-scope-of-use-strict-on-different-web-browsers-concerning-argumen

JamesMGreene avatar Mar 20 '15 18:03 JamesMGreene

Easily detect if executing in a strict mode context:

var isStrictMode = (function() { return !this; })();

JamesMGreene avatar Dec 23 '15 06:12 JamesMGreene