Closed Bug 790328 Opened 12 years ago Closed 12 years ago

Make page script access to message-passing stable

Categories

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

defect

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: wbamberg, Assigned: wbamberg)

References

Details

Attachments

(2 files)

Page scripts loaded from trusted content (that is, content bundled with an add-on and loaded from data/) are allowed to use the postMessage and port APIs, obviating the need for content scripts in these cases.

This feature is still marked as experimental despite being in addon-kit for more than 6 months. We should make it stable so we can remove the unsettling warnings and users can rely on it.

If there's substantial work that needs to be done before we can declare the API stable, we should perhaps track that work using bugs that block this bug, then update the docs and metadata in this bug.
I don't think there is anything to be done in SDK. From what I remember we mainly set these warnings because it was brand new and it didn't received any feedback/tests from users.

I haven't heard about any bug report about that feature.

Wes, can you confirm that?

The only one thing I can think about is modify our examples to use this feature.
Attached file Pull request 566
Here is a refectoring of library detector in order to use `addon` and avoid content scripts.
Attachment #660403 - Flags: review?(rFobic)
Otherwise, while working on library detector, I've remembered about that old issue, bug 731074. It will be even more frustating to have a non-working console object in panel and widget if we move more code to them and have a working `addon`.

Shouldn't we consider it as blocker?
Comment on attachment 660403 [details]
Pull request 566

><html>
><head>
><meta http-equiv="Refresh" content="2; url=https://github.com/mozilla/addon-sdk/pull/566"> 
></head>
><body>
>Redirect to pull request 566
></body>
></html>
Attachment #660403 - Flags: review?(rFobic) → review+
Commits pushed to master at https://github.com/mozilla/addon-sdk

https://github.com/mozilla/addon-sdk/commit/cacbeff84afcaeff0037e092c07e84957edddea0
Bug 790328: Use `addon` in widget/panel documents of library detector.

https://github.com/mozilla/addon-sdk/commit/006f7767a87e833f9d0b15b523fa4117f9132392
Merge pull request #566 from ochameau/bug/790328-library-detector

Bug 790328: Use `addon` in widget/panel documents of library detector. r=@gozala
Wes, could you please add 1.12 target milestone and update this bug?
(do you know if I can add new milestone myself??)
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
I shouldn't have closed this bug... as recent landing is only part of the work needed to make it stable. We still need, at least, the documentation update.
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Target Milestone: --- → 1.12
(In reply to Alexandre Poirot (:ochameau) from comment #7)
> I shouldn't have closed this bug... as recent landing is only part of the
> work needed to make it stable. We still need, at least, the documentation
> update.

Where are we at with this? It's a P1 targeting 1.12, so it'd need to land in the next few weeks to make that target.
Will, is there a docs bug for this?

( note Will is on PTO today & tomorrow )
Flags: needinfo?(wbamberg)
So I landed examples tweaks in order to use `addon` directly from widget/panel/... documents. Now, it is only matter of modifying documentation in order to remove notes about `addon` being experimental.
Example modification landed for 1.12, but there isn't any commitment to land documentation in the same cycle.
Jeff: no, shall I reassign this one to Documentation and take it?

[Aside: ISTR the main reason this feature was made experimental was that we were arguing about the name of the object used in page scripts to send messages ("addon"). See bug 612726, especially bug 612726, comment 22. We're actually in a bit of a mess with the naming of things in this area:
- the message-passing object in page scripts is called "addon"
- the message-passing object in content scripts is called "self"
- there is an unrelated module also called "self"

What I think we would like to do, is rename the object in content scripts to "addon", but this is probably too big a compatibility change to contemplate.]
Flags: needinfo?(wbamberg)
(In reply to Will Bamberg [:wbamberg] from comment #11)
> Jeff: no, shall I reassign this one to Documentation and take it?

Yes please! I nom this for 1.12, as well. 

> What I think we would like to do, is rename the object in content scripts to
> "addon", but this is probably too big a compatibility change to contemplate.]

I agree, but at the very least we'd need to deprecate the use of 'self' in content scripts in favor of 'addon' for ages.
Component: General → Documentation
Assignee: nobody → wbamberg
Attachment #679024 - Flags: review?(jgriffiths)
Comment on attachment 679024 [details]
remove 'experimental' flags

Looks good!
Attachment #679024 - Flags: review?(jgriffiths) → review+
(In reply to Jeff Griffiths (:canuckistani) from comment #12)
> (In reply to Will Bamberg [:wbamberg] from comment #11)
> > What I think we would like to do, is rename the object in content scripts to
> > "addon", but this is probably too big a compatibility change to contemplate.]
> 
> I agree, but at the very least we'd need to deprecate the use of 'self' in
> content scripts in favor of 'addon' for ages.

FYI, `addon` is only injected in Widget, Page-Worker, Panel *documents*. We aren't injecting it (yet) in *content scripts*. Wouldn't we do that now ?
Commit pushed to master at https://github.com/mozilla/addon-sdk

https://github.com/mozilla/addon-sdk/commit/b0acb6243badb322950888ce6a7697d87fd4ee70
Merge pull request #651 from wbamberg/787347

Fix for bug 790328 - Make page script access to message-passing stable
Status: REOPENED → RESOLVED
Closed: 12 years ago12 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: