How to access incremental script content in Firefox console?

I developed an add-on for Firefox and Chrome. He has content scripts. I want to access them in the browser console (in Firefox web console ). For example, I want to enter a global variable defined in the script (s) content and output its value.

In Chrome, I can open the console by clicking F12, then go to the Console tab in the developer tools. It has a dropbox right after the filter button to select in which context I am participating (page / content script):

In Firefox, how to do the same?

+4
2

/ - ( Ctrl - Shift - K F12 Console), , , . , Firefox. A /RFE ​​ Bugzilla ; . , RFE , / script ( ). , .

. / iframe, , :

Change to iframe

, DevTools " iframe ". A) script / B) - ( Firefox Nightly (54.0a1).

-

- (Ctrl - Shift - S F12 Debugger) WebExtension. "" URL moz-extension://. UUID, . , .. . debugger; JavaScript, iframe, .

- script ( ):

Web Debugger debugging content script (in top frame)

script

, - script, , Debug about:debugging. script.

iframe

: , iframe, ; :

  • console.log() , , script , iframe. :

    console.log('In iframe', 'foo=', foo);
    

    'In iframe' console.log(), , . console.log(), - console.log().

    , , iframe. , , - script, , iframe.

    , iframe.

  • DOM Element.dataset DOM, DOM , , , DOM Inspector :

    enter image description here

    , iframe , iframe, , iframe, , iframe iframe .

+2

Firefox Developer Edition "about: debugging" "" , dev.

0

Source: https://habr.com/ru/post/1671325/


All Articles