Changeset 86467 in webkit


Ignore:
Timestamp:
May 13, 2011 3:37:36 PM (13 years ago)
Author:
andersca@apple.com
Message:

2011-05-13 Anders Carlsson <andersca@apple.com>

Reviewed by Sam Weinig.

NPN_GetURL with a javascript: URL doesn't send back the result in the stream
https://bugs.webkit.org/show_bug.cgi?id=60810

In NetscapePluginStream::sendJavaScriptStream, we were incorrectly passing the result URL
to the stream, instead of the result. Also, store the request URL in the NetscapePluginStream object
to avoid sending it over the wire.

  • PluginProcess/PluginControllerProxy.cpp: (WebKit::PluginControllerProxy::didEvaluateJavaScript):
  • PluginProcess/PluginControllerProxy.h:
  • PluginProcess/PluginControllerProxy.messages.in:
  • WebProcess/Plugins/Netscape/NetscapePlugin.cpp: (WebKit::NetscapePlugin::loadURL): (WebKit::NetscapePlugin::didEvaluateJavaScript): (WebKit::NetscapePlugin::manualStreamDidReceiveResponse):
  • WebProcess/Plugins/Netscape/NetscapePlugin.h:
  • WebProcess/Plugins/Netscape/NetscapePluginStream.cpp: (WebKit::NetscapePluginStream::NetscapePluginStream): (WebKit::NetscapePluginStream::sendJavaScriptStream):
  • WebProcess/Plugins/Netscape/NetscapePluginStream.h: (WebKit::NetscapePluginStream::create):
  • WebProcess/Plugins/Plugin.h:
  • WebProcess/Plugins/PluginProxy.cpp: (WebKit::PluginProxy::didEvaluateJavaScript):
  • WebProcess/Plugins/PluginProxy.h:
  • WebProcess/Plugins/PluginView.cpp: (WebKit::PluginView::performJavaScriptURLRequest):

2011-05-13 Anders Carlsson <andersca@apple.com>

Reviewed by Sam Weinig.

NPN_GetURL with a javascript: URL doesn't send back the result in the stream
https://bugs.webkit.org/show_bug.cgi?id=60810

Add a test that calls NPN_GetURL on a javascript: URL and checks that it gets back the expected result.

  • plugins/get-url-with-javascript-url-expected.txt: Added.
  • plugins/get-url-with-javascript-url.html: Added.

2011-05-13 Anders Carlsson <andersca@apple.com>

Reviewed by Sam Weinig.

NPN_GetURL with a javascript: URL doesn't send back the result in the stream
https://bugs.webkit.org/show_bug.cgi?id=60810

Add a test that calls NPN_GetURL on a javascript: URL and checks that it gets back the expected result.

  • DumpRenderTree/DumpRenderTree.gypi:
  • DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj:
  • DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePlugin.vcproj:
  • DumpRenderTree/qt/TestNetscapePlugin/TestNetscapePlugin.pro:
  • GNUmakefile.am: Add files.
  • DumpRenderTree/TestNetscapePlugIn/PluginTest.cpp:
  • DumpRenderTree/TestNetscapePlugIn/PluginTest.h: Add new NPN and NPP wrappers and sort them according to the order they appear in npfunctions.h
  • DumpRenderTree/TestNetscapePlugIn/Tests/GetURLWithJavaScriptURL.cpp: Added. (GetURLWithJavaScriptURL::GetURLWithJavaScriptURL): (GetURLWithJavaScriptURL::NPP_New): (GetURLWithJavaScriptURL::NPP_NewStream): (GetURLWithJavaScriptURL::NPP_DestroyStream): (GetURLWithJavaScriptURL::NPP_WriteReady): (GetURLWithJavaScriptURL::NPP_Write):
  • DumpRenderTree/TestNetscapePlugIn/main.cpp: (NPP_NewStream): (NPP_WriteReady): (NPP_Write): (NPP_URLNotify): call the PluginTest NPP wrappers.
