http-on-modify-request observer doesn't seem to be ready at firefox startup

时间:2015-10-06 08:52:18

标签: firefox-addon

For SSO purpose, I have a firefox add-on who add additional headers into each request.

Everything works fine but for "link" like in outlook or third part applications.

After a click, the link will load the page but randomly the add-on seems to be loaded after the first request.

Could it be possible to ensure my observer is clearly loaded before the first request?

var observers = {
    'http-on-modify-request': {
        observe: function(aSubject, aTopic, aData) {
                //some code here            

        },
        reg: function() {
            Services.obs.addObserver(observers['http-on-modify-request'], 'http-on-modify-request', false);
        },
        unreg: function() {
            Services.obs.removeObserver(observers['http-on-modify-request'], 'http-on-modify-request');
        }
    }
};

for (var o in observers) {
    console.log("register observers "+o);
    observers[o].reg();
}

0 个答案:

没有答案