Closed Bug 697590 Opened 13 years ago Closed 10 years ago

`tabs.attach` should provide an `onAttach` property in options like page-mod does.

Categories

(Add-on SDK Graveyard :: General, enhancement, P3)

enhancement

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 755963

People

(Reporter: zer0, Unassigned)

References

Details

There isn't an elegant way to know when a contentScript is attached using tabs API. We should be able to do something like page-mode does, so: tabs.open({ url: url, onReady: function onReady(tab) { tab.attach({ contentScript: "doSomething();", onAttach: function() { console.log("script attached"); } }); } }); At the moment we have to use a workaround with `onMessage` to obtain a similar result: tabs.open({ url: url, onReady: function onReady(tab) { tab.attach({ contentScript: "doSomething();\ self.postMessage(1)", onMessage: function(){ console.log("script attached"); } }); } });
Severity: normal → enhancement
Priority: -- → P3
Assignee: nobody → erikvvold
Status: NEW → ASSIGNED
OS: Mac OS X → All
Hardware: x86 → All
Taking myself off things that I won't be able to get to for awhile.
Assignee: erikvvold → nobody
We plan to deprecate this api, so I don't think making it easier to use is worthwhile. See bug 755963 for more information.
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.