0

i´m trying out the npruntime-scriptable-plugin with VC2010-Express.

Firefox without plugin-container.


Sample Scriptable Plug-in

results go here:

NPN_Evaluate() test, document = [object HTMLDocument]

function bar([object Window]) called!


Mozilla/5.0 (Windows NT 5.1; rv:11.0) Gecko/20120407 Firefox/11.0


Firefox with plugin-container


Sample Scriptable Plug-in

results go here:

function bar([object Window]) called!


Mozilla/5.0 (Windows NT 5.1; rv:11.0) Gecko/20120407 Firefox/11.0


missing the Line

NPN_Evaluate() test, document = [object HTMLDocument]

That´s important because the default loading a plugin is with plugin-container enabled. What´s going wrong?

2.) The plugin crashes (Firefox closes) using------------------

modules/plugin/sdk/samples/npruntime/plugin.cpp author Josh Aas Mon Nov 23 13:57:27 2009 -0500 (at Mon Nov 23 13:57:27 2009 -0500)

static LRESULT CALLBACK PluginWinProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)

   745 {
   746   switch (msg) {   
   747     case WM_PAINT:
   ...
   756         if(p) {
   757           if (p->m_String[0] == 0) {
   758             strcpy("foo", p->m_String);
   759           }
   760 
   761           DrawText(hdc, p->m_String, strlen(p->m_String), &rc, DT_SINGLELINE | DT_CENTER | DT_VCENTER);

I change the Line 758 to

strcpy_s(p->m_String, 3+1, "foo");

If the version string is empty Firefox don´t crash. Is this change/ Code OK ?


Georg Fritzsche
  • 97,545
  • 26
  • 194
  • 236
moskito-x
  • 11,832
  • 5
  • 47
  • 60
  • The `strcpy` line has the argument order wrong. For the evaluate problem - have you tried adding some tracing to the `NPN_Evaluate` related code parts to pin down what the problem might be? – Georg Fritzsche Apr 11 '12 at 12:49
  • That´s why I change line 758. The original code is about 8 yaers old. [mozilla-central - file revision](http://hg.mozilla.org/mozilla-central/file/eeceee206420/modules/plugin/sdk/samples/npruntime/plugin.cpp). Line 758 How does nobody notice that ?? – moskito-x Apr 11 '12 at 16:38
  • That code was moved and restructured a while ago. The current test-plugin lives under [`dom/plugins/test/testplugin`](http://hg.mozilla.org/mozilla-central/source/dom/plugins/test/testplugin), more current samples should be in the [npapi-sdk](http://code.google.com/p/npapi-sdk/). – Georg Fritzsche Dec 20 '12 at 15:16

0 Answers0