Calling NP_Evaluate within NPP_New causes UI errors.

RESOLVED INCOMPLETE

Status

()

RESOLVED INCOMPLETE
7 years ago
2 years ago

People

(Reporter: taviso, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Reporter)

Description

7 years ago
I have an NPAPI plugin that calls NP_Evaluate() from within NPP_New(), and then returns failure (GENERIC_ERROR) from NPP_New(). This works perfectly in other browsers.

However, in Firefox the UI starts acting strangely (for example, tabs and menus no longer respond), making the browser unusable. The plugin works in Firefox if I remove the call to NP_Evaluate(), but I need that.

Is this supposed to work?

Comment 1

7 years ago
Can you be more specific? What is the content of the script you are evaluating? What version of Firefox are you testing with? Are you removing the plugin from the DOM?

Is it possible to provide a minimal testcase/testcase URL?
Component: General → Plug-ins
QA Contact: general → plugins
(Reporter)

Comment 2

7 years ago
For example, add this code to NPP_New in BasicPlugin.c from the npapi-sdk:

  void *element;
  NPError result;
  NPString script = {
    .UTF8Characters = "alert(1);",
    .UTF8Length     = 9,
  };
  NPVariant output;


And at the end:

  sBrowserFuncs->getvalue(instance, NPNVPluginElementNPObject, &element);
  sBrowserFuncs->evaluate(instance, element, &script, &output);
  sBrowserFuncs->releasevariantvalue(&output);

  return NPERR_GENERIC_ERROR;

I set up this page that serves the appropriate type for testing:

http://lock.cmpxchg8b.com/testcase.bsc

This plugin works exactly as expected on Chrome, and displays the alert and continues. On firefox, the UI starts acting strangely, I've tested on Linux and OSX, same result.

I'll attach my version of BasicPlugin.c just in case, notice that if you comment out the evaluate(), it works perfectly.
(Reporter)

Comment 3

7 years ago
Created attachment 600697 [details]
using evaluate in NPP_New.

Comment 4

2 years ago
Resolving old bugs which are likely not relevant any more, since NPAPI plugins are deprecated.
Status: NEW → RESOLVED
Last Resolved: 2 years ago
Resolution: --- → INCOMPLETE
You need to log in before you can comment on or make changes to this bug.