PageMod attaching worker to same URL multiple times

后端 未结 2 1492
心在旅途
心在旅途 2020-12-19 03:50

CLEAN SOLUTION FOUND

I found a very clean solution which really renders this whole question pointless, and I am certain it existed when I asked this

2条回答
  •  既然无缘
    2020-12-19 04:15

    Here's a link to the Mozilla documentation you can use the attachTo setting. The default setting of 'all' includes iframes, so you should do something like the following

    var pageMod = require("sdk/page-mod");
      pageMod.PageMod({
      include: "*",
      contentScript: "",
      attachTo: ["existing", "top"],
      onAttach: function(worker) {
       console.log(worker.tab.url);
     }
    });
    

提交回复
热议问题