Unit testing page-mod script

9 views
Skip to first unread message

Eric Kelm

unread,
Sep 11, 2015, 12:20:43 PM9/11/15
to mozilla-labs-jetpack
All,

I have a plugin which I am updating from the old API (< FF 21) to the current API. The old plugin used to write a JavaScript variable directly to unsafeWindow, which was read in by our web application. That usage is deprecated and no longer available.

I have converted the plugin to instead use page-mod to include a script, which uses window.postMessage to inject the value into the window. Also, our app has been modified to listen for the message from the plugin script. My question is around unit testing. I cannot figure out how to write a unit test that can assert that the pageMod script has executed and posted a message to the current(?) window object.

Any help would be appreciated. Thanks in advance!

-Eric
Reply all
Reply to author
Forward
0 new messages