Closed
Bug 668985
Opened 13 years ago
Closed 13 years ago
use of "self" module methods in content scripts is unclear
Categories
(Add-on SDK Graveyard :: Documentation, defect, P2)
Tracking
(Not tracked)
RESOLVED
FIXED
1.1
People
(Reporter: d_jan, Assigned: wbamberg)
Details
(Whiteboard: [cherry-pick-1.1])
Attachments
(1 file)
3.06 KB,
patch
|
warner
:
review+
|
Details | Diff | Splinter Review |
User Agent: Mozilla/5.0 (Windows NT 5.1; rv:5.0) Gecko/20100101 Firefox/5.0 Build ID: 20110615151330 Steps to reproduce: I wanted to find informations on what the "self"-object is and which methods it has. Actual results: I found a small section on self in the "addon-kit" section of the SDK documentation, listing two methods. In the section Programming Guides/Working with Content Scripts there are semingly methods of "self" described that were not included in the add-on-kit/self section: - self.port.on - self.port.emit Reading in the Content Scripts-Section it seems that these seem to be related to the contend script rather than to the add-on as a whole but this would be in contradiction with the statement "The self module provides access to data that is bundled with the add-on as a whole" Expected results: It should be described in the "self" section when and why methods like self.port.on and self.port.emit can be awoken on the self object.
Assignee | ||
Updated•13 years ago
|
Assignee: nobody → wbamberg
Updated•13 years ago
|
Status: UNCONFIRMED → NEW
Ever confirmed: true
Priority: -- → P2
Target Milestone: --- → 1.1
Assignee | ||
Comment 1•13 years ago
|
||
I think this is quite an unfortunate naming clash. All I've done here is added some text in the places where it might be helpful, to clarify that the two things called 'self' are completely different.
Attachment #551902 -
Flags: review?(warner-bugzilla)
Comment 2•13 years ago
|
||
Comment on attachment 551902 [details] [diff] [review] Clarified that self module is different from the content script global self object Looks good. Yeah, this is a really unfortunate collision. Maybe we should consider renaming require("self").. require("addon") ? "main"? "aboutme"?
Attachment #551902 -
Flags: review?(warner-bugzilla) → review+
Could be painful for addon devs to change "self" to something else at this point. Of the suggested new names, though, "addon" makes the most sense to me.
Assignee | ||
Comment 4•13 years ago
|
||
Thanks Brian! Fixed in https://github.com/mozilla/addon-sdk/commit/e5c289eac375d2d7d69c62c3e4c492acc66a0072 I think "addon" is a good suggestion, too - except that not all packages are addons. require("package")? I don't know whether it's already too late to make the change (obviously the old way would still be supported, but at least newcomers would be spared the confusion).
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Updated•13 years ago
|
Whiteboard: [cherry-pick-1.1]
Comment 5•13 years ago
|
||
Cherry pick commit: https://github.com/mozilla/addon-sdk/commit/d18507bcf6bfc374b4a56b774f234c30d8c38072
You need to log in
before you can comment on or make changes to this bug.
Description
•