How can popup "openDialog window" communicate with main.js?

Hello,
My extension (main.js) opens a new popup window thanks to this code;

var win = require('sdk/window/utils').openDialog({
        url:"http://www.example.com/index.html",
        features: Object.keys({
            resizable: true,
            scrollbars: true
        }).join(),
        name: "myWin"    
    });

I need to send information from index.html to main.js : I tried with pagemod with no success: Can someone help me with that ?

You have to listen to new windows/tabs opening and attach worker to that when it does. Not sure how to do that though.