7

I want to be able to break on postmessage in Chrome Developer Tools, but it appears there's no such option:

text

Is it possible to conveniently break on postmessage without specifically searching the line in source code?

Edit: Someone suggested the question is a duplicate of this post: Any good debugger for HTML5 Javascript postMessage API?

The answer features Firebug extension, however, Firebug is no longer available (https://blog.getfirebug.com/)

userQWERTY
  • 501
  • 1
  • 5
  • 12
  • Possible duplicate of [Any good debugger for HTML5 Javascript postMessage API?](https://stackoverflow.com/questions/3053809/any-good-debugger-for-html5-javascript-postmessage-api) – Alexander Nied Oct 17 '19 at 04:57
  • While not breaking, you can see them in [the global listeners pane](https://www.sjoerdlangkemper.nl/2018/05/09/attacking-postmessage-interfaces/). – Alexander Nied Oct 17 '19 at 04:58

1 Answers1

6

If you are using the browser's console, you can run debug(window.postMessage) there to make the execution stop when the next postMessage call is made.

Elias Zamaria
  • 96,623
  • 33
  • 114
  • 148
pingu
  • 106
  • 3
  • I am still looking for a way to do this programmatically using the DevTools Protocol ([Question](https://stackoverflow.com/questions/58403514/using-the-chrome-devtools-protocol-to-log-js-function-calls)). – pingu Oct 18 '19 at 21:07
  • how do you look for incoming messages? – Muhammad Umer Feb 16 '22 at 17:44