[Webkit-unassigned] [Bug 113139] New: Call Netscape Plugin's toString() and valueOf() instead of providing default implementation

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Sat Mar 23 09:52:58 PDT 2013


https://bugs.webkit.org/show_bug.cgi?id=113139

           Summary: Call Netscape Plugin's toString() and valueOf()
                    instead of providing default implementation
           Product: WebKit
           Version: 528+ (Nightly build)
          Platform: All
        OS/Version: All
            Status: UNCONFIRMED
          Severity: Major
          Priority: P1
         Component: WebCore Misc.
        AssignedTo: webkit-unassigned at lists.webkit.org
        ReportedBy: ararunprasad at gmail.com
                CC: eric at webkit.org, ArunPrasadR at nds.com


Calling a toString()/valueOf() method on NPObject returns some weird value like "NPObject 0x800000, NPClass 0x810000".

For example,

var obj = document.getElementById("pluginElement");
var npObject = obj.getApplication(); //getApplication is a native method implemented in a plugin and return NPObject
console.log("name of the npObject"+npObject); // which prints something like "NPObject 0x800000, NPClass 0x810000"


Can we delegate this call to npapi plugin, instead of providing default value? I saw that this have been done in c_instance.cpp,

JSValue CInstance::stringValue(ExecState* exec) const
{
    char buf[1024];
    snprintf(buf, sizeof(buf), "NPObject %p, NPClass %p", _object, _object->_class);
    return jsString(exec, buf);
}

So instead of providing default implementation, let this to call "toString()"/"valueOf()" method of plugin, if it doesn't exists the let it to fallback to WebCore's default implementation.

JSValue CInstance::stringValue(ExecState* exec)
{
    NPIdentifier ident = NPN_GetStringIdentifier("toString");
    if (!_object->_class->hasMethod(_object, ident))
        return jsUndefined();

    // Invoke the 'C' method.
    bool retval = true;
    NPVariant resultVariant;
    VOID_TO_NPVARIANT(resultVariant);

    {
        JSLock::DropAllLocks dropAllLocks(exec);
        ASSERT(globalExceptionString().isNull());
        retval = _object->_class->invoke(_object, ident, 0, 0, &resultVariant);
        moveGlobalExceptionToExecState(exec);
    }

    if (!retval)
        throwError(exec, createError(exec, "Error calling method on NPObject."));

    JSValue resultValue = convertNPVariantToValue(exec, &resultVariant, m_rootObject.get());
    _NPN_ReleaseVariantValue(&resultVariant);
    return resultValue;
}

I would like to provide a patch which looks something similar like above to solve this issue. Is it acceptable?

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list