使用Web扩展名编辑新打开的选项卡的形式

时间:2018-09-21 09:42:20

标签: firefox-webextensions

我正在编写一个扩展程序,该扩展程序将(例如)打开一个新标签并在新创建的标签内的input元素上设置一个值。

        var creating = browser.tabs.create({
            url: "https://myloginform.html"
        });
        creating.then(onCreated, onError);

        function onCreated(){
            console.log('here');
        }

        function onError(){
        }

input元素是用户名字段。

问题是onCreated似乎没有被触发,在我的扩展控制台中,出现以下错误:

Cannot send function call result: other side closed connection (call data: ({path:"tabs.create", args:[{active:null, cookieStoreId:null, index:null, openInReaderMode:null, openerTabId:null, pinned:null, url:"https://myloginform.html", windowId:null}]}))

感谢您的帮助。

我的扩展程序示例:

enter image description here

0 个答案:

没有答案