How to use Firefox Browser plugins in Firefox OS (b2g)

 I have a HTML/CSS/JS application. For that application to work, we also ha=
ve a browser npapi plugin ".so" file that is installed in plugins dir of fi=
refox. This works on firefox browser on Linux. Now I want my application to=
 run on Firefox OS (B2G). How do I port that ".so" plugin to firefox OS?.

What I have done is, I have built B2G and flashed it on my test device. I h=
ave built my application plugin for android platform by using gecko sdk and=
 firefox OS source. I have pushed my .so file in FFOS phone in /system/lib =
as well as /system/b2g (the folders where I can see other .so files.). Is t=
hat the correct approach? What else do I need to do to make it work. Curren=
tly my application is unable to load that plugin ( I checked using ./run-gd=
b ). =20
0
Syed
2/27/2014 1:27:52 AM
mozilla.dev.b2g 4036 articles. 0 followers. Post Follow

12 Replies
1205 Views

Similar Articles

[PageSpeed] 54

On 26/02/14 08:27 PM, Syed Qutub wrote:
>  I have a HTML/CSS/JS application. For that application to work, we also have a browser npapi plugin ".so" file that is installed in plugins dir of firefox. This works on firefox browser on Linux. Now I want my application to run on Firefox OS (B2G). How do I port that ".so" plugin to firefox OS?.

NPAPI isn't supported on Firefox OS and won't be. The platform is the
web and NPAPI isn't part of that.

Hub
0
ISO
2/27/2014 1:40:47 AM
On Wednesday, February 26, 2014 5:40:47 PM UTC-8, Hubert Figui=E8re wrote:
> On 26/02/14 08:27 PM, Syed Qutub wrote:
>=20
> >  I have a HTML/CSS/JS application. For that application to work, we als=
o have a browser npapi plugin ".so" file that is installed in plugins dir o=
f firefox. This works on firefox browser on Linux. Now I want my applicatio=
n to run on Firefox OS (B2G). How do I port that ".so" plugin to firefox OS=
?.
>=20
>=20
>=20
> NPAPI isn't supported on Firefox OS and won't be. The platform is the
>=20
> web and NPAPI isn't part of that.
>=20

Thanks Hub, I am sorry, didn't know that.=20
But I do see a lot of source and compiled .o files for npapi within firefox=
 OS source code tree under 'gecko/dom/plugins/base/' and 'objdir-gecko/dom/=
plugins/base/'. What are these about?=20

 So any suggestions on specifically what other options do I have in this sc=
enario?=20

Thanks.

>=20
>=20
> Hub
0
Syed
2/27/2014 3:10:33 AM
Hi Syed,

On 02/26/2014 07:10 PM, Syed Qutub wrote:

> Thanks Hub, I am sorry, didn't know that. 
> But I do see a lot of source and compiled .o files for npapi within firefox OS source code tree under 'gecko/dom/plugins/base/' and 'objdir-gecko/dom/plugins/base/'. What are these about? 

Yes, these are leftovers we should not even compile on b2g.

>  So any suggestions on specifically what other options do I have in this scenario? 

Can you compile you c++ code to js with emscripten (http://emscripten.org) ?

	Fabrice
-- 
Fabrice Desr�
b2g team
Mozilla Corporation
0
ISO
2/27/2014 4:44:02 AM
On Wednesday, February 26, 2014 8:44:02 PM UTC-8, Fabrice Desr=E9 wrote:
> Hi Syed,
>=20
>=20
>=20
> On 02/26/2014 07:10 PM, Syed Qutub wrote:
>=20
>=20
>=20
> > Thanks Hub, I am sorry, didn't know that.=20
>=20
> > But I do see a lot of source and compiled .o files for npapi within fir=
efox OS source code tree under 'gecko/dom/plugins/base/' and 'objdir-gecko/=
dom/plugins/base/'. What are these about?=20
>=20
>=20
>=20
> Yes, these are leftovers we should not even compile on b2g.
>=20
>=20
>=20
> >  So any suggestions on specifically what other options do I have in thi=
s scenario?=20
>=20
>=20
>=20
> Can you compile you c++ code to js with emscripten (http://emscripten.org=
) ?
>=20

Hi Fabrice

I would certainly give it a try and see if it works for me. Thanks for the =
suggestion.

Someone else also suggested me to use webidl. I am not very familiar with i=
t yet, but do you think it will be feasible if someone has a big project wi=
th lots of code?.

Syed

>=20
>=20
> 	Fabrice
>=20
> --=20
>=20
> Fabrice Desr=E9
>=20
> b2g team
>=20
> Mozilla Corporation

0
Syed
2/27/2014 8:25:42 PM
On Wednesday, February 26, 2014 8:44:02 PM UTC-8, Fabrice Desr=E9 wrote:
> Hi Syed,
>=20
> >  So any suggestions on specifically what other options do I have in thi=
s scenario?=20
>=20
>=20
>=20
> Can you compile you c++ code to js with emscripten (http://emscripten.org=
) ?
>=20
Hi Fabrice=20

I would certainly give it a try and see if it works for me. Thanks for the =
suggestion.=20

Someone else also suggested me to use webidl. I am not very familiar with i=
t yet, but do you think it will be feasible if someone has a big project wi=
th lots of code?.=20

Syed=20
>=20
>=20
> 	Fabrice
>=20
> --=20
>=20
> Fabrice Desr=E9
>=20
> b2g team
>=20
> Mozilla Corporation
0
Syed
2/27/2014 8:26:43 PM
On 02/27/2014 12:25 PM, Syed Qutub wrote:
> 
> Hi Fabrice
> 
> I would certainly give it a try and see if it works for me. Thanks for the suggestion.
> 
> Someone else also suggested me to use webidl. I am not very familiar with it yet, but do you think it will be feasible if someone has a big project with lots of code?.

webidl is used to implement internal APIs, so I don't think you should
use that (you would need to fork gecko).

	Fabrice
-- 
Fabrice Desr�
b2g team
Mozilla Corporation
0
ISO
3/1/2014 11:32:13 PM
On Wednesday, February 26, 2014 8:44:02 PM UTC-8, Fabrice Desr=E9 wrote:
> Hi Syed,
>=20
>=20
>=20
> On 02/26/2014 07:10 PM, Syed Qutub wrote:
>=20
>=20
>=20
>=20
> >  So any suggestions on specifically what other options do I have in thi=
s scenario?=20
>=20
>=20
>=20
> Can you compile you c++ code to js with emscripten (http://emscripten.org=
) ?
>=20
>=20

It is a big project with complexities of its own, so I'm running into sever=
al issues trying to port it to js.=20

Actually I have already built binaries of my project (including a daemon) f=
or FFOS platform, and I have tested them by running on command line using a=
db shell. If I could make a sample user javascript app talk to that daemon,=
 it would be great on its own. Any advice?

>=20
> 	Fabrice
>=20
> --=20
>=20
> Fabrice Desr=E9
>=20
> b2g team
>=20
> Mozilla Corporation

0
Syed
3/5/2014 2:27:19 AM
On Wednesday, February 26, 2014 8:44:02 PM UTC-8, Fabrice Desr=E9 wrote:
> Hi Syed,
>=20
>=20
>=20
> >  So any suggestions on specifically what other options do I have in thi=
s scenario?=20
>=20
>=20
>=20
> Can you compile you c++ code to js with emscripten (http://emscripten.org=
) ?
>=20
>=20

I am trying to compile the code with emscripten but since our project is bi=
g with its own complexities, I am having issues.=20

What I am currently looking for is something quick to show that our project=
 would work on FFOS. It is supposed to serve as proof of concept and demo o=
f our project on FFOS.=20

I already have built binaries of the main program/daemon of the project for=
 FFOS platform, and tested it using adb shell. If I could make user web app=
 talk to our daemon, it would be great.

>=20
> 	Fabrice
>=20
> --=20
>=20
> Fabrice Desr=E9
>=20
> b2g team
>=20
> Mozilla Corporation
0
Syed
3/5/2014 11:20:02 PM
On Wed, Feb 26, 2014 at 8:44 PM, Fabrice Desr=E9 <fabrice@mozilla.com> wrot=
e:

>
> >  So any suggestions on specifically what other options do I have in thi=
s
> scenario?
>
> Can you compile you c++ code to js with emscripten (http://emscripten.org=
)
> ?
>
>
I am trying to use emscripten but given the size and complexity of our
project, we are facing several issues here. Secondly we need some low-level
functionality, e.g. I am not sure (plz correct me) if we can create a UDP
packet or send out a multicast packet, or connect to a tcp port by using
Javascript only?. So porting our whole C++ project to Javascript may not be
of much use?.

What I already have is: executable binaries of our core daemon for FFOS
platform. I have also tested it successfully on a test device running b2g
by using adb shell command line and running that daemon. What I am looking
for is a quick way to make our JS application talk to our daemon which
listens on a specific tcp port.

 Any suggestions in this regard?
Thanks

Syed.





>          Fabrice
> --
> Fabrice Desr=E9
> b2g team
> Mozilla Corporation
>
0
Syed
3/7/2014 11:11:03 PM
On 3/7/14, 3:11 PM, Syed Qutub wrote:
> On Wed, Feb 26, 2014 at 8:44 PM, Fabrice Desr� <fabrice@mozilla.com> wrote:
>
>>>   So any suggestions on specifically what other options do I have in this
>> scenario?
>>
>> Can you compile you c++ code to js with emscripten (http://emscripten.org)
>> ?
>>
>>
> I am trying to use emscripten but given the size and complexity of our
> project, we are facing several issues here. Secondly we need some low-level
> functionality, e.g. I am not sure (plz correct me) if we can create a UDP
> packet or send out a multicast packet, or connect to a tcp port by using
> Javascript only?. So porting our whole C++ project to Javascript may not be
> of much use?.

TCP Socket is already working:

https://developer.mozilla.org/en-US/docs/WebAPI/TCP_Socket

https://developer.mozilla.org/en-US/docs/Web/API/TCPSocket

UDP is hopefully coming soon:

https://bugzilla.mozilla.org/show_bug.cgi?id=745283

For multicast I am not sure. We may need to file a bug for that one.


> What I already have is: executable binaries of our core daemon for FFOS
> platform. I have also tested it successfully on a test device running b2g
> by using adb shell command line and running that daemon. What I am looking
> for is a quick way to make our JS application talk to our daemon which
> listens on a specific tcp port.

You are not going to be able to easily distribute this application to 
users without physically getting the phone and doing some custom 
flashing. Firefox OS is designed only to run application code written in 
Javascript.

With that being said, TCPSocket is available for use right now. See the 
above documentation.

Donovan

0
Donovan
3/11/2014 5:21:29 PM
>> But I do see a lot of source and compiled .o files for npapi within firefox OS source code tree under 'gecko/dom/plugins/base/' and 'objdir-gecko/dom/plugins/base/'. What are these about?
>
> Yes, these are leftovers we should not even compile on b2g.

I filed bug 982282 [1] to stop compiling these files.

-Gary

[1] https://bugzilla.mozilla.org/show_bug.cgi?id=982282

0
Gary
3/11/2014 8:26:31 PM

 Why I am unable to post to this thread any more? I tried posting here as a reply to other posts, as well as email, but email says I am not a member, although I am. Please help.
0
Syed
3/11/2014 9:34:42 PM
Reply: