Help with the developer tools

Hey,

I’m rather inexperienced with the Firefox developer tools and theyare driving me nuts.

I want to use a content script for mailinator.com to switch to a specific inbox. The inbox is not in the URL so I needed to figure out how this is done on the website (POST, AJAX, …)

On the website you enter the code for the inbox and press the “go” button (upper right side). So I open network analysis tab, click “go” and I see - nothing!. The inbox is changed but no network traffic is shown in the web console (everything/all is selected)

  1. How can the new inbox be shown correctly, if according to web console, no network transaction occured?

So I’m using the inspector on the “go” button and I found out that a javascript function is called: “subInboxSameZone(“INBOX”);” is the function and using the console of the web console I can successfully use subInboxSameZone(“INBOX2”); to change the inbox - however the next line of the console prints “undefined”.

  1. is undefined the return value? Answer: Yes, it is

So I call this function from the content script and guess what: I get a “is not defined” error for that function.

  1. Is this because of the “Xray vision”? Answer: Yes it seems like according to https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Sharing_objects_with_page_scripts

So I want to see the source code of this function. I go to debug tab, ctrl+shift+f and search in all files for subInboxSameZone - 3 matches, but none of them is the definition. I keep switching around and testing a bit, search again and suddenly the definition is found in m8rv3.js

  1. Why was the definition not found during the first search attempt?

I then noticed that now there is a websocket connection listed in the network analysis tab:
https://www.mailinator.com/ws/fetchinbox?zone=public&query=INBOX

so I modify & resend it just appending a 2
https://www.mailinator.com/ws/fetchinbox?zone=public&query=INBOX2

and the tab crashes.

  1. why does this crash the tab? (can be reproduced)

finally being able to call the function window.wrappedJSObject.subInboxSameZone(“INBOX”)
it is sometimes successful and sometimes not (in content script. it always works in web console). probably a race condition with the script being executed to early. So I use
window.onload = function (){
window.wrappedJSObject.subInboxSameZone(“INBOX”)}

and the code is sometimes executed, sometimes not. probably because unload just may take 10s of seconds to happen (just a guess) so I try a sleep instead - well, if there was a sleep command … using

new Promise(resolve => setTimeout(resolve, 300000)).then(console.log(“continue”))

does wait 30 seconds in the console, but if executed as a content script it does not. furthermore afterwards this using

window.wrappedJSObject.subInboxSameZone

returns an “scope is undefined” error

  1. why is the scope undefined? why does the “sleep” not work in the content script?

Edit: The solution for the basic issue was the “RunAt” parameter. I used "document_end" and the race condition was probably the other way around. being injected at document.onload the contentscript may either be injected before window.onload happens (and therefore be executed) or after it happens (and never be triggered in that case)
However I would still be thankful fur solutions to the open questions.

Thank you very much

Not really an answer to your problems with the devtools, but maybe this helps with the intended task:

Try using the UI to accomplish your task. I.e. programmatically find the input box, enter your text, press go.