Closed Bug 651102 Opened 13 years ago Closed 13 years ago

Document new worker event 'detach'

Categories

(Add-on SDK Graveyard :: Documentation, defect, P2)

defect

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: ochameau, Assigned: wbamberg)

References

Details

(Whiteboard: [cherry-pick-1.0b5])

Attachments

(1 file, 2 obsolete files)

Attached patch Preliminary doc (obsolete) — Splinter Review
A new `detach` event is dispatched on worker object when target document unload. (tab close, window close or document reload)

I sent a first patch that add some lines in worker.md, but I remember that there is others locations to add such documentation ?
Following bug 607601, we need to document: 
1/ behavior of all Worker objects:
They are destroyed on document unload, it's obvious for page-mod, but it can be more complicated in tab.attach. (if we call attach before the tab is ready, when it loads an about:blank document before the real page)

2/ And they dispatch a new event called `detach` when they are manually or automatically destroyed.
Assignee: nobody → wbamberg
Priority: -- → P2
Target Milestone: --- → 1.0
Here is a first step to provide document in interfaces.

Then we will need to add some notes in:
- content script guide to speak about 'detach' event
http://127.0.0.1:8888/dev-guide/addon-development/web-content.html
- page-mod doc to tell that workers are destroyed on tab close or the document is unloaded from the tab [to make it simple, when the location change, but in reality, it's only when document goes out from the bfcache]
http://127.0.0.1:8888/packages/addon-kit/docs/page-mod.html
Attachment #526963 - Attachment is obsolete: true
Attachment #528586 - Flags: review?
Attachment #528586 - Flags: review? → review?(wbamberg)
> Then we will need to add some notes in:
> - content script guide to speak about 'detach' event
> http://127.0.0.1:8888/dev-guide/addon-development/web-content.html

Hm. I didn't do this because we don't really talk explicitly about worker in that guide, because for the most part worker's APIs are exposed through higher-level APIs.

Apart from listening to page-mod's detach event, are there other obvious applications for detach that need to be captured here?
Attachment #528586 - Attachment is obsolete: true
Attachment #528586 - Flags: review?(wbamberg)
Attachment #529757 - Flags: review?(myk)
Attachment #529757 - Flags: feedback?(poirot.alex)
Comment on attachment 529757 [details] [diff] [review]
Document worker's detach event in worker and page-mod

r=myk, a=myk for checkin during freeze
Attachment #529757 - Flags: review?(myk) → review+
Whiteboard: [cherry-pick-wanted]
Fixed by: https://github.com/mozilla/addon-sdk/commit/3f41c8285b25d3db9b5a0e109c3e5da860c41810
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Keywords: checkin-needed
Whiteboard: [cherry-pick-wanted] → [cherry-pick-1.0b5]
(In reply to comment #3)
> Hm. I didn't do this because we don't really talk explicitly about worker in
> that guide, because for the most part worker's APIs are exposed through
> higher-level APIs.
> 
> Apart from listening to page-mod's detach event, are there other obvious
> applications for detach that need to be captured here?

The only common use case I'm thinking about is `tab.attach` in order to detect location change.
Comment on attachment 529757 [details] [diff] [review]
Document worker's detach event in worker and page-mod

I forgot to change the flag long time ago.
Attachment #529757 - Flags: feedback?(poirot.alex) → feedback+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: