2

Well, I'm trying to execute a function inside a minified Javascript in order to reproduce the behaviour of a context menu function.

I used Chrome dev tools with Event listeners breakpoints, as Rory suggested me on this comment. And I discovered that the callback of the context menu event comes from this path:

window.webpackJsonp[1][1][5754]

With this anonymous function after an indexer:

5754: function(t, n, e) {
            "use strict";
// ...
}

On this question, somebody suggested to use this code:

eval(doSomething.toString().replace(/}\s*$/, ' return id; $&');

I tried to inject this code:

eval(window.webpackJsonp[1][1][5754].toString().replace(/}\s*$/, ' console.log(t); console.log(n); console.log(e); $&'));

I used console.log to know which objects are related to this arguments.

But this error prompted:

Uncaught SyntaxError: Function statements require a function name.

So I don't know where to continue...

z3nth10n
  • 2,341
  • 2
  • 25
  • 49

1 Answers1

0

Changing eval(...) to eval('(' + ... + ')') works for me. The definition at https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/eval says eval takes either expressions, e.g., function () {} or statements, e.g., function foo () {} so you've been bitten by an eval implementation bug.

Devon
  • 1,019
  • 9
  • 20