Changeset 55432 in webkit


Ignore:
Timestamp:
Mar 2, 2010 3:13:51 PM (14 years ago)
Author:
mrowe@apple.com
Message:

Bug 30348: Implement private mode for plug-ins on Windows
<http://webkit.org/b/30348> / <rdar://problem/7562261>

Reviewed by Oliver Hunt.

WebCore:

Rework PluginView::getValue and PluginView::getValueStatic to remove the amount of code that
was duplicated across platforms. getValue and getValueStatic now call in to platform-specific
variants that indicate whether they handled the query. If the query is not handled by the
platform-specific variants then the cross-platform handler has a chance to handle it.

  • plugins/PluginView.cpp:

(WebCore::PluginView::getValueStatic): Give the platform-specific variant a chance to handle the
variable lookup. If it does not handle it, return an error.
(WebCore::PluginView::getValue): Give the platform-specific variant and platform-specific static
variant a chance to handle the variable lookup. If they do not handle it, apply the cross-platform
handler. At the moment the cross-platform code handles NPNVWindowNPObject, NPNVPluginElementNPObject,
and NPNVprivateModeBool as they have an identical implementation across ports.

  • plugins/PluginView.h:
  • plugins/PluginViewNone.cpp:

(WebCore::PluginView::platformGetValue): PluginViewNone does not handle any lookups.
(WebCore::PluginView::platformGetValueStatic): Ditto.

  • plugins/gtk/PluginViewGtk.cpp:

(WebCore::PluginView::platformGetValueStatic):
(WebCore::PluginView::platformGetValue):
platform-independent implementation.

  • plugins/mac/PluginViewMac.cpp:

(WebCore::PluginView::platformGetValueStatic):
(WebCore::PluginView::platformGetValue):

  • plugins/qt/PluginViewQt.cpp:

(WebCore::PluginView::platformGetValueStatic):
(WebCore::PluginView::platformGetValue): Fix a bug noticed while updating this code.
The Qt implementation of the handler for NPNVToolkit was relying on case fall-through
to have some values handled by the static handler. When NPNVprivateModeBool was added
it was placed before the default case, interferring with this fall-through. It now
explicitly indicates in this situation that it was not handled.

  • plugins/symbian/PluginViewSymbian.cpp:

(WebCore::PluginView::platformGetValueStatic):
(WebCore::PluginView::platformGetValue):

  • plugins/win/PluginViewWin.cpp:

(WebCore::PluginView::platformGetValueStatic):
(WebCore::PluginView::platformGetValue):

LayoutTests:

  • platform/win/Skipped: Remove plugins/private-browsing-mode-2.html now that it passes.
Location:
trunk
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r55430 r55432  
     12010-03-02  Mark Rowe  <mrowe@apple.com>
     2
     3        Reviewed by Oliver Hunt.
     4
     5        Bug 30348: Implement private mode for plug-ins on Windows
     6        <http://webkit.org/b/30348> / <rdar://problem/7562261>
     7
     8        * platform/win/Skipped: Remove plugins/private-browsing-mode-2.html now that it passes.
     9
    1102010-03-02  Alexey Proskuryakov  <ap@apple.com>
    211
  • trunk/LayoutTests/platform/win/Skipped

    r55375 r55432  
    675675plugins/private-browsing-mode.html
    676676
    677 # https://bugs.webkit.org/show_bug.cgi?id=33180
    678 plugins/private-browsing-mode-2.html
    679 
    680677# Skip these two failures I introduced this morning while I explore them.
    681678http/tests/globalhistory/history-delegate-basic-visited-links.html
  • trunk/WebCore/ChangeLog

    r55431 r55432  
     12010-03-02  Mark Rowe  <mrowe@apple.com>
     2
     3        Reviewed by Oliver Hunt.
     4
     5        Bug 30348: Implement private mode for plug-ins on Windows
     6        <http://webkit.org/b/30348> / <rdar://problem/7562261>
     7
     8        Rework PluginView::getValue and PluginView::getValueStatic to remove the amount of code that
     9        was duplicated across platforms.  getValue and getValueStatic now call in to platform-specific
     10        variants that indicate whether they handled the query.  If the query is not handled by the
     11        platform-specific variants then the cross-platform handler has a chance to handle it.
     12
     13        * plugins/PluginView.cpp:
     14        (WebCore::PluginView::getValueStatic): Give the platform-specific variant a chance to handle the
     15        variable lookup.  If it does not handle it, return an error.
     16        (WebCore::PluginView::getValue): Give the platform-specific variant and platform-specific static
     17        variant a chance to handle the variable lookup.  If they do not handle it, apply the cross-platform
     18        handler.  At the moment the cross-platform code handles NPNVWindowNPObject, NPNVPluginElementNPObject,
     19        and NPNVprivateModeBool as they have an identical implementation across ports.
     20        * plugins/PluginView.h:
     21        * plugins/PluginViewNone.cpp:
     22        (WebCore::PluginView::platformGetValue): PluginViewNone does not handle any lookups.
     23        (WebCore::PluginView::platformGetValueStatic): Ditto.
     24        * plugins/gtk/PluginViewGtk.cpp:
     25        (WebCore::PluginView::platformGetValueStatic):
     26        (WebCore::PluginView::platformGetValue):
     27        platform-independent implementation.
     28        * plugins/mac/PluginViewMac.cpp:
     29        (WebCore::PluginView::platformGetValueStatic):
     30        (WebCore::PluginView::platformGetValue):
     31        * plugins/qt/PluginViewQt.cpp:
     32        (WebCore::PluginView::platformGetValueStatic):
     33        (WebCore::PluginView::platformGetValue): Fix a bug noticed while updating this code.
     34        The Qt implementation of the handler for NPNVToolkit was relying on case fall-through
     35        to have some values handled by the static handler.  When NPNVprivateModeBool was added
     36        it was placed before the default case, interferring with this fall-through.  It now
     37        explicitly indicates in this situation that it was not handled.
     38        * plugins/symbian/PluginViewSymbian.cpp:
     39        (WebCore::PluginView::platformGetValueStatic):
     40        (WebCore::PluginView::platformGetValue):
     41        * plugins/win/PluginViewWin.cpp:
     42        (WebCore::PluginView::platformGetValueStatic):
     43        (WebCore::PluginView::platformGetValue):
     44
    1452010-03-02  Anders Carlsson  <andersca@apple.com>
    246
  • trunk/WebCore/plugins/PluginView.cpp

    r55128 r55432  
    13011301#endif
    13021302
     1303NPError PluginView::getValueStatic(NPNVariable variable, void* value)
     1304{
     1305    LOG(Plugins, "PluginView::getValueStatic(%s)", prettyNameForNPNVariable(variable).data());
     1306
     1307    NPError result;
     1308    if (platformGetValueStatic(variable, value, &result))
     1309        return result;
     1310
     1311    return NPERR_GENERIC_ERROR;
     1312}
     1313
     1314NPError PluginView::getValue(NPNVariable variable, void* value)
     1315{
     1316    LOG(Plugins, "PluginView::getValue(%s)", prettyNameForNPNVariable(variable).data());
     1317
     1318    NPError result;
     1319    if (platformGetValue(variable, value, &result))
     1320        return result;
     1321
     1322    if (platformGetValueStatic(variable, value, &result))
     1323        return result;
     1324
     1325    switch (variable) {
     1326#if ENABLE(NETSCAPE_PLUGIN_API)
     1327    case NPNVWindowNPObject: {
     1328        if (m_isJavaScriptPaused)
     1329            return NPERR_GENERIC_ERROR;
     1330
     1331        NPObject* windowScriptObject = m_parentFrame->script()->windowScriptNPObject();
     1332
     1333        // Return value is expected to be retained, as described here: <http://www.mozilla.org/projects/plugin/npruntime.html>
     1334        if (windowScriptObject)
     1335            _NPN_RetainObject(windowScriptObject);
     1336
     1337        void** v = (void**)value;
     1338        *v = windowScriptObject;
     1339
     1340        return NPERR_NO_ERROR;
     1341    }
     1342
     1343    case NPNVPluginElementNPObject: {
     1344        if (m_isJavaScriptPaused)
     1345            return NPERR_GENERIC_ERROR;
     1346
     1347        NPObject* pluginScriptObject = 0;
     1348
     1349        if (m_element->hasTagName(appletTag) || m_element->hasTagName(embedTag) || m_element->hasTagName(objectTag))
     1350            pluginScriptObject = static_cast<HTMLPlugInElement*>(m_element)->getNPObject();
     1351
     1352        // Return value is expected to be retained, as described here: <http://www.mozilla.org/projects/plugin/npruntime.html>
     1353        if (pluginScriptObject)
     1354            _NPN_RetainObject(pluginScriptObject);
     1355
     1356        void** v = (void**)value;
     1357        *v = pluginScriptObject;
     1358
     1359        return NPERR_NO_ERROR;
     1360    }
     1361#endif
     1362
     1363    case NPNVprivateModeBool: {
     1364        Page* page = m_parentFrame->page();
     1365        if (!page)
     1366            return NPERR_GENERIC_ERROR;
     1367        *((NPBool*)value) = !page->settings() || page->settings()->privateBrowsingEnabled();
     1368        return NPERR_NO_ERROR;
     1369    }
     1370
     1371    default:
     1372        return NPERR_GENERIC_ERROR;
     1373    }
     1374}
     1375
    13031376} // namespace WebCore
  • trunk/WebCore/plugins/PluginView.h

    r55332 r55432  
    245245#endif
    246246
     247        static bool platformGetValueStatic(NPNVariable variable, void* value, NPError* result);
     248        bool platformGetValue(NPNVariable variable, void* value, NPError* result);
     249
    247250        RefPtr<Frame> m_parentFrame;
    248251        RefPtr<PluginPackage> m_plugin;
  • trunk/WebCore/plugins/PluginViewNone.cpp

    r55128 r55432  
    6868}
    6969
    70 NPError PluginView::getValue(NPNVariable, void*)
     70bool PluginView::platformGetValue(NPNVariable, void*, NPError*)
    7171{
    72     return 0;
     72    return false;
    7373}
    7474
    7575#if ENABLE(NETSCAPE_PLUGIN_API)
    76 NPError PluginView::getValueStatic(NPNVariable, void*)
     76bool PluginView::platformGetValueStatic(NPNVariable, void*, NPError*)
    7777{
    78     return 0;
     78    return false;
    7979}
    8080#endif
  • trunk/WebCore/plugins/gtk/PluginViewGtk.cpp

    r55405 r55432  
    588588}
    589589
    590 NPError PluginView::getValueStatic(NPNVariable variable, void* value)
    591 {
    592     LOG(Plugins, "PluginView::getValueStatic(%s)", prettyNameForNPNVariable(variable).data());
    593 
     590bool PluginView::platformGetValueStatic(NPNVariable variable, void* value, NPError* result)
     591{
    594592    switch (variable) {
    595593    case NPNVToolkit:
     
    599597        *static_cast<uint32*>(value) = 0;
    600598#endif
    601         return NPERR_NO_ERROR;
     599        *result = NPERR_NO_ERROR;
     600        return true;
    602601
    603602    case NPNVSupportsXEmbedBool:
     
    607606        *static_cast<NPBool*>(value) = false;
    608607#endif
    609         return NPERR_NO_ERROR;
     608        *result = NPERR_NO_ERROR;
     609        return true;
    610610
    611611    case NPNVjavascriptEnabledBool:
    612612        *static_cast<NPBool*>(value) = true;
    613         return NPERR_NO_ERROR;
     613        *result = NPERR_NO_ERROR;
     614        return true;
    614615
    615616    case NPNVSupportsWindowless:
     
    619620        *static_cast<NPBool*>(value) = false;
    620621#endif
    621         return NPERR_NO_ERROR;
     622        *result = NPERR_NO_ERROR;
     623        return true;
    622624
    623625    default:
    624         return NPERR_GENERIC_ERROR;
    625     }
    626 }
    627 
    628 NPError PluginView::getValue(NPNVariable variable, void* value)
    629 {
    630     LOG(Plugins, "PluginView::getValue(%s)", prettyNameForNPNVariable(variable).data());
    631 
     626        return false;
     627    }
     628}
     629
     630bool PluginView::platformGetValue(NPNVariable variable, void* value, NPError* result)
     631{
    632632    switch (variable) {
    633633    case NPNVxDisplay:
     
    637637        else
    638638            *(void **)value = (void *)GTK_XTBIN(platformPluginWidget())->xtclient.xtdisplay;
    639         return NPERR_NO_ERROR;
     639        *result = NPERR_NO_ERROR;
    640640#else
    641         return NPERR_GENERIC_ERROR;
    642 #endif
     641        *result = NPERR_GENERIC_ERROR;
     642#endif
     643        return true;
    643644
    644645#if defined(XP_UNIX)
     
    647648            *(void **)value = XtDisplayToApplicationContext (GTK_XTBIN(platformPluginWidget())->xtclient.xtdisplay);
    648649
    649             return NPERR_NO_ERROR;
     650            *result = NPERR_NO_ERROR;
    650651        } else
    651             return NPERR_GENERIC_ERROR;
    652 #endif
    653 
    654 #if ENABLE(NETSCAPE_PLUGIN_API)
    655         case NPNVWindowNPObject: {
    656             if (m_isJavaScriptPaused)
    657                 return NPERR_GENERIC_ERROR;
    658 
    659             NPObject* windowScriptObject = m_parentFrame->script()->windowScriptNPObject();
    660 
    661             // Return value is expected to be retained, as described here: <http://www.mozilla.org/projects/plugin/npruntime.html>
    662             if (windowScriptObject)
    663                 _NPN_RetainObject(windowScriptObject);
    664 
    665             void** v = (void**)value;
    666             *v = windowScriptObject;
    667            
    668             return NPERR_NO_ERROR;
    669         }
    670 
    671         case NPNVPluginElementNPObject: {
    672             if (m_isJavaScriptPaused)
    673                 return NPERR_GENERIC_ERROR;
    674 
    675             NPObject* pluginScriptObject = 0;
    676 
    677             if (m_element->hasTagName(appletTag) || m_element->hasTagName(embedTag) || m_element->hasTagName(objectTag))
    678                 pluginScriptObject = static_cast<HTMLPlugInElement*>(m_element)->getNPObject();
    679 
    680             // Return value is expected to be retained, as described here: <http://www.mozilla.org/projects/plugin/npruntime.html>
    681             if (pluginScriptObject)
    682                 _NPN_RetainObject(pluginScriptObject);
    683 
    684             void** v = (void**)value;
    685             *v = pluginScriptObject;
    686 
    687             return NPERR_NO_ERROR;
    688         }
     652            *result = NPERR_GENERIC_ERROR;
     653        return true;
    689654#endif
    690655
     
    698663            *w = GDK_WINDOW_HWND(m_parentFrame->view()->hostWindow()->platformPageClient()->window);
    699664#endif
    700             return NPERR_NO_ERROR;
     665            *result = NPERR_NO_ERROR;
     666            return true;
    701667        }
    702668
    703         case NPNVprivateModeBool: {
    704             Page* page = m_parentFrame->page();
    705             if (!page)
    706                 return NPERR_GENERIC_ERROR;
    707             *((NPBool*)value) = !page->settings() || page->settings()->privateBrowsingEnabled();
    708             return NPERR_NO_ERROR;
    709         }
    710 
    711         default:
    712             return getValueStatic(variable, value);
     669    default:
     670        return false;
    713671    }
    714672}
  • trunk/WebCore/plugins/mac/PluginViewMac.cpp

    r55368 r55432  
    255255// Used before the plugin view has been initialized properly, and as a
    256256// fallback for variables that do not require a view to resolve.
    257 NPError PluginView::getValueStatic(NPNVariable variable, void* value)
    258 {
    259     LOG(Plugins, "PluginView::getValueStatic(%s)", prettyNameForNPNVariable(variable).data());
    260 
     257bool PluginView::platformGetValueStatic(NPNVariable variable, void* value, NPError* result)
     258{
    261259    switch (variable) {
    262260    case NPNVToolkit:
    263261        *static_cast<uint32*>(value) = 0;
    264         return NPERR_NO_ERROR;
     262        *result = NPERR_NO_ERROR;
     263        return true;
    265264
    266265    case NPNVjavascriptEnabledBool:
    267266        *static_cast<NPBool*>(value) = true;
    268         return NPERR_NO_ERROR;
     267        *result = NPERR_NO_ERROR;
     268        return true;
    269269
    270270#ifndef NP_NO_CARBON
    271271    case NPNVsupportsCarbonBool:
    272272        *static_cast<NPBool*>(value) = true;
    273         return NPERR_NO_ERROR;
     273        *result = NPERR_NO_ERROR;
     274        return true;
    274275
    275276#endif
    276277    case NPNVsupportsCocoaBool:
    277278        *static_cast<NPBool*>(value) = false;
    278         return NPERR_NO_ERROR;
     279        *result = NPERR_NO_ERROR;
     280        return true;
    279281
    280282    // CoreGraphics is the only drawing model we support
    281283    case NPNVsupportsCoreGraphicsBool:
    282284        *static_cast<NPBool*>(value) = true;
    283         return NPERR_NO_ERROR;
     285        *result = NPERR_NO_ERROR;
     286        return true;
    284287
    285288#ifndef NP_NO_QUICKDRAW
     
    290293    case NPNVsupportsCoreAnimationBool:
    291294        *static_cast<NPBool*>(value) = false;
    292         return NPERR_NO_ERROR;
     295        *result = NPERR_NO_ERROR;
     296        return true;
    293297
    294298    default:
    295         return NPERR_GENERIC_ERROR;
     299        return false;
    296300    }
    297301}
    298302
    299303// Used only for variables that need a view to resolve
    300 NPError PluginView::getValue(NPNVariable variable, void* value)
    301 {
    302     LOG(Plugins, "PluginView::getValue(%s)", prettyNameForNPNVariable(variable).data());
    303 
    304     switch (variable) {
    305     case NPNVWindowNPObject: {
    306         if (m_isJavaScriptPaused)
    307             return NPERR_GENERIC_ERROR;
    308 
    309         NPObject* windowScriptObject = m_parentFrame->script()->windowScriptNPObject();
    310 
    311         // Return value is expected to be retained, as described in
    312         // <http://www.mozilla.org/projects/plugin/npruntime.html>
    313         if (windowScriptObject)
    314             _NPN_RetainObject(windowScriptObject);
    315 
    316         void** v = (void**)value;
    317         *v = windowScriptObject;
    318 
    319         return NPERR_NO_ERROR;
    320     }
    321 
    322     case NPNVPluginElementNPObject: {
    323         if (m_isJavaScriptPaused)
    324             return NPERR_GENERIC_ERROR;
    325 
    326         NPObject* pluginScriptObject = 0;
    327 
    328         if (m_element->hasTagName(appletTag) || m_element->hasTagName(embedTag) || m_element->hasTagName(objectTag))
    329             pluginScriptObject = static_cast<HTMLPlugInElement*>(m_element)->getNPObject();
    330 
    331         // Return value is expected to be retained, as described in
    332         // <http://www.mozilla.org/projects/plugin/npruntime.html>
    333         if (pluginScriptObject)
    334             _NPN_RetainObject(pluginScriptObject);
    335 
    336         void** v = (void**)value;
    337         *v = pluginScriptObject;
    338 
    339         return NPERR_NO_ERROR;
    340     }
    341 
    342     default:
    343         return getValueStatic(variable, value);
    344     }
    345 
    346 }
     304bool PluginView::platformGetValue(NPNVariable variable, void* value, NPError* error)
     305{
     306    return false;
     307}
     308
    347309void PluginView::setParent(ScrollView* parent)
    348310{
  • trunk/WebCore/plugins/qt/PluginViewQt.cpp

    r55358 r55432  
    554554}
    555555
    556 NPError PluginView::getValueStatic(NPNVariable variable, void* value)
    557 {
    558     LOG(Plugins, "PluginView::getValueStatic(%s)", prettyNameForNPNVariable(variable).data());
    559 
     556bool PluginView::platformGetValueStatic(NPNVariable variable, void* value, NPError* result)
     557{
    560558    switch (variable) {
    561559    case NPNVToolkit:
    562560        *static_cast<uint32*>(value) = 0;
    563         return NPERR_NO_ERROR;
     561        *result = NPERR_NO_ERROR;
     562        return true;
    564563
    565564    case NPNVSupportsXEmbedBool:
    566565        *static_cast<NPBool*>(value) = true;
    567         return NPERR_NO_ERROR;
     566        *result = NPERR_NO_ERROR;
     567        return true;
    568568
    569569    case NPNVjavascriptEnabledBool:
    570570        *static_cast<NPBool*>(value) = true;
    571         return NPERR_NO_ERROR;
     571        *result = NPERR_NO_ERROR;
     572        return true;
    572573
    573574    case NPNVSupportsWindowless:
    574575        *static_cast<NPBool*>(value) = true;
    575         return NPERR_NO_ERROR;
     576        *result = NPERR_NO_ERROR;
     577        return true;
    576578
    577579    default:
    578         return NPERR_GENERIC_ERROR;
    579     }
    580 }
    581 
    582 NPError PluginView::getValue(NPNVariable variable, void* value)
    583 {
    584     LOG(Plugins, "PluginView::getValue(%s)", prettyNameForNPNVariable(variable).data());
    585 
     580        return false;
     581    }
     582}
     583
     584bool PluginView::platformGetValue(NPNVariable variable, void* value, NPError* result)
     585{
    586586    switch (variable) {
    587587    case NPNVxDisplay:
    588588        *(void **)value = QX11Info::display();
    589         return NPERR_NO_ERROR;
     589        *result = NPERR_NO_ERROR;
     590        return true;
    590591
    591592    case NPNVxtAppContext:
    592         return NPERR_GENERIC_ERROR;
    593 
    594 #if ENABLE(NETSCAPE_PLUGIN_API)
    595     case NPNVWindowNPObject: {
    596         if (m_isJavaScriptPaused)
    597             return NPERR_GENERIC_ERROR;
    598 
    599         NPObject* windowScriptObject = m_parentFrame->script()->windowScriptNPObject();
    600 
    601         // Return value is expected to be retained, as described here: <http://www.mozilla.org/projects/plugin/npruntime.html>
    602         if (windowScriptObject)
    603             _NPN_RetainObject(windowScriptObject);
    604 
    605         void** v = (void**)value;
    606         *v = windowScriptObject;
    607 
    608         return NPERR_NO_ERROR;
    609     }
    610 
    611     case NPNVPluginElementNPObject: {
    612         if (m_isJavaScriptPaused)
    613             return NPERR_GENERIC_ERROR;
    614 
    615         NPObject* pluginScriptObject = 0;
    616 
    617         if (m_element->hasTagName(appletTag) || m_element->hasTagName(embedTag) || m_element->hasTagName(objectTag))
    618             pluginScriptObject = static_cast<HTMLPlugInElement*>(m_element)->getNPObject();
    619 
    620         // Return value is expected to be retained, as described here: <http://www.mozilla.org/projects/plugin/npruntime.html>
    621         if (pluginScriptObject)
    622             _NPN_RetainObject(pluginScriptObject);
    623 
    624         void** v = (void**)value;
    625         *v = pluginScriptObject;
    626 
    627         return NPERR_NO_ERROR;
    628     }
    629 #endif
     593        *result = NPERR_GENERIC_ERROR;
     594        return true;
    630595
    631596    case NPNVnetscapeWindow: {
     
    633598        QWebPageClient* client = m_parentFrame->view()->hostWindow()->platformPageClient();
    634599        *((XID *)w) = client ? client->ownerWidget()->window()->winId() : 0;
    635         return NPERR_NO_ERROR;
     600        *result = NPERR_NO_ERROR;
     601        return true;
    636602    }
    637603
     
    639605        if (m_plugin->quirks().contains(PluginQuirkRequiresGtkToolKit)) {
    640606            *((uint32 *)value) = 2;
    641             return NPERR_NO_ERROR;
     607            *result = NPERR_NO_ERROR;
     608            return true;
    642609        }
    643 
    644     case NPNVprivateModeBool: {
    645         Page* page = m_parentFrame->page();
    646         if (!page)
    647             return NPERR_GENERIC_ERROR;
    648         *((NPBool*)value) = !page->settings() || page->settings()->privateBrowsingEnabled();
    649         return NPERR_NO_ERROR;
    650     }
    651         // fall through
     610        return false;
     611
    652612    default:
    653         return getValueStatic(variable, value);
     613        return false;
    654614    }
    655615}
  • trunk/WebCore/plugins/symbian/PluginViewSymbian.cpp

    r54235 r55432  
    308308}
    309309
    310 NPError PluginView::getValueStatic(NPNVariable variable, void* value)
    311 {
    312     LOG(Plugins, "PluginView::getValueStatic(%s)", prettyNameForNPNVariable(variable).data());
    313 
     310bool PluginView::platformGetValueStatic(NPNVariable variable, void* value, NPError* result)
     311{
    314312    switch (variable) {
    315313    case NPNVjavascriptEnabledBool:
    316314        *static_cast<NPBool*>(value) = true;
    317         return NPERR_NO_ERROR;
     315        *result = NPERR_NO_ERROR;
     316        return true;
    318317
    319318    case NPNVSupportsWindowless:
    320319        *static_cast<NPBool*>(value) = true;
    321         return NPERR_NO_ERROR;
     320        *result = NPERR_NO_ERROR;
     321        return true;
    322322
    323323    default:
    324         return NPERR_GENERIC_ERROR;
    325     }
    326 }
    327 
    328 NPError PluginView::getValue(NPNVariable variable, void* value)
    329 {
    330     LOG(Plugins, "PluginView::getValue(%s)", prettyNameForNPNVariable(variable).data());
    331 
    332     switch (variable) {
    333     case NPNVWindowNPObject: {
    334         if (m_isJavaScriptPaused)
    335             return NPERR_GENERIC_ERROR;
    336 
    337         NPObject* windowScriptObject = m_parentFrame->script()->windowScriptNPObject();
    338 
    339         // Return value is expected to be retained, as described here: <http://www.mozilla.org/projects/plugin/npruntime.html>
    340         if (windowScriptObject)
    341             _NPN_RetainObject(windowScriptObject);
    342 
    343         void** v = (void**)value;
    344         *v = windowScriptObject;
    345            
    346         return NPERR_NO_ERROR;
    347     }
    348 
    349     case NPNVPluginElementNPObject: {
    350         if (m_isJavaScriptPaused)
    351             return NPERR_GENERIC_ERROR;
    352 
    353         NPObject* pluginScriptObject = 0;
    354 
    355         if (m_element->hasTagName(appletTag) || m_element->hasTagName(embedTag) || m_element->hasTagName(objectTag))
    356             pluginScriptObject = static_cast<HTMLPlugInElement*>(m_element)->getNPObject();
    357 
    358         // Return value is expected to be retained, as described here: <http://www.mozilla.org/projects/plugin/npruntime.html>
    359         if (pluginScriptObject)
    360             _NPN_RetainObject(pluginScriptObject);
    361 
    362         void** v = (void**)value;
    363         *v = pluginScriptObject;
    364 
    365         return NPERR_NO_ERROR;
    366     }       
    367     default:
    368         return getValueStatic(variable, value);
    369     }
     324        return false;
     325    }
     326}
     327
     328bool PluginView::platformGetValue(NPNVariable, void*, NPError*)
     329{
     330    return false;
    370331}
    371332
  • trunk/WebCore/plugins/win/PluginViewWin.cpp

    r54503 r55432  
    2727
    2828#include "config.h"
    29 
    3029#include "PluginView.h"
    3130
    3231#include "BitmapImage.h"
    33 #if !PLATFORM(WX)
    34 #include "BitmapInfo.h"
    35 #endif
    3632#include "Bridge.h"
    3733#include "Document.h"
     
    3935#include "Element.h"
    4036#include "EventNames.h"
     37#include "FocusController.h"
     38#include "Frame.h"
     39#include "FrameLoadRequest.h"
    4140#include "FrameLoader.h"
    42 #include "FrameLoadRequest.h"
    4341#include "FrameTree.h"
    44 #include "Frame.h"
    4542#include "FrameView.h"
    4643#include "GraphicsContext.h"
     44#include "HTMLNames.h"
     45#include "HTMLPlugInElement.h"
    4746#include "HostWindow.h"
    4847#include "Image.h"
    49 #include "HTMLNames.h"
    50 #include "HTMLPlugInElement.h"
     48#include "JSDOMBinding.h"
    5149#include "JSDOMWindow.h"
    5250#include "KeyboardEvent.h"
     
    5452#include "MouseEvent.h"
    5553#include "Page.h"
    56 #include "FocusController.h"
    5754#include "PlatformMouseEvent.h"
     55#include "PluginDatabase.h"
     56#include "PluginDebug.h"
     57#include "PluginMainThreadScheduler.h"
    5858#include "PluginMessageThrottlerWin.h"
    5959#include "PluginPackage.h"
    60 #include "PluginMainThreadScheduler.h"
    6160#include "RenderWidget.h"
    62 #include "JSDOMBinding.h"
    6361#include "ScriptController.h"
    64 #include "PluginDatabase.h"
    65 #include "PluginDebug.h"
    66 #include "PluginPackage.h"
    6762#include "Settings.h"
    6863#include "c_instance.h"
     
    7267#include <runtime/JSValue.h>
    7368#include <wtf/ASCIICType.h>
     69
     70#if !PLATFORM(WX)
     71#include "BitmapInfo.h"
     72#endif
    7473
    7574#if OS(WINCE)
     
    868867}
    869868
    870 NPError PluginView::getValueStatic(NPNVariable variable, void* value)
    871 {
    872     LOG(Plugins, "PluginView::getValueStatic(%s)", prettyNameForNPNVariable(variable).data());
    873 
    874     return NPERR_GENERIC_ERROR;
    875 }
    876 
    877 NPError PluginView::getValue(NPNVariable variable, void* value)
    878 {
    879     LOG(Plugins, "PluginView::getValue(%s)", prettyNameForNPNVariable(variable).data());
    880 
     869bool PluginView::platformGetValueStatic(NPNVariable, void*, NPError*)
     870{
     871    return false;
     872}
     873
     874bool PluginView::platformGetValue(NPNVariable variable, void* value, NPError* result)
     875{
    881876    switch (variable) {
    882 #if ENABLE(NETSCAPE_PLUGIN_API)
    883         case NPNVWindowNPObject: {
    884             if (m_isJavaScriptPaused)
    885                 return NPERR_GENERIC_ERROR;
    886 
    887             NPObject* windowScriptObject = m_parentFrame->script()->windowScriptNPObject();
    888 
    889             // Return value is expected to be retained, as described here: <http://www.mozilla.org/projects/plugin/npruntime.html>
    890             if (windowScriptObject)
    891                 _NPN_RetainObject(windowScriptObject);
    892 
    893             void** v = (void**)value;
    894             *v = windowScriptObject;
    895 
    896             return NPERR_NO_ERROR;
    897         }
    898 
    899         case NPNVPluginElementNPObject: {
    900             if (m_isJavaScriptPaused)
    901                 return NPERR_GENERIC_ERROR;
    902 
    903             NPObject* pluginScriptObject = 0;
    904 
    905             if (m_element->hasTagName(appletTag) || m_element->hasTagName(embedTag) || m_element->hasTagName(objectTag))
    906                 pluginScriptObject = static_cast<HTMLPlugInElement*>(m_element)->getNPObject();
    907 
    908             // Return value is expected to be retained, as described here: <http://www.mozilla.org/projects/plugin/npruntime.html>
    909             if (pluginScriptObject)
    910                 _NPN_RetainObject(pluginScriptObject);
    911 
    912             void** v = (void**)value;
    913             *v = pluginScriptObject;
    914 
    915             return NPERR_NO_ERROR;
    916         }
    917 #endif
    918 
    919877        case NPNVnetscapeWindow: {
    920878            HWND* w = reinterpret_cast<HWND*>(value);
    921 
    922879            *w = windowHandleForPageClient(parent() ? parent()->hostWindow()->platformPageClient() : 0);
    923 
    924             return NPERR_NO_ERROR;
     880            *result = NPERR_NO_ERROR;
     881            return true;
    925882        }
    926883
    927884        case NPNVSupportsWindowless: {
    928             NPBool *result = reinterpret_cast<NPBool*>(value);
    929 
    930             *result = TRUE;
    931            
    932             return NPERR_NO_ERROR;
     885            NPBool* flag = reinterpret_cast<NPBool*>(value);
     886            *flag = TRUE;
     887            *result = NPERR_NO_ERROR;
     888            return true;
    933889        }
    934890
    935         default:
    936             return NPERR_GENERIC_ERROR;
     891    default:
     892        return false;
    937893    }
    938894}
Note: See TracChangeset for help on using the changeset viewer.