Location:
trunk
Files:
3 added
22 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r86466 r86467  
     12011-05-13  Anders Carlsson  <andersca@apple.com>
     2
     3        Reviewed by Sam Weinig.
     4
     5        NPN_GetURL with a javascript: URL doesn't send back the result in the stream
     6        https://bugs.webkit.org/show_bug.cgi?id=60810
     7
     8        Add a test that calls NPN_GetURL on a javascript: URL and checks that it gets back the expected result.
     9
     10        * plugins/get-url-with-javascript-url-expected.txt: Added.
     11        * plugins/get-url-with-javascript-url.html: Added.
     12
    1132011-05-13  Mark Pilgrim  <pilgrim@chromium.org>
    214
  • trunk/Source/WebKit2/ChangeLog

    r86459 r86467  
     12011-05-13  Anders Carlsson  <andersca@apple.com>
     2
     3        Reviewed by Sam Weinig.
     4
     5        NPN_GetURL with a javascript: URL doesn't send back the result in the stream
     6        https://bugs.webkit.org/show_bug.cgi?id=60810
     7
     8        In NetscapePluginStream::sendJavaScriptStream, we were incorrectly passing the result URL
     9        to the stream, instead of the result. Also, store the request URL in the NetscapePluginStream object
     10        to avoid sending it over the wire.
     11
     12        * PluginProcess/PluginControllerProxy.cpp:
     13        (WebKit::PluginControllerProxy::didEvaluateJavaScript):
     14        * PluginProcess/PluginControllerProxy.h:
     15        * PluginProcess/PluginControllerProxy.messages.in:
     16        * WebProcess/Plugins/Netscape/NetscapePlugin.cpp:
     17        (WebKit::NetscapePlugin::loadURL):
     18        (WebKit::NetscapePlugin::didEvaluateJavaScript):
     19        (WebKit::NetscapePlugin::manualStreamDidReceiveResponse):
     20        * WebProcess/Plugins/Netscape/NetscapePlugin.h:
     21        * WebProcess/Plugins/Netscape/NetscapePluginStream.cpp:
     22        (WebKit::NetscapePluginStream::NetscapePluginStream):
     23        (WebKit::NetscapePluginStream::sendJavaScriptStream):
     24        * WebProcess/Plugins/Netscape/NetscapePluginStream.h:
     25        (WebKit::NetscapePluginStream::create):
     26        * WebProcess/Plugins/Plugin.h:
     27        * WebProcess/Plugins/PluginProxy.cpp:
     28        (WebKit::PluginProxy::didEvaluateJavaScript):
     29        * WebProcess/Plugins/PluginProxy.h:
     30        * WebProcess/Plugins/PluginView.cpp:
     31        (WebKit::PluginView::performJavaScriptURLRequest):
     32
    1332011-05-13  Jeff Miller  <jeffm@apple.com>
    234
  • trunk/Source/WebKit2/PluginProcess/PluginControllerProxy.cpp

    r86169 r86467  
    403403}
    404404
    405 void PluginControllerProxy::didEvaluateJavaScript(uint64_t requestID, const String& requestURLString, const String& result)
    406 {
    407     m_plugin->didEvaluateJavaScript(requestID, requestURLString, result);
     405void PluginControllerProxy::didEvaluateJavaScript(uint64_t requestID, const String& result)
     406{
     407    m_plugin->didEvaluateJavaScript(requestID, result);
    408408}
    409409
  • trunk/Source/WebKit2/PluginProcess/PluginControllerProxy.h

    r86169 r86467  
    111111    void frameDidFail(uint64_t requestID, bool wasCancelled);
    112112    void geometryDidChange(const WebCore::IntRect& frameRect, const WebCore::IntRect& clipRect, const ShareableBitmap::Handle& backingStoreHandle);
    113     void didEvaluateJavaScript(uint64_t requestID, const String& requestURLString, const String& result);
     113    void didEvaluateJavaScript(uint64_t requestID, const String& result);
    114114    void streamDidReceiveResponse(uint64_t streamID, const String& responseURLString, uint32_t streamLength, uint32_t lastModifiedTime, const String& mimeType, const String& headers);
    115115    void streamDidReceiveData(uint64_t streamID, const CoreIPC::DataReference& data);
  • trunk/Source/WebKit2/PluginProcess/PluginControllerProxy.messages.in

    r84318 r86467  
    3434
    3535    # Sent when JavaScript that the plug-in asked to be evaluated has been evaluated.
    36     DidEvaluateJavaScript(uint64_t requestID, WTF::String requestURLString, WTF::String result)
     36    DidEvaluateJavaScript(uint64_t requestID, WTF::String result)
    3737
    3838    # Sent when the plug-in receives a response for a stream.
  • trunk/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp

    r86380 r86467  
    169169    if (target.isNull()) {
    170170        // The browser is going to send the data in a stream, create a plug-in stream.
    171         RefPtr<NetscapePluginStream> pluginStream = NetscapePluginStream::create(this, requestID, sendNotification, notificationData);
     171        RefPtr<NetscapePluginStream> pluginStream = NetscapePluginStream::create(this, requestID, urlString, sendNotification, notificationData);
    172172        ASSERT(!m_streams.contains(requestID));
    173173
     
    612612}
    613613
    614 void NetscapePlugin::didEvaluateJavaScript(uint64_t requestID, const String& requestURLString, const String& result)
     614void NetscapePlugin::didEvaluateJavaScript(uint64_t requestID, const String& result)
    615615{
    616616    ASSERT(m_isStarted);
    617617   
    618618    if (NetscapePluginStream* pluginStream = streamFromID(requestID))
    619         pluginStream->sendJavaScriptStream(requestURLString, result);
     619        pluginStream->sendJavaScriptStream(result);
    620620}
    621621
     
    660660    ASSERT(!m_manualStream);
    661661   
    662     m_manualStream = NetscapePluginStream::create(this, 0, false, 0);
     662    m_manualStream = NetscapePluginStream::create(this, 0, responseURL.string(), false, 0);
    663663    m_manualStream->didReceiveResponse(responseURL, streamLength, lastModifiedTime, mimeType, headers);
    664664}
  • trunk/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h

    r86169 r86467  
    155155    virtual void frameDidFinishLoading(uint64_t requestID);
    156156    virtual void frameDidFail(uint64_t requestID, bool wasCancelled);
    157     virtual void didEvaluateJavaScript(uint64_t requestID, const String& requestURLString, const String& result);
     157    virtual void didEvaluateJavaScript(uint64_t requestID, const String& result);
    158158    virtual void streamDidReceiveResponse(uint64_t streamID, const WebCore::KURL& responseURL, uint32_t streamLength,
    159159                                          uint32_t lastModifiedTime, const String& mimeType, const String& headers);
  • trunk/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePluginStream.cpp

    r85515 r86467  
    3535namespace WebKit {
    3636
    37 NetscapePluginStream::NetscapePluginStream(PassRefPtr<NetscapePlugin> plugin, uint64_t streamID, bool sendNotification, void* notificationData)
     37NetscapePluginStream::NetscapePluginStream(PassRefPtr<NetscapePlugin> plugin, uint64_t streamID, const String& requestURLString, bool sendNotification, void* notificationData)
    3838    : m_plugin(plugin)
    3939    , m_streamID(streamID)
     40    , m_requestURLString(requestURLString)
    4041    , m_sendNotification(sendNotification)
    4142    , m_notificationData(notificationData)
     
    9293}
    9394   
    94 void NetscapePluginStream::sendJavaScriptStream(const String& requestURLString, const String& result)
     95void NetscapePluginStream::sendJavaScriptStream(const String& result)
    9596{
    9697    // starting the stream or delivering the data to it might cause the plug-in stream to go away, so we keep
     
    9899    RefPtr<NetscapePluginStream> protect(this);
    99100
    100     CString resultCString = requestURLString.utf8();
     101    CString resultCString = result.utf8();
    101102    if (resultCString.isNull()) {
    102103        // There was an error evaluating the JavaScript, call NPP_URLNotify if needed and then destroy the stream.
     
    105106    }
    106107
    107     if (!start(requestURLString, resultCString.length(), 0, "text/plain", ""))
     108    if (!start(m_requestURLString, resultCString.length(), 0, "text/plain", ""))
    108109        return;
    109110
  • trunk/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePluginStream.h

    r82193 r86467  
    4646class NetscapePluginStream : public RefCounted<NetscapePluginStream> {
    4747public:
    48     static PassRefPtr<NetscapePluginStream> create(PassRefPtr<NetscapePlugin> plugin, uint64_t streamID, bool sendNotification, void* notificationData)
     48    static PassRefPtr<NetscapePluginStream> create(PassRefPtr<NetscapePlugin> plugin, uint64_t streamID, const String& requestURLString, bool sendNotification, void* notificationData)
    4949    {
    50         return adoptRef(new NetscapePluginStream(plugin, streamID, sendNotification, notificationData));
     50        return adoptRef(new NetscapePluginStream(plugin, streamID, requestURLString, sendNotification, notificationData));
    5151    }
    5252    ~NetscapePluginStream();
     
    6161    void didFail(bool wasCancelled);
    6262
    63     void sendJavaScriptStream(const String& requestURLString, const String& result);
     63    void sendJavaScriptStream(const String& result);
    6464
    6565    void stop(NPReason);
     
    6767
    6868private:
    69     NetscapePluginStream(PassRefPtr<NetscapePlugin>, uint64_t streamID, bool sendNotification, void* notificationData);
     69    NetscapePluginStream(PassRefPtr<NetscapePlugin>, uint64_t streamID, const String& requestURLString, bool sendNotification, void* notificationData);
    7070
    7171    bool start(const String& responseURLString, uint32_t streamLength,
     
    8181    RefPtr<NetscapePlugin> m_plugin;
    8282    uint64_t m_streamID;
    83    
     83
     84    String m_requestURLString;
    8485    bool m_sendNotification;
    8586    void* m_notificationData;
  • trunk/Source/WebKit2/WebProcess/Plugins/Plugin.h

    r85961 r86467  
    103103    // Tells the plug-in that a request to evaluate JavaScript (using PluginController::loadURL) has been fulfilled and passes
    104104    // back the result. If evaluating the script failed, result will be null.
    105     virtual void didEvaluateJavaScript(uint64_t requestID, const String& requestURLString, const String& result) = 0;
     105    virtual void didEvaluateJavaScript(uint64_t requestID, const String& result) = 0;
    106106
    107107    // Tells the plug-in that a stream has received its HTTP response.
  • trunk/Source/WebKit2/WebProcess/Plugins/PluginProxy.cpp

    r86317 r86467  
    234234}
    235235
    236 void PluginProxy::didEvaluateJavaScript(uint64_t requestID, const WTF::String& requestURLString, const WTF::String& result)
    237 {
    238     m_connection->connection()->send(Messages::PluginControllerProxy::DidEvaluateJavaScript(requestID, requestURLString, result), m_pluginInstanceID);
     236void PluginProxy::didEvaluateJavaScript(uint64_t requestID, const WTF::String& result)
     237{
     238    m_connection->connection()->send(Messages::PluginControllerProxy::DidEvaluateJavaScript(requestID, result), m_pluginInstanceID);
    239239}
    240240
  • trunk/Source/WebKit2/WebProcess/Plugins/PluginProxy.h

    r86317 r86467  
    7676    virtual void frameDidFinishLoading(uint64_t requestID);
    7777    virtual void frameDidFail(uint64_t requestID, bool wasCancelled);
    78     virtual void didEvaluateJavaScript(uint64_t requestID, const WTF::String& requestURLString, const WTF::String& result);
     78    virtual void didEvaluateJavaScript(uint64_t requestID, const String& result);
    7979    virtual void streamDidReceiveResponse(uint64_t streamID, const WebCore::KURL& responseURL, uint32_t streamLength, uint32_t lastModifiedTime, const WTF::String& mimeType, const WTF::String& headers);
    8080    virtual void streamDidReceiveData(uint64_t streamID, const char* bytes, int length);
  • trunk/Source/WebKit2/WebProcess/Plugins/PluginView.cpp

    r86451 r86467  
    794794 
    795795    // Send the result back to the plug-in.
    796     plugin->didEvaluateJavaScript(request->requestID(), decodeURLEscapeSequences(request->request().url()), resultString);
     796    plugin->didEvaluateJavaScript(request->requestID(), resultString);
    797797}
    798798
  • trunk/Tools/ChangeLog

    r86464 r86467  
     12011-05-13  Anders Carlsson  <andersca@apple.com>
     2
     3        Reviewed by Sam Weinig.
     4
     5        NPN_GetURL with a javascript: URL doesn't send back the result in the stream
     6        https://bugs.webkit.org/show_bug.cgi?id=60810
     7
     8        Add a test that calls NPN_GetURL on a javascript: URL and checks that it gets back the expected result.
     9
     10        * DumpRenderTree/DumpRenderTree.gypi:
     11        * DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj:
     12        * DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePlugin.vcproj:
     13        * DumpRenderTree/qt/TestNetscapePlugin/TestNetscapePlugin.pro:
     14        * GNUmakefile.am:
     15        Add files.
     16
     17        * DumpRenderTree/TestNetscapePlugIn/PluginTest.cpp:
     18        * DumpRenderTree/TestNetscapePlugIn/PluginTest.h:
     19        Add new NPN and NPP wrappers and sort them according to the order they appear in npfunctions.h
     20
     21        * DumpRenderTree/TestNetscapePlugIn/Tests/GetURLWithJavaScriptURL.cpp: Added.
     22        (GetURLWithJavaScriptURL::GetURLWithJavaScriptURL):
     23        (GetURLWithJavaScriptURL::NPP_New):
     24        (GetURLWithJavaScriptURL::NPP_NewStream):
     25        (GetURLWithJavaScriptURL::NPP_DestroyStream):
     26        (GetURLWithJavaScriptURL::NPP_WriteReady):
     27        (GetURLWithJavaScriptURL::NPP_Write):
     28        * DumpRenderTree/TestNetscapePlugIn/main.cpp:
     29        (NPP_NewStream):
     30        (NPP_WriteReady):
     31        (NPP_Write):
     32        (NPP_URLNotify):
     33        call the PluginTest NPP wrappers.
     34
    1352011-05-13  Sheriff Bot  <webkit.review.bot@gmail.com>
    236
  • trunk/Tools/DumpRenderTree/DumpRenderTree.gypi

    r79322 r86467  
    5353            'TestNetscapePlugIn/Tests/DocumentOpenInDestroyStream.cpp',
    5454            'TestNetscapePlugIn/Tests/EvaluateJSAfterRemovingPluginElement.cpp',
     55            'TestNetscapePlugIn/Tests/GetURLWithJavaScriptURL.cpp',
    5556            'TestNetscapePlugIn/Tests/GetURLWithJavaScriptURLDestroyingPlugin.cpp',
    5657            'TestNetscapePlugIn/Tests/GetUserAgentWithNullNPPFromNPPNew.cpp',
  • trunk/Tools/DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj

    r85274 r86467  
    3939                1A31EB3813466AC100017372 /* ConvertPoint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A31EB3713466AC100017372 /* ConvertPoint.cpp */; };
    4040                1A3E28AA1311D73B00501349 /* GetURLWithJavaScriptURLDestroyingPlugin.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A3E28A91311D73B00501349 /* GetURLWithJavaScriptURLDestroyingPlugin.cpp */; };
     41                1A5CC1F5137DD2EC00A5D7E7 /* GetURLWithJavaScriptURL.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A5CC1F3137DD2EC00A5D7E7 /* GetURLWithJavaScriptURL.cpp */; };
    4142                1A8F02E80BB9B4EC008CFA34 /* TestObject.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A8F024C0BB9B056008CFA34 /* TestObject.h */; };
    4243                1AC6C8490D07638600CD3161 /* main.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AC6C77F0D07589B00CD3161 /* main.cpp */; };
     
    216217                1A31EB3713466AC100017372 /* ConvertPoint.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ConvertPoint.cpp; sourceTree = "<group>"; };
    217218                1A3E28A91311D73B00501349 /* GetURLWithJavaScriptURLDestroyingPlugin.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GetURLWithJavaScriptURLDestroyingPlugin.cpp; sourceTree = "<group>"; };
     219                1A5CC1F3137DD2EC00A5D7E7 /* GetURLWithJavaScriptURL.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GetURLWithJavaScriptURL.cpp; sourceTree = "<group>"; };
    218220                1A8F024C0BB9B056008CFA34 /* TestObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TestObject.h; sourceTree = "<group>"; };
    219221                1AC6C77F0D07589B00CD3161 /* main.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = main.cpp; sourceTree = "<group>"; };
     
    488490                                1A215A7511F26072008AD0F5 /* DocumentOpenInDestroyStream.cpp */,
    489491                                C0E720741281C828004EF533 /* EvaluateJSAfterRemovingPluginElement.cpp */,
     492                                1A5CC1F3137DD2EC00A5D7E7 /* GetURLWithJavaScriptURL.cpp */,
    490493                                1A3E28A91311D73B00501349 /* GetURLWithJavaScriptURLDestroyingPlugin.cpp */,
    491494                                1AD4CB2012A6D1350027A7AF /* GetUserAgentWithNullNPPFromNPPNew.cpp */,
     
    800803                                1A31EB3813466AC100017372 /* ConvertPoint.cpp in Sources */,
    801804                                C031182B134E4A2B00919757 /* NPPSetWindowCalledDuringDestruction.cpp in Sources */,
     805                                1A5CC1F5137DD2EC00A5D7E7 /* GetURLWithJavaScriptURL.cpp in Sources */,
    802806                        );
    803807                        runOnlyForDeploymentPostprocessing = 0;
  • trunk/Tools/DumpRenderTree/TestNetscapePlugIn/PluginTest.cpp

    r83300 r86467  
    9393}
    9494
     95NPError PluginTest::NPP_SetWindow(NPP, NPWindow*)
     96{
     97    return NPERR_NO_ERROR;
     98}
     99
     100NPError PluginTest::NPP_NewStream(NPMIMEType type, NPStream* stream, NPBool seekable, uint16_t* stype)
     101{
     102    return NPERR_NO_ERROR;
     103}
     104
    95105NPError PluginTest::NPP_DestroyStream(NPStream *stream, NPReason reason)
    96106{
    97107    return NPERR_NO_ERROR;
     108}
     109
     110int32_t PluginTest::NPP_WriteReady(NPStream*)
     111{
     112    return 4096;
     113}
     114
     115int32_t PluginTest::NPP_Write(NPStream*, int32_t offset, int32_t len, void* buffer)
     116{
     117    return len;
     118}
     119
     120int16_t PluginTest::NPP_HandleEvent(void*)
     121{
     122    return 0;
     123}
     124
     125bool PluginTest::NPP_URLNotify(const char* url, NPReason, void* notifyData)
     126{
     127    // FIXME: Port the code from NPP_URLNotify in main.cpp over to always using
     128    // PluginTest, so we don't have to use a return value to indicate whether the "default" NPP_URLNotify implementation should be invoked.
     129    return false;
    98130}
    99131
     
    104136}
    105137
    106 NPError PluginTest::NPP_SetWindow(NPP, NPWindow*)
    107 {
    108     return NPERR_NO_ERROR;
    109 }
    110 
    111 int16_t PluginTest::NPP_HandleEvent(void*)
    112 {
    113     return 0;
     138// NPN functions.
     139
     140NPError PluginTest::NPN_GetURL(const char* url, const char* target)
     141{
     142    return browser->geturl(m_npp, url, target);
     143}
     144
     145NPError PluginTest::NPN_GetURLNotify(const char *url, const char *target, void *notifyData)
     146{
     147    return browser->geturlnotify(m_npp, url, target, notifyData);
     148}
     149
     150NPError PluginTest::NPN_GetValue(NPNVariable variable, void* value)
     151{
     152    return browser->getvalue(m_npp, variable, value);
    114153}
    115154
     
    119158}
    120159
    121 NPError PluginTest::NPN_GetURL(const char* url, const char* target)
    122 {
    123     return browser->geturl(m_npp, url, target);
    124 }
     160// NPRuntime NPN functions.
    125161
    126162NPIdentifier PluginTest::NPN_GetStringIdentifier(const NPUTF8 *name)
     
    132168{
    133169    return browser->getintidentifier(intid);
    134 }
    135 
    136 NPError PluginTest::NPN_GetValue(NPNVariable variable, void* value)
    137 {
    138     return browser->getvalue(m_npp, variable, value);
    139170}
    140171
  • trunk/Tools/DumpRenderTree/TestNetscapePlugIn/PluginTest.h

    r83300 r86467  
    6060    virtual NPError NPP_New(NPMIMEType pluginType, uint16_t mode, int16_t argc, char *argn[], char *argv[], NPSavedData *saved);
    6161    virtual NPError NPP_Destroy(NPSavedData**);
    62     virtual NPError NPP_DestroyStream(NPStream* stream, NPReason reason);
     62    virtual NPError NPP_SetWindow(NPP, NPWindow*);
     63    virtual NPError NPP_NewStream(NPMIMEType, NPStream*, NPBool seekable, uint16_t* stype);
     64    virtual NPError NPP_DestroyStream(NPStream*, NPReason);
     65    virtual int32_t NPP_WriteReady(NPStream*);
     66    virtual int32_t NPP_Write(NPStream*, int32_t offset, int32_t len, void* buffer);
     67   
     68    virtual int16_t NPP_HandleEvent(void* event);
     69    virtual bool NPP_URLNotify(const char* url, NPReason, void* notifyData);
    6370    virtual NPError NPP_GetValue(NPPVariable, void* value);
    64     virtual NPError NPP_SetWindow(NPP, NPWindow*);
    65     virtual int16_t NPP_HandleEvent(void* event);
    6671
    6772    // NPN functions.
    6873    NPError NPN_GetURL(const char* url, const char* target);
    69    
     74    NPError NPN_GetURLNotify(const char* url, const char* target, void* notifyData);
     75    NPError NPN_GetValue(NPNVariable, void* value);
    7076    void NPN_InvalidateRect(NPRect* invalidRect);
     77
     78    // NPRuntime NPN functions.
    7179    NPIdentifier NPN_GetStringIdentifier(const NPUTF8* name);
    7280    NPIdentifier NPN_GetIntIdentifier(int32_t intid);
    73     NPError NPN_GetValue(NPNVariable, void* value);
    7481    NPObject* NPN_CreateObject(NPClass*);
    7582    bool NPN_RemoveProperty(NPObject*, NPIdentifier propertyName);
     83
    7684#ifdef XP_MACOSX
    7785    bool NPN_ConvertPoint(double sourceX, double sourceY, NPCoordinateSpace sourceSpace, double *destX, double *destY, NPCoordinateSpace destSpace);
  • trunk/Tools/DumpRenderTree/TestNetscapePlugIn/main.cpp

    r85036 r86467  
    397397        executeScript(obj, obj->onStreamLoad);
    398398
    399     return NPERR_NO_ERROR;
     399    return obj->pluginTest->NPP_NewStream(type, stream, seekable, stype);
    400400}
    401401
     
    432432int32_t NPP_WriteReady(NPP instance, NPStream *stream)
    433433{
    434     return 4096;
     434    PluginObject* obj = (PluginObject*)instance->pdata;
     435    return obj->pluginTest->NPP_WriteReady(stream);
    435436}
    436437
     
    442443        return -1;
    443444
    444     return len;
     445    return obj->pluginTest->NPP_Write(stream, offset, len, buffer);
    445446}
    446447
     
    719720{
    720721    PluginObject* obj = static_cast<PluginObject*>(instance->pdata);
    721  
    722      if (obj->onURLNotify)
     722    if (obj->pluginTest->NPP_URLNotify(url, reason, notifyData))
     723        return;
     724
     725    if (obj->onURLNotify)
    723726         executeScript(obj, obj->onURLNotify);
    724727
  • trunk/Tools/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePlugin.vcproj

    r86442 r86467  
    399399                        </File>
    400400                        <File
     401                                RelativePath="..\Tests\GetURLWithJavaScriptURL.cpp"
     402                                >
     403                        </File>
     404                        <File
    401405                                RelativePath="..\Tests\GetURLWithJavaScriptURLDestroyingPlugin.cpp"
    402406                                >
  • trunk/Tools/DumpRenderTree/qt/TestNetscapePlugin/TestNetscapePlugin.pro

    r83300 r86467  
    3131          Tests/DocumentOpenInDestroyStream.cpp \
    3232          Tests/EvaluateJSAfterRemovingPluginElement.cpp \
     33          Tests/GetURLWithJavaScriptURL.cpp \
    3334          Tests/GetURLWithJavaScriptURLDestroyingPlugin.cpp \
    3435          Tests/GetUserAgentWithNullNPPFromNPPNew.cpp \
  • trunk/Tools/GNUmakefile.am

    r85229 r86467  
    186186        Tools/DumpRenderTree/TestNetscapePlugIn/Tests/DocumentOpenInDestroyStream.cpp \
    187187        Tools/DumpRenderTree/TestNetscapePlugIn/Tests/EvaluateJSAfterRemovingPluginElement.cpp \
     188        Tools/DumpRenderTree/TestNetscapePlugIn/Tests/GetURLWithJavaScriptURL.cpp \
    188189        Tools/DumpRenderTree/TestNetscapePlugIn/Tests/GetURLWithJavaScriptURLDestroyingPlugin.cpp \
    189190        Tools/DumpRenderTree/TestNetscapePlugIn/Tests/GetUserAgentWithNullNPPFromNPPNew.cpp \
Note: See TracChangeset for help on using the changeset viewer.