Closed Bug 1257140 Opened 8 years ago Closed 3 years ago

Error calling method on NPObject from add-on in Firefox 45

Categories

(Core Graveyard :: Plug-ins, defect, P5)

45 Branch
defect

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: tim, Unassigned)

Details

Attachments

(3 files)

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.116 Safari/537.36

Steps to reproduce:

Updated to Firefox 45


Actual results:

Add-on no longer works, debugger gives "Error calling method on NPObject". Works in 44.0.2. Looks like no major changes in XPCOM, XUL, or anything like that in the changelog.


Expected results:

Add-on works.
Component: Untriaged → XPCOM
Product: Firefox → Core
Btw, the add-on is "enabled" and shows no other issues. I read elsewhere that "error calling method on NPObject" happens if the XPCOM component crashes. Going back to 44.0.2 from 45 makes it work fine again and the NPObject error does not appear. I have included the add-on. Unfortunately the author of the dll no longer supports it and does not provide the source code.
Attached file WCaptureMoz.zip
here is the add-on in question, the only thing we changed from the original is the company and component name
NPObject means an NPAPI plugin. Much of the time this means that the plugin threw an exception, although there may be other issues. Note that all plugins are forced to run out-of-process now, so if you were relying on a plugin running in-process, that will no longer work. Do you know what plugin you're using?
Component: XPCOM → Plug-ins
Flags: needinfo?(tim)
It is called Loqu8.Capture.Moz and included in the attached. Is the change from out-of-process to in-process a change in Firefox 45 vs Firefox 44.0.2? Is there discussion on how to address this? What does this mean?
Flags: needinfo?(tim)
Benjamin, what version of Firefox are plugins forced to run out-of-process? Is it Firefox 45?
I don't see the toggle in my Release 45, but I think multi-process = https://wiki.mozilla.org/Electrolysis and if so, the chart says that up to Release 46 it is off rather than default, so I don't think that is the issue.
Got more information from Nightly, looks like it is an issue with a call in main in my js file.
Also, my Nightly has multiprocess (e10s) disabled, so this does not seem to be the problem.
The call is

			g_wcxPlugin.addEventListener("capture", g_wcxObserver.notify, false);
Plugins were forced out of process starting in Firefox 43: bug 1194780
This is not a bug that the plugin team is going to prioritize. I'll happily provide you with some debugging tips, although you should start with your implementation of the plugin scriptable layer, seeing whether g_wcxObserver.notify fails for example. In the Firefox process you can set a breakpoint at the two places this error is thrown:

http://mxr.mozilla.org/mozilla-central/source/dom/plugins/base/nsJSNPRuntime.cpp#1587
http://mxr.mozilla.org/mozilla-central/source/dom/plugins/base/nsJSNPRuntime.cpp#2226
Priority: -- → P5
If plugins were forced out of process in Firefox 43 and 44.0.2 works, then this should not be the issue in 45.
You mean 43 Aurora right? Not 43 release.
I'm not sure how to debug it now that signatures are required by the add-on (as I cannot use jpm run on this old plugin).
I'm not sure how to debug it now that signatures are required by the add-on (as I cannot use jpm run on this old plugin).
Benjamin, I have a really strange bug for you. If I add a console.log right before the addEventListeners, I don't get the NPObject error and my add-on works fine.

			g_wcxPlugin = document.getElementById('wcx_plugin');
			console.log(g_wcxPlugin);
			g_wcxPlugin.addEventListener("capture", g_wcxObserver.notify, false);
Scratch that, I accidentally used 44.0.2 again instead of the nightly!
As I hope you're aware, we're planning on removing NPAPI plugins completely by the end of this year. 

This error *can* be caused if the plugin process is crashing, but that is not the only way. You can tell whether the plugin process is crashing by checking about:telemetry and looking in the keyed histograms section for a SUBPROCESS_ABNORMAL_ABORT record for a "plugin".
I'm aware, so we are working on a solution using js-ctypes. However, this failure was unexpected. I'll check about:telemetry. Is there something about this declaration that might need to be modified in 45?
```
WcxObserver.prototype = {
    observe: function(subject, topic, data) {
		WcxLogMessage("wcx observed event");
		OnCapture(subject);
    },
	
	notify: function() {
		WcxLogMessage("wcx notify observers");
		var observerService = Cc["@mozilla.org/observer-service;1"].getService(Ci.nsIObserverService);
        observerService.notifyObservers(g_wcxPlugin, WCX_TOPIC_ID, false);
	},

    register: function() {
        var observerService = Cc["@mozilla.org/observer-service;1"].getService(Ci.nsIObserverService);
        observerService.addObserver(this, WCX_TOPIC_ID, false);
    },

    unregister: function() {
        var observerService = Cc["@mozilla.org/observer-service;1"].getService(Ci.nsIObserverService);
        observerService.removeObserver(this, WCX_TOPIC_ID);
    }
}
```
When I add
```
g_wcxPlugin = document.getElementById('wcx_plugin');
console.log(g_wcxPlugin);
g_wcxPlugin.addEventListener("capture", g_wcxObserver.notify, false);
```
I do see that g_wcxPlugin is filled.
Attached image about:telemetry
I see two BLOCKED_ON_PLUGIN_MODULE_INIT_MS (why aren't they consolidated).
(In reply to tim from comment #20)
> Created attachment 8731334 [details]
> about:telemetry
> 
> I see two BLOCKED_ON_PLUGIN_MODULE_INIT_MS (why aren't they consolidated).

They aren't the same histogram. One is BLOCKED_ON_PLUGIN_MODULE_INIT_MS and the other is BLOCKED_ON_PLUGIN_INSTANCE_INIT_MS.
Thanks Aaron, I'm definitely a few marbles short. Any tips on my NPObject error?
Benjamin, I'm not sure how to do this: "In the Firefox process you can set a breakpoint at the two places this error is thrown." Should I be using VS to attach a debugger? Can I debug from Firefox itself?
I am able to window.addEventListener("capture", g_wcxObserver.notify, false); - so it must be access to the plugin component, which is loaded from the xul

<?xml version="1.0"?>
<overlay xmlns:html="http://www.w3.org/1999/xhtml" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
	<vbox>
		<html:object id="wcx_plugin" type="application/x-wcx" width="0" height="0"/>
	</vbox>
	<script src="WcxTrace.js"/>
	<script src="wcapturex.js"/>
</overlay>

Maybe you are right Benjamin, maybe the in-process out-of-process issue is in play in Firefox 45 (though I'm not sure why it would work fine in 44.0.2 and before.
Resolving as wont fix, plugin support deprecated in Firefox 85.
Status: UNCONFIRMED → RESOLVED
Closed: 3 years ago
Resolution: --- → WONTFIX
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: