Bug 21572

Summary: NPAPI implementation bugs in WebKit top-of-tree
Product: WebKit Reporter: Kenneth Russell <kenneth.russell>
Component: Plug-insAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Major CC: andersca, kenneth.russell, swingler
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Mac   
OS: OS X 10.5   

Description Kenneth Russell 2008-10-13 11:18:54 PDT
There are a couple of bugs in the NPAPI implementation on the WebKit top of tree preventing plug-ins from working as expected:

1. The "size" field of the NPPluginFuncs is not initialized before being passed to NP_GetEntryPoints. Patch ((tested, verified):

Index: WebNetscapePluginPackage.m
===================================================================
--- WebNetscapePluginPackage.m    (revision 37534)
+++ WebNetscapePluginPackage.m    (working copy)
@@ -569,6 +569,7 @@
 #endif
         LOG(Plugins, "%f NP_Initialize took %f seconds", currentTime, duration);

+        pluginFuncs.size = sizeof(NPPluginFuncs);
         npErr = NP_GetEntryPoints(&pluginFuncs);
         if (npErr != NPERR_NO_ERROR)
             goto abort; 

2. NPN_SetValue(npp, NPPVpluginDrawingModel, (void*)NPDrawingModelCoreGraphics); fails. Patch (tested, verified):

Index: WebBaseNetscapePluginView.mm
===================================================================
--- WebBaseNetscapePluginView.mm    (revision 37534)
+++ WebBaseNetscapePluginView.mm    (working copy)
@@ -2561,9 +2561,13 @@
             NPDrawingModel newDrawingModel = (NPDrawingModel)(uintptr_t)value;
             switch (newDrawingModel) {
                 // Supported drawing models:
+                case NPDrawingModelCoreGraphics:
 #ifndef NP_NO_QUICKDRAW
                 case NPDrawingModelQuickDraw:
 #endif
+                    drawingModel = newDrawingModel;
+                    return NPERR_NO_ERROR;
+
                 // Unsupported (or unknown) drawing models:
                 default:
                     LOG(Plugins, "Plugin %@ uses unsupported drawing model: %d", pluginPackage, drawingModel);
Comment 1 Anders Carlsson 2008-10-15 18:14:50 PDT
Part of this patch was landed by Mark Rowe as a different fix.

Committed revision 37624.