Debugging in Browser Toolbox

Disclaim: I’m new to Webextension development, so this is definitely a dumb question for most of you,

I’m trying the feature of debugging in Browser Toolbox.

After set a break point, I’ve found that my breakpoint not always get called, the breakpoint is inside a callback function of MutationObserver.

Inside the document, it explicitly says that it called “… which will be called on each DOM mutation”.

https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver

But when I test, if I reload the page, the breakpoint won’t be called, I don’t understand why. I thought at this moment, everything should be reload and get called.

The page being loaded is not not a DOM mutation, that is the creation of the DOM. And your script probably runs after the DOM has been loaded and is in place and then attaches the observer. (Content scripts are re-attached every time a page is loaded)