Changeset 20625 in webkit


Ignore:
Timestamp:
Mar 30, 2007 2:41:00 PM (17 years ago)
Author:
andersca
Message:

LayoutTests:

Reviewed by Geoff.

  • plugins/destroy-stream-twice.html: Put the scripts before the embed element. Set the timeout in the onstreamload handler.

WebKitTools:

Reviewed by Geoff.

Add an "onstreamload" attribute to the plugin which is called when a stream starts loading.


  • DumpRenderTree/TestNetscapePlugIn.subproj/PluginObject.h:
  • DumpRenderTree/TestNetscapePlugIn.subproj/main.c: (NPP_New): Look for the onstreamload attribute.


(NPP_Destroy):
Free the onstreamload attribute.


(NPP_NewStream):
Call the onstreamload handler.

Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r20617 r20625  
     12007-03-30  Anders Carlsson  <andersca@apple.com>
     2
     3        Reviewed by Geoff.
     4
     5        * plugins/destroy-stream-twice.html:
     6        Put the scripts before the embed element. Set the timeout in the onstreamload handler.
     7
    182007-03-30  Justin Garcia  <justin.garcia@apple.com>
    29
  • trunk/LayoutTests/plugins/destroy-stream-twice.html

    r20597 r20625  
    66<p id="description"></p>
    77<div id="console"></div>
    8 <embed id="plugin"
    9        type="application/x-webkit-test-netscape"
    10        src="data:text/plain,"
    11        style="width:0; height:0">
    12 </embed>
     8<script>
     9function main()
     10{
     11    if (!window.layoutTestController) {
     12        debug("This test can only run from within DumpRenderTree because it requires TestNetscapePlugin.\n");
     13        return;
     14    }
    1315
    14 <script>
    15 description("Test for http://bugs.webkit.org/show_bug.cgi?id=13203: REGRESSION: Repro crash in -[WebBaseNetscapePluginView(WebNPPCallbacks) destroyStream:reason:] navigating away from page with DivX movie plug-in");
     16    layoutTestController.waitUntilDone();
     17}
     18main();
    1619
    1720function runTest()
     
    2932    layoutTestController.notifyDone();
    3033}
     34</script>
     35<embed id="plugin"
     36       type="application/x-webkit-test-netscape"
     37       src="data:text/plain,"
     38       style="width:0; height:0"
     39       onstreamload="setTimeout(runTest, 0);">
     40</embed>
    3141
    32 function main()
    33 {
    34     if (!window.layoutTestController) {
    35         debug("This test can only run from within DumpRenderTree because it requires TestNetscapePlugin.\n");
    36         return;
    37     }
     42<script>
     43description("Test for http://bugs.webkit.org/show_bug.cgi?id=13203: REGRESSION: Repro crash in -[WebBaseNetscapePluginView(WebNPPCallbacks) destroyStream:reason:] navigating away from page with DivX movie plug-in");
    3844
    39     layoutTestController.waitUntilDone();
    40     setTimeout(runTest, 5); // FIXME: Don't know how to wait until a plug-in stream has loaded.
    41 }
    42 main();
    4345
    4446successfullyParsed = true;
  • trunk/WebKitTools/ChangeLog

    r20621 r20625  
     12007-03-30  Anders Carlsson  <andersca@apple.com>
     2
     3        Reviewed by Geoff.
     4
     5        Add an "onstreamload" attribute to the plugin which is called when a stream starts loading.
     6       
     7        * DumpRenderTree/TestNetscapePlugIn.subproj/PluginObject.h:
     8        * DumpRenderTree/TestNetscapePlugIn.subproj/main.c:
     9        (NPP_New):
     10        Look for the onstreamload attribute.
     11       
     12        (NPP_Destroy):
     13        Free the onstreamload attribute.
     14       
     15        (NPP_NewStream):
     16        Call the onstreamload handler.
     17
    1182007-03-30  Geoffrey Garen  <ggaren@apple.com>
    219
  • trunk/WebKitTools/DumpRenderTree/TestNetscapePlugIn.subproj/PluginObject.h

    r20613 r20625  
    4242    NPObject* testObject;
    4343    NPStream* stream;
     44    char* onStreamLoad;
    4445} PluginObject;
    4546
  • trunk/WebKitTools/DumpRenderTree/TestNetscapePlugIn.subproj/main.c

    r20597 r20625  
    7373NPError NPP_New(NPMIMEType pluginType, NPP instance, uint16 mode, int16 argc, char *argn[], char *argv[], NPSavedData *saved)
    7474{
    75     if (browser->version >= 14)
    76         instance->pdata = browser->createobject(instance, getPluginClass());
     75    if (browser->version >= 14) {
     76        PluginObject* obj = (PluginObject*)browser->createobject(instance, getPluginClass());
     77   
     78        obj->onStreamLoad = NULL;
     79       
     80        for (uint i = 0; i < argc; i++) {
     81            if (strcasecmp(argn[i], "onstreamload") == 0 && !obj->onStreamLoad)
     82                obj->onStreamLoad = strdup(argv[i]);
     83        }
     84       
     85        instance->pdata = obj;
     86    }
     87   
    7788    return NPERR_NO_ERROR;
    7889}
     
    8192{
    8293    PluginObject *obj = instance->pdata;
    83     if (obj)
     94    if (obj) {
     95        if (obj->onStreamLoad)
     96            free(obj->onStreamLoad);
     97       
    8498        browser->releaseobject(&obj->header);
     99    }
    85100    return NPERR_NO_ERROR;
    86101}
     
    97112    *stype = NP_ASFILEONLY;
    98113
     114    if (obj->onStreamLoad) {
     115        NPObject *windowScriptObject;
     116        browser->getvalue(obj->npp, NPNVWindowNPObject, &windowScriptObject);
     117               
     118        NPString script;
     119        script.UTF8Characters = obj->onStreamLoad;
     120        script.UTF8Length = strlen(obj->onStreamLoad);
     121       
     122        NPVariant browserResult;
     123        browser->evaluate(obj->npp, windowScriptObject, &script, &browserResult);
     124        browser->releasevariantvalue(&browserResult);
     125    }
     126   
    99127    return NPERR_NO_ERROR;
    100128}
Note: See TracChangeset for help on using the changeset viewer.