Closed Bug 1195589 Opened 4 years ago Closed 4 years ago

addon is not defined in page-worker


(Add-on SDK Graveyard :: General, defect, P1, blocker)



(firefox41 fixed, firefox42 fixed, firefox43 verified)

Tracking Status
firefox41 --- fixed
firefox42 --- fixed
firefox43 --- verified


(Reporter: sriharsha.angara, Assigned: mossop, NeedInfo)




(1 file)

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_4) AppleWebKit/600.7.12 (KHTML, like Gecko) Version/8.0.7 Safari/600.7.12

Steps to reproduce:

I am following the steps on this link below

In my content script that gets loaded by the page-worker. 

When I try to access the global "addon" object

Actual results:

Error message is received: ReferenceError: addon is not defined

Expected results:

Addon object should be available.
OS: Unspecified → Mac OS X
Priority: -- → P2
Hardware: Unspecified → x86_64
Version: Trunk → 40 Branch
Messaging between pageworker's trusted content scripts and main.js is broken. This is a blocker for us. Can someone help us out please ?
Severity: normal → blocker
Priority: P2 → P1
Component: Untriaged → General
Product: Firefox → Add-on SDK
Version: 40 Branch → unspecified
Mossop, do you know if this is a regression or an intentional change?
Flags: needinfo?(dtownsend)
(In reply to Jorge Villalobos [:jorgev] from comment #2)
> Mossop, do you know if this is a regression or an intentional change?

I doubt it is intentional. Do we know which version of Firefox this started with?
Flags: needinfo?(dtownsend)
The problem started with firefox 40. Firefox 39 works just fine.
From a different developer (possibly the same problem):

> After many hours of mucking around, it seems that the old postMessage message passing functionality to
> and from a PageWorker was broken:  
> Previously, if you created a page with:
> page = pageWorker.Page({ ... })
> you could pass messages to it using page.postMessage, and receive messages using self.on. 
> This seems to still work correctly with PageMod, but not when creating a page with PageWorker.
Broken by bug 870677
Blocks: 870677
Attached patch patchSplinter Review
There turn out to be two bugs here. The first makes page.contentURL be null until the page loads properly since it uses the data-src attribute which isn't set in the constructor. That means addon isn't defined until after the load. The second bug is that add-on doesn't get defined at all when using the new e10s compatible worker. The simple fix here is to switch back to the sync loader and since page-worker doesn't load anything remotely that shouldn't cause any issues.
Assignee: nobody → dtownsend
Ever confirmed: true
Attachment #8652414 - Flags: review?(jsantell)
Attachment #8652414 - Flags: review?(jsantell) → review+
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla43
will this fix be ported into  FF40.0.3?
or atleast "beta" channel?

this bug is blocker.
(In reply to nkanand from comment #10)
> will this fix be ported into  FF40.0.3?

No, we generally only take security fixes on the release channel.

> or atleast "beta" channel?

I'll be nominating it after it has baked on nightly for a few days, I would guess at a good chance for aurora, not so sure about beta at this point.
Comment on attachment 8652414 [details] [diff] [review]

Approval Request Comment
[Feature/regressing bug #]: Certain parts of the page-worker SDK module have been broken, most recent breakage affects Firefox 40.
[User impact if declined]: Some add-ons won't work
[Describe test coverage new/current, TreeHerder]: On m-c with automated tests
[Risks and why]: Low risk, only affects add-on SDK code and has tests to ensure it does what it means to
[String/UUID change made/needed]: None
Attachment #8652414 - Flags: approval-mozilla-beta?
Attachment #8652414 - Flags: approval-mozilla-aurora?
Comment on attachment 8652414 [details] [diff] [review]

Sure, let's take it for aurora. Ritu will make the call for 41.
Attachment #8652414 - Flags: approval-mozilla-aurora? → approval-mozilla-aurora+
Dimitri, Nkanand, could you please verify this fix works well on the latest Nightly 8/27 or later build? Thanks.
Flags: needinfo?(sriharsha.angara)
Flags: needinfo?(nkanand)
Comment on attachment 8652414 [details] [diff] [review]

Approving for uplift to Beta41 as this is a severe issue and the patch seems simple. It is also nice to see more automated tests for this one.
Attachment #8652414 - Flags: approval-mozilla-beta? → approval-mozilla-beta+
Fix looks good in Firefox nightly. Thank you!
Flags: needinfo?(sriharsha.angara)
Thanks Dimitri. Based on comment 18, updating status to verified where relevant.
Commit pushed to master at
Bug 1195589: addon is not defined in page-worker scripts. r=jsantell
You need to log in before you can comment on or make changes to this bug.