Bug 49198

Summary: NPClass::construct and NPClass::invokeDefault never called with out-of-process plug-ins in WebKit2
Product: WebKit Reporter: Anders Carlsson <andersca>
Component: New BugsAssignee: Anders Carlsson <andersca>
Status: RESOLVED FIXED    
Severity: Normal CC: webkit.review.bot
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Other   
OS: OS X 10.5   
Attachments:
Description Flags
Patch aroben: review+

Description Anders Carlsson 2010-11-08 12:07:31 PST
NPClass::construct and NPClass::invokeDefault never called with out-of-process plug-ins in WebKit2
Comment 1 Anders Carlsson 2010-11-08 12:09:17 PST
Created attachment 73264 [details]
Patch
Comment 2 WebKit Review Bot 2010-11-08 12:12:22 PST
Attachment 73264 [details] did not pass style-queue:

Failed to run "['WebKitTools/Scripts/check-webkit-style', '--diff-files', u'LayoutTests/ChangeLog', u'LayoutTests/platform/mac-snowleopard/Skipped', u'LayoutTests/platform/mac-wk2/Skipped', u'WebKit2/ChangeLog', u'WebKit2/Shared/Plugins/NPObjectMessageReceiver.cpp', u'WebKit2/Shared/Plugins/NPObjectMessageReceiver.h', u'WebKit2/Shared/Plugins/NPObjectMessageReceiver.messages.in', u'WebKit2/Shared/Plugins/NPObjectProxy.cpp', u'WebKit2/Shared/Plugins/NPObjectProxy.h']" exit_code: 1
WebKit2/Shared/Plugins/NPObjectProxy.cpp:303:  NPObjectProxy::NP_InvokeDefault is incorrectly named. Don't use underscores in your identifier names.  [readability/naming] [4]
WebKit2/Shared/Plugins/NPObjectProxy.cpp:333:  NPObjectProxy::NP_Construct is incorrectly named. Don't use underscores in your identifier names.  [readability/naming] [4]
Total errors found: 2 in 7 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 3 Adam Roben (:aroben) 2010-11-08 12:12:54 PST
Comment on attachment 73264 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=73264&action=review

> WebKit2/Shared/Plugins/NPObjectMessageReceiver.cpp:108
> +    Vector<NPVariant> arguments;
> +    for (size_t i = 0; i < argumentsData.size(); ++i)
> +        arguments.append(m_npRemoteObjectMap->npVariantDataToNPVariant(argumentsData[i]));

Maybe it would be better to give arguments an initial size?

> WebKit2/Shared/Plugins/NPObjectMessageReceiver.cpp:113
> +    if (!returnValue)
> +        return;

Whoops! You just leaked the NPVariants in arguments!

> WebKit2/Shared/Plugins/NPObjectMessageReceiver.cpp:215
> +    Vector<NPVariant> arguments;
> +    for (size_t i = 0; i < argumentsData.size(); ++i)
> +        arguments.append(m_npRemoteObjectMap->npVariantDataToNPVariant(argumentsData[i]));
> +
> +    NPVariant result;
> +    returnValue = m_npObject->_class->construct(m_npObject, arguments.data(), arguments.size(), &result);
> +    if (!returnValue)
> +        return;

Same comments here.
Comment 4 Anders Carlsson 2010-11-08 12:35:33 PST
Committed r71559: <http://trac.webkit.org/changeset/71559>