简体   繁体   中英

List and call js functions from a newly loaded tab from firefox extension

I am interested in scanning a new opened tab's content for any javascript functions that are on the page, and being able to call them. What is the proper way to do this?

I have a handle to the tab, because I am using

tabs.on('ready, function (tab) {
    var functionNames = [];
    for (var f in tab) {
        if(tab.hasOwnProperty(f) && typeof tab[f] === 'function') { functionNames.push(f);
        }
    }
console.log(functionNames);
}

However, this gives me an error that tab does not have hasOwnProperty

I have tried to change it to this and window as well and neither have worked.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM