Changeset 62700 in webkit


Ignore:
Timestamp:
Jul 7, 2010 2:36:37 PM (14 years ago)
Author:
andersca@apple.com
Message:

Unify Mac and Windows TestNetscapePlugin main.cpp files
https://bugs.webkit.org/show_bug.cgi?id=41798

Reviewed by Simon Fraser.

  • DumpRenderTree/DumpRenderTree.sln:
  • DumpRenderTree/TestNetscapePlugIn/main.cpp:

(strcasecmp):
(NP_Initialize):
(NP_GetEntryPoints):
(NP_Shutdown):
(NPP_New):
(NPP_Destroy):
(NPP_HandleEvent):

  • DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePlugin.vcproj:
  • DumpRenderTree/win/TestNetscapePlugin/main.cpp: Removed.
Location:
trunk/WebKitTools
Files:
1 deleted
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebKitTools/ChangeLog

    r62695 r62700  
     12010-07-07  Anders Carlsson  <andersca@apple.com>
     2
     3        Reviewed by Simon Fraser.
     4
     5        Unify Mac and Windows TestNetscapePlugin main.cpp files
     6        https://bugs.webkit.org/show_bug.cgi?id=41798
     7       
     8        * DumpRenderTree/DumpRenderTree.sln:
     9        * DumpRenderTree/TestNetscapePlugIn/main.cpp:
     10        (strcasecmp):
     11        (NP_Initialize):
     12        (NP_GetEntryPoints):
     13        (NP_Shutdown):
     14        (NPP_New):
     15        (NPP_Destroy):
     16        (NPP_HandleEvent):
     17        * DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePlugin.vcproj:
     18        * DumpRenderTree/win/TestNetscapePlugin/main.cpp: Removed.
     19
    1202010-07-07  Kevin Ollivier  <kevino@theolliviers.com>
    221
  • trunk/WebKitTools/DumpRenderTree/DumpRenderTree.sln

    r49705 r62700  
    44Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DumpRenderTree", "win\DumpRenderTree.vcproj", "{6567DFD4-D6DE-4CD5-825D-17E353D160E1}"
    55EndProject
    6 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestNetscapePlugin", "win\TestNetscapePlugin\TestNetscapePlugin.vcproj", "{C0737398-3565-439E-A2B8-AB2BE4D5430C}"
     6Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestNetscapePlugin", "TestNetscapePlugin\win\TestNetscapePlugin.vcproj", "{C0737398-3565-439E-A2B8-AB2BE4D5430C}"
    77EndProject
    88Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "FindSafari", "..\FindSafari\FindSafari.vcproj", "{DA31DA52-6675-48D4-89E0-333A7144397C}"
  • trunk/WebKitTools/DumpRenderTree/TestNetscapePlugIn/main.cpp

    r62685 r62700  
    2424 */
    2525
    26 #import "PluginObject.h"
    27 
    28 // Mach-o entry points
    29 extern "C" {
    30     NPError NP_Initialize(NPNetscapeFuncs *browserFuncs);
    31     NPError NP_GetEntryPoints(NPPluginFuncs *pluginFuncs);
    32     void NP_Shutdown(void);
    33 }
    34 
    35 // Mach-o entry points
    36 NPError NP_Initialize(NPNetscapeFuncs *browserFuncs)
     26#include "PluginObject.h"
     27
     28#if XP_WIN
     29#define STDCALL __stdcall
     30
     31static inline int strcasecmp(const char* s1, const char* s2)
     32{
     33    return _stricmp(s1, s2);
     34}
     35
     36#else
     37#define STDCALL
     38#endif
     39
     40// Entry points
     41extern "C"
     42NPError STDCALL NP_Initialize(NPNetscapeFuncs *browserFuncs)
    3743{
    3844    browser = browserFuncs;
     
    4046}
    4147
    42 NPError NP_GetEntryPoints(NPPluginFuncs *pluginFuncs)
    43 {
    44     pluginFuncs->version = 11;
     48extern "C"
     49NPError STDCALL NP_GetEntryPoints(NPPluginFuncs *pluginFuncs)
     50{
     51    pluginFuncs->version = (NP_VERSION_MAJOR << 8) | NP_VERSION_MINOR;
    4552    pluginFuncs->size = sizeof(pluginFuncs);
    4653    pluginFuncs->newp = NPP_New;
     
    6168}
    6269
    63 void NP_Shutdown(void)
     70extern "C"
     71void STDCALL NP_Shutdown(void)
    6472{
    6573}
     
    7179    bool forceCarbon = false;
    7280
     81#if XP_MAC
    7382    // Always turn on the CG model
    7483    NPBool supportsCoreGraphics;
     
    7887    if (!supportsCoreGraphics)
    7988        return NPERR_INCOMPATIBLE_VERSION_ERROR;
    80    
     89
    8190    browser->setvalue(instance, NPPVpluginDrawingModel, (void *)NPDrawingModelCoreGraphics);
     91
     92#ifndef NP_NO_CARBON
     93    NPBool supportsCarbon = false;
     94#endif
     95    NPBool supportsCocoa = false;
     96
     97#ifndef NP_NO_CARBON
     98    // A browser that doesn't know about NPNVsupportsCarbonBool is one that only supports Carbon event model.
     99    if (browser->getvalue(instance, NPNVsupportsCarbonBool, &supportsCarbon) != NPERR_NO_ERROR)
     100        supportsCarbon = true;
     101#endif
     102
     103    if (browser->getvalue(instance, NPNVsupportsCocoaBool, &supportsCocoa) != NPERR_NO_ERROR)
     104        supportsCocoa = false;
     105
     106    if (supportsCocoa && !forceCarbon) {
     107        obj->eventModel = NPEventModelCocoa;
     108#ifndef NP_NO_CARBON
     109    } else if (supportsCarbon) {
     110        obj->eventModel = NPEventModelCarbon;
     111#endif
     112    } else {
     113        return NPERR_INCOMPATIBLE_VERSION_ERROR;
     114    }
     115
     116     browser->setvalue(instance, NPPVpluginEventModel, (void *)obj->eventModel);
     117#endif // XP_MAC
    82118
    83119    PluginObject* obj = (PluginObject*)browser->createobject(instance, getPluginClass());
     
    114150        else if (strcasecmp(argn[i], "testwindowopen") == 0)
    115151            obj->testWindowOpen = TRUE;
     152        else if (strcasecmp(argn[i], "testGetURLOnDestroy") == 0)
     153            obj->testGetURLOnDestroy = TRUE;
    116154        else if (strcasecmp(argn[i], "src") == 0 && strstr(argv[i], "plugin-document-has-focus.pl"))
    117155            obj->testKeyboardFocusForPlugins = TRUE;
    118156    }
     157
     158    browser->getvalue(instance, NPNVprivateModeBool, (void *)&obj->cachedPrivateBrowsingMode);
    119159       
    120 #ifndef NP_NO_CARBON
    121     NPBool supportsCarbon = false;
    122 #endif
    123     NPBool supportsCocoa = false;
    124 
    125 #ifndef NP_NO_CARBON
    126     // A browser that doesn't know about NPNVsupportsCarbonBool is one that only supports Carbon event model.
    127     if (browser->getvalue(instance, NPNVsupportsCarbonBool, &supportsCarbon) != NPERR_NO_ERROR)
    128         supportsCarbon = true;
    129 #endif
    130 
    131     if (browser->getvalue(instance, NPNVsupportsCocoaBool, &supportsCocoa) != NPERR_NO_ERROR)
    132         supportsCocoa = false;
    133 
    134     if (supportsCocoa && !forceCarbon) {
    135         obj->eventModel = NPEventModelCocoa;
    136 #ifndef NP_NO_CARBON
    137     } else if (supportsCarbon) {
    138         obj->eventModel = NPEventModelCarbon;
    139 #endif
    140     } else {
    141         return NPERR_INCOMPATIBLE_VERSION_ERROR;
    142     }
    143    
    144     browser->getvalue(instance, NPNVprivateModeBool, (void *)&obj->cachedPrivateBrowsingMode);
    145     browser->setvalue(instance, NPPVpluginEventModel, (void *)obj->eventModel);
    146    
    147160    return NPERR_NO_ERROR;
    148161}
     
    152165    PluginObject* obj = static_cast<PluginObject*>(instance->pdata);
    153166    if (obj) {
     167        if (obj->testGetURLOnDestroy)
     168            browser->geturlnotify(obj->npp, "about:blank", "", 0);
     169
    154170        if (obj->onDestroy) {
    155171            executeScript(obj, obj->onDestroy);
     
    271287}
    272288
     289#if XP_MAC
    273290#ifndef NP_NO_CARBON
    274291static int16_t handleEventCarbon(NPP instance, PluginObject* obj, EventRecord* event)
     
    402419}
    403420
     421#endif // XP_MAC
     422
    404423int16_t NPP_HandleEvent(NPP instance, void *event)
    405424{
     
    408427        return 0;
    409428
     429#if XP_MAC
    410430#ifndef NP_NO_CARBON
    411431    if (obj->eventModel == NPEventModelCarbon)
     
    415435    assert(obj->eventModel == NPEventModelCocoa);
    416436    return handleEventCocoa(instance, obj, static_cast<NPCocoaEvent*>(event));
     437#else
     438    // FIXME: Implement for other platforms.
     439    return 0;
     440#endif // XP_MAC
    417441}
    418442
  • trunk/WebKitTools/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePlugin.vcproj

    r62685 r62700  
    373373                </File>
    374374                <File
     375                        RelativePath="..\main.cpp"
     376                        >
     377                        <FileConfiguration
     378                                Name="Debug|Win32"
     379                                >
     380                                <Tool
     381                                        Name="VCCLCompilerTool"
     382                                        ObjectFile="$(IntDir)\$(InputName)1.obj"
     383                                        XMLDocumentationFileName="$(IntDir)\$(InputName)1.xdc"
     384                                />
     385                        </FileConfiguration>
     386                        <FileConfiguration
     387                                Name="Release|Win32"
     388                                >
     389                                <Tool
     390                                        Name="VCCLCompilerTool"
     391                                        ObjectFile="$(IntDir)\$(InputName)1.obj"
     392                                        XMLDocumentationFileName="$(IntDir)\$(InputName)1.xdc"
     393                                />
     394                        </FileConfiguration>
     395                        <FileConfiguration
     396                                Name="Debug_Internal|Win32"
     397                                >
     398                                <Tool
     399                                        Name="VCCLCompilerTool"
     400                                        ObjectFile="$(IntDir)\$(InputName)1.obj"
     401                                        XMLDocumentationFileName="$(IntDir)\$(InputName)1.xdc"
     402                                />
     403                        </FileConfiguration>
     404                        <FileConfiguration
     405                                Name="Debug_Cairo|Win32"
     406                                >
     407                                <Tool
     408                                        Name="VCCLCompilerTool"
     409                                        ObjectFile="$(IntDir)\$(InputName)1.obj"
     410                                        XMLDocumentationFileName="$(IntDir)\$(InputName)1.xdc"
     411                                />
     412                        </FileConfiguration>
     413                        <FileConfiguration
     414                                Name="Debug_All|Win32"
     415                                >
     416                                <Tool
     417                                        Name="VCCLCompilerTool"
     418                                        ObjectFile="$(IntDir)\$(InputName)1.obj"
     419                                        XMLDocumentationFileName="$(IntDir)\$(InputName)1.xdc"
     420                                />
     421                        </FileConfiguration>
     422                </File>
     423                <File
    375424                        RelativePath="..\PluginObject.cpp"
    376425                        >
Note: See TracChangeset for help on using the changeset viewer.