I am not able to work with native messaging api for the firefox extension. all my code is working fine in chrome browser while in firefox i am getting can not covert null to object error.
I’d recommend you ditch all that page/jquery/scripts/events stuff an create a minimal example that directly opens the native messaging port when it is loaded.
If you still get an error, format your code properly (or upload it e.g. to GitHub) an tell us where exactly you get the error (stack trace).