Closed Bug 1481225 Opened 6 years ago Closed 6 years ago

Issue for firefox extension native app

Categories

(WebExtensions :: Untriaged, defect)

61 Branch
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED WORKSFORME

People

(Reporter: santiaguzz, Unassigned)

Details

Attachments

(1 file)

User Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:61.0) Gecko/20100101 Firefox/61.0
Build ID: 20180704194937

Steps to reproduce:

I'm trying to develop a new extension for Firefox similar to greasemonkey, able to run scripts at any site allowing them. Until now my scripts where stored in browser storage. I'm now trying to store the data in a database connected trough a very simple native app. First I did try connecting a Port, which lead me to lost messages when the use is intensive. I'm now switching to "sendNativeMessage" which at first sight solved my problems. you can find the actual code at: https://github.com/szz-dvl/JSLoader last working commit using storage: b010d60ac364e9b2df8979f42d56d71d6ba80473, following commits use DB instead.

Thanks for reading.


Actual results:

My extension is slowing a lot Firefox and I'm getting the following messages in console:

TypeError: this.proc is null[Learn More] NativeMessaging.jsm:254:9
[Show/hide message details.] Unable to create pipe NativeMessaging.jsm:99
NativeApp</this.startupPromise<
resource://gre/modules/NativeMessaging.jsm:99:9

and:

 [Show/hide message details.] response is undefined include.preload.js:757
apply/<
moz-extension://451f5e18-83b2-4848-bdd1-23e3671854dd/include.preload.js:757:1
apply self-hosted:4613:5 applySafeWithoutClone
resource://gre/modules/ExtensionCommon.jsm:234:16
wrapPromise/</<
resource://gre/modules/ExtensionCommon.jsm:447:15
withLastError
resource://gre/modules/ExtensionCommon.jsm:371:14
wrapPromise/<
resource://gre/modules/ExtensionCommon.jsm:439:11
[Show/hide message details.] Unchecked lastError value: Error: sender.page is undefined include.preload.js:751
apply
moz-extension://451f5e18-83b2-4848-bdd1-23e3671854dd/include.preload.js:751:5
[Show/hide message details.] Promise rejected after context unloaded: Message manager disconnected
include.postload.js:766
initializeComposer
moz-extension://451f5e18-83b2-4848-bdd1-23e3671854dd/include.postload.js:766:5

So will this be resolved,? must my code change somehow? Am I limited somehow or I must go back to storage?


Expected results:

Firefox must run smoothly while fetching data from native app quite often.
Hi santiaguzz,

Thanks for reporting this issue. Can you clarify the issue in your bug title? 

Please refer to the following link for more information:
https://developer.mozilla.org/en-US/docs/Mozilla/QA/Bug_writing_guidelines#Writing_a_clear_summary

Going to triage this as an Extension Compatibility issue, but not sure if this might fit somewhere better. If you know, please set the component accordingly. Thanks!
Component: Untriaged → Extension Compatibility
Flags: needinfo?(santiaguzz)
Hi Grover; thanks for paying attention. The worts consequences of the bug are now gone after a code re-factor. As mentioned above I'm trying to develop an extension for firefox able to inject scripts in pages allowing them (a.k.a content scripts). The extension is yet unsigned since there are some bugs to fix. You can reach the code at: https://github.com/szz-dvl/JSLoader.

To reproduce the problem you may need firefox developer edition and enable unsigned extensions (.xpi files) to load. With this available you can use the provided script in the above mentioned repository (build) to build the .xpi and install the native app (If you are running on a GNU/linux powered machine). For the native app to run properly python must be installed, and an instance of mongodb must be available too. 

When everything is ready you can drag and drop the build .xpi file into your firefox instance to install the extension.

If everything is fine you will be able to see a new diskette shaped PA action button, usually blue, since no info is stored yet in the database or storage. each time I try to open this menu the bug arise again:


response is undefined include.preload.js:757
apply/<
moz-extension://451f5e18-83b2-4848-bdd1-23e3671854dd/include.preload.js:757:1
apply self-hosted:4613:5 applySafeWithoutClone
resource://gre/modules/ExtensionCommon.jsm:234:16
wrapPromise/</<
resource://gre/modules/ExtensionCommon.jsm:447:15
withLastError
resource://gre/modules/ExtensionCommon.jsm:371:14
wrapPromise/<
resource://gre/modules/ExtensionCommon.jsm:439:11
[Show/hide message details.] Unchecked lastError value: Error: sender.page is undefined include.preload.js:751
apply
moz-extension://451f5e18-83b2-4848-bdd1-23e3671854dd/include.preload.js:751:5
[Show/hide message details.] Promise rejected after context unloaded: page is undefined
include.postload.js:766
initializeComposer
moz-extension://451f5e18-83b2-4848-bdd1-23e3671854dd/include.postload.js:766:5

Right now I'm using a port to connect to my native app, not "sendNativeMessage" which seems to solve the situation for me however this errors keep on coming into my console and may be of some interest to you.

Please forgive my bad manners the last day. And if I can help anyway count me in.

P.D: There are other bugs detected right now, I'm waiting to register the app to publish them all, is it fine?

Thanks in advance.

Szz.
Flags: needinfo?(santiaguzz)
Component: Extension Compatibility → Untriaged
Product: Firefox → WebExtensions
There's not a very clear description of the issue here.  You mention poor performance, but you're also using sendNativeMessage() which kills and restarts the native application on every message -- if you're exchanging more than a few messages that's probably not what you want.  You mentioned problems using connection based native messaging, if that's something repeatable please open a new bug with a clear description and steps to reproduce.

The "this.proc is null" exception is harmless.  The rest of the exceptions you mention are in your extension's code.

I'm closing this since there isn't anything actionable here, please re-open or file a new bug with a specific description and steps to reproduce if you're still having issues.
Status: UNCONFIRMED → RESOLVED
Closed: 6 years ago
Resolution: --- → WORKSFORME
Comment on attachment 9001726 [details]
Bug 1481225: Avoid confusing console spam on native app shutdown. r=aswan

Andrew Swan [:aswan] has approved the revision.
Attachment #9001726 - Flags: review+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: