patchGnash - The GNU Flash player - Patches: patch #8916, Patch to make libgnashplugin...


You are not allowed to post comments on this tracker with your current authentication level.

patch #8916: Patch to make libgnashplugin return real JavaScript object from ExternalInterface callback

Submitter:  Nutchanon Wetchasit <nachanon>
Submitted:  Mon 22 Feb 2016 01:57:20 PM UTC
Category:  plugin Priority:  5 - Normal
Status:  Done Privacy:  Public
Assigned to:  strk Open/Closed:  Closed

Thu 03 Mar 2016 09:33:17 AM UTC, comment #4: 

Pushed as commit 765adb072dc4b8407f1936a60c3f2af4aeff2046

Sandro Santilli <strk>
Group Member
Thu 03 Mar 2016 08:44:46 AM UTC, comment #3: 

I guess we can just commit this and try it on the field...

Sandro Santilli <strk>
Group Member
Tue 23 Feb 2016 08:24:59 AM UTC, comment #2: 

FWIW, compiler reported this:

/usr/src/gnash/gnash-head/plugin/npapi/plugin.cpp:930:14: warning: variable 'invokeResult' set but not used [-Wunused-but-set-variable]
         bool invokeResult = false;

Sandro Santilli <strk>
Group Member
Tue 23 Feb 2016 08:24:21 AM UTC, comment #1: 

I'm not experienced with NPAPI either, so can't help much with it.
Do you want to take a look, Rob ?

Sandro Santilli <strk>
Group Member
Mon 22 Feb 2016 01:57:20 PM UTC, original submission:  

Current NPAPI libgnashplugin code returns a custom-allocated `NPObject`
to browser when it receives Object-typed or Array-typed return value from
player-side ExternalInterface callback.

Doing this resulting in object's members not being set correctly
(`NPN_SetProperty()` returned false), JavaScript seen the object
as type `function`, and the plugin container crashed after it
received such `NPObject` instance.

The attached `0001_make-libgnashplugin-return-real-js-object.patch` does following things:

  • Drop the custom `NPObject` allocation in `ExternalInterface::parseXML()`.
  • Make `ExternalInterface::parseXML()` call container's `window.Object()` method to construct a JavaScript-authentic `Object`.
  • Change `NPP nppinstance` field in `GnashPluginScriptObject` to public, allowing `ExternalInterface::parseXML()` to access it.
  • Change various functions which call `ExternalInterface::parseXML()`, to make them pass `GnashPluginScriptObject` along.
  • Implement `NPN_GetValue()` and `NPN_Invoke()` stub in standalone tester.
  • Comment out existing `<object>` parsing test as `GnashPluginScriptObject` and container's `window` object are not available in testing environment.

This fixes the crash and single-depth Object member unmarshalling in
JavaScript-calls-Flash ExternalInterface return value, partially fixing
bug #32411, while allowing unrelated tests in plugin's standalone tester
to continue working.

This patch needs review since I'm new to Netscape Plugin API framework
and its NPRuntime extension, and I'm not sure if there's a nicer way to
implement this (especially the way that `NPP` instance got passed around).

Gnash: 0.8.11dev (patched against git c12c3cf 22-Feb-2016) NPAPI
Browser: Iceweasel 10.0.12 (debian)
System: Debian GNU/Linux 7.0 Wheezy i386

Nutchanon Wetchasit <nachanon>


(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attached Files
file #36423:  0001_make-libgnashplugin-return-real-js-object.patch added by nachanon (20KiB - text/x-diff - Patch for making NPAPI libgnashplugin return real JavaScript Object for ExternalInterface object return value)


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by strk (Posted a comment)
  • -email is unavailable- added by nachanon (Submitted the item)

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.


    Follow 6 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2016-03-03 strk StatusIn Progress Done
        Open/ClosedOpen Closed
    2016-03-03 strk StatusNone In Progress
        Assigned torsavoye strk
    2016-02-23 strk Assigned toNone rsavoye
    2016-02-22 nachanon Attached File- Added 0001_make-libgnashplugin-return-real-js-object.patch, #36423

    Back to the top

    Powered by Savane 3.13-b921.
    Corresponding source code