Commit 2663f9a7 authored by ggaren's avatar ggaren

LayoutTests:

        Reviewed by Beth Dakin.
        
        Layout test for <rdar://problem/5091330> REGRESSION: Repro crash in 
        -[WebBaseNetscapePluginView(WebNPPCallbacks) destroyStream:reason:] 
        navigating away from page with DivX movie plug-in (13203)

        * plugins/destroy-stream-twice-expected.txt: Added.
        * plugins/destroy-stream-twice.html: Added.

WebKit:

        Reviewed by Beth Dakin, reviewed by Maciej Stachowiak.
        
        Layout test for <rdar://problem/5091330> REGRESSION: Repro crash in 
        -[WebBaseNetscapePluginView(WebNPPCallbacks) destroyStream:reason:] 
        navigating away from page with DivX movie plug-in (13203)
        
        Changed LOG_ERROR to LOG so the layout test doesn't produce console spew
        every time you run it.

        * Plugins/WebBaseNetscapePluginView.mm:
        (-[WebBaseNetscapePluginView destroyStream:reason:]):

WebKitTools:

        Reviewed by Beth Dakin.
        
        Layout test for <rdar://problem/5091330> REGRESSION: Repro crash in 
        -[WebBaseNetscapePluginView(WebNPPCallbacks) destroyStream:reason:] 
        navigating away from page with DivX movie plug-in (13203)
        
        Added hasStream property and destroyStream function, used by layout test.

        * DumpRenderTree/TestNetscapePlugIn.subproj/PluginObject.c:
        (pluginGetProperty):
        (pluginInvoke):
        (pluginAllocate):
        * DumpRenderTree/TestNetscapePlugIn.subproj/PluginObject.h:
        * DumpRenderTree/TestNetscapePlugIn.subproj/main.c:
        (NPP_NewStream):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@20597 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 4b1e6748
2007-03-29 Geoffrey Garen <ggaren@apple.com>
Reviewed by Beth Dakin.
Layout test for <rdar://problem/5091330> REGRESSION: Repro crash in
-[WebBaseNetscapePluginView(WebNPPCallbacks) destroyStream:reason:]
navigating away from page with DivX movie plug-in (13203)
* plugins/destroy-stream-twice-expected.txt: Added.
* plugins/destroy-stream-twice.html: Added.
2007-03-28 Justin Garcia <justin.garcia@apple.com>
Reviewed by john
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
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
destroyStream() returns zero to indicate success, or a non-zero error code to indicate failure
PASS document.getElementById('plugin').hasStream is true
PASS document.getElementById('plugin').destroyStream() is 2
PASS document.getElementById('plugin').destroyStream() is 2
PASS: You didn't crash.
PASS successfullyParsed is true
TEST COMPLETE
<head>
<link rel="stylesheet" href="../fast/js/resources/js-test-style.css">
<script src="../fast/js/resources/js-test-pre.js"></script>
</head>
<body>
<p id="description"></p>
<div id="console"></div>
<embed id="plugin"
type="application/x-webkit-test-netscape"
src="data:text/plain,"
style="width:0; height:0">
</embed>
<script>
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");
function runTest()
{
debug("destroyStream() returns zero to indicate success, or a non-zero error code to indicate failure");
shouldBe("document.getElementById('plugin').hasStream", "true");
shouldBe("document.getElementById('plugin').destroyStream()", "2"); // we expect to fail because the stream should already have completed loading and destroyed itself
shouldBe("document.getElementById('plugin').destroyStream()", "2"); // try again, just for good measure
debug("PASS: You didn't crash.\n");
shouldBeTrue("successfullyParsed");
debug('<br><span class="pass">TEST COMPLETE</span>');
layoutTestController.notifyDone();
}
function main()
{
if (!window.layoutTestController) {
debug("This test can only run from within DumpRenderTree because it requires TestNetscapePlugin.\n");
return;
}
layoutTestController.waitUntilDone();
setTimeout(runTest, 5); // FIXME: Don't know how to wait until a plug-in stream has loaded.
}
main();
successfullyParsed = true;
</script>
2007-03-29 Geoffrey Garen <ggaren@apple.com>
Reviewed by Beth Dakin, reviewed by Maciej Stachowiak.
Layout test for <rdar://problem/5091330> REGRESSION: Repro crash in
-[WebBaseNetscapePluginView(WebNPPCallbacks) destroyStream:reason:]
navigating away from page with DivX movie plug-in (13203)
Changed LOG_ERROR to LOG so the layout test doesn't produce console spew
every time you run it.
* Plugins/WebBaseNetscapePluginView.mm:
(-[WebBaseNetscapePluginView destroyStream:reason:]):
2007-03-29 Beth Dakin <bdakin@apple.com>
Reviewed by Brady.
......
......@@ -2322,7 +2322,7 @@ static OSStatus TSMEventHandler(EventHandlerCallRef inHandlerRef, EventRef inEve
// belongs to the plug-in that provided it, which fixes a crash in the DivX
// plug-in: <rdar://problem/5093862> | http://bugs.webkit.org/show_bug.cgi?id=13203
if (!stream || [WebBaseNetscapePluginStream ownerForStream:browserStream] != plugin) {
LOG_ERROR("Invalid NPStream passed to NPN_DestroyStream: %p\n", stream);
LOG(Plugins, "Invalid NPStream passed to NPN_DestroyStream: %p", stream);
return NPERR_INVALID_INSTANCE_ERROR;
}
[browserStream cancelLoadAndDestroyStreamWithError:[browserStream errorForReason:reason]];
......
2007-03-29 Geoffrey Garen <ggaren@apple.com>
Reviewed by Beth Dakin.
Layout test for <rdar://problem/5091330> REGRESSION: Repro crash in
-[WebBaseNetscapePluginView(WebNPPCallbacks) destroyStream:reason:]
navigating away from page with DivX movie plug-in (13203)
Added hasStream property and destroyStream function, used by layout test.
* DumpRenderTree/TestNetscapePlugIn.subproj/PluginObject.c:
(pluginGetProperty):
(pluginInvoke):
(pluginAllocate):
* DumpRenderTree/TestNetscapePlugIn.subproj/PluginObject.h:
* DumpRenderTree/TestNetscapePlugIn.subproj/main.c:
(NPP_NewStream):
2007-03-27 Anders Carlsson <acarlsson@apple.com>
Reviewed by Geoff.
......
......@@ -67,12 +67,14 @@ static bool identifiersInitialized = false;
#define ID_PROPERTY_PROPERTY 0
#define ID_PROPERTY_EVENT_LOGGING 1
#define NUM_PROPERTY_IDENTIFIERS 2
#define ID_PROPERTY_HAS_STREAM 2
#define NUM_PROPERTY_IDENTIFIERS 3
static NPIdentifier pluginPropertyIdentifiers[NUM_PROPERTY_IDENTIFIERS];
static const NPUTF8 *pluginPropertyIdentifierNames[NUM_PROPERTY_IDENTIFIERS] = {
"property",
"eventLoggingEnabled"
"eventLoggingEnabled",
"hasStream"
};
#define ID_TEST_CALLBACK_METHOD 0
......@@ -81,7 +83,8 @@ static const NPUTF8 *pluginPropertyIdentifierNames[NUM_PROPERTY_IDENTIFIERS] = {
#define ID_TEST_DOM_ACCESS 3
#define ID_TEST_GET_URL_NOTIFY 4
#define ID_TEST_INVOKE_DEFAULT 5
#define NUM_METHOD_IDENTIFIERS 6
#define ID_DESTROY_STREAM 6
#define NUM_METHOD_IDENTIFIERS 7
static NPIdentifier pluginMethodIdentifiers[NUM_METHOD_IDENTIFIERS];
static const NPUTF8 *pluginMethodIdentifierNames[NUM_METHOD_IDENTIFIERS] = {
......@@ -90,7 +93,8 @@ static const NPUTF8 *pluginMethodIdentifierNames[NUM_METHOD_IDENTIFIERS] = {
"removeDefaultMethod",
"testDOMAccess",
"getURLNotify",
"testInvokeDefault"
"testInvokeDefault",
"destroyStream"
};
static NPUTF8* createCStringFromNPVariant(const NPVariant *variant)
......@@ -132,6 +136,9 @@ static bool pluginGetProperty(NPObject *obj, NPIdentifier name, NPVariant *varia
} else if (name == pluginPropertyIdentifiers[ID_PROPERTY_EVENT_LOGGING]) {
BOOLEAN_TO_NPVARIANT(((PluginObject *)obj)->eventLogging, *variant);
return true;
} else if (name == pluginPropertyIdentifiers[ID_PROPERTY_HAS_STREAM]) {
BOOLEAN_TO_NPVARIANT(((PluginObject *)obj)->stream != 0, *variant);
return true;
}
return false;
}
......@@ -242,7 +249,12 @@ static bool pluginInvoke(NPObject *header, NPIdentifier name, const NPVariant *a
BOOLEAN_TO_NPVARIANT(retval, *result);
return true;
}
} else if (name == pluginMethodIdentifiers[ID_DESTROY_STREAM]) {
assert(obj->stream);
NPError npError = browser->destroystream(obj->npp, obj->stream, NPRES_USER_BREAK);
INT32_TO_NPVARIANT(npError, *result);
return true;
}
return false;
}
......@@ -267,8 +279,8 @@ static NPObject *pluginAllocate(NPP npp, NPClass *theClass)
}
newInstance->npp = npp;
newInstance->eventLogging = FALSE;
newInstance->stream = 0;
return (NPObject *)newInstance;
}
......
......@@ -39,6 +39,7 @@ typedef struct {
NPObject header;
NPP npp;
Boolean eventLogging;
NPStream* stream;
} PluginObject;
extern NPClass *getPluginClass(void);
......
......@@ -92,7 +92,10 @@ NPError NPP_SetWindow(NPP instance, NPWindow *window)
NPError NPP_NewStream(NPP instance, NPMIMEType type, NPStream *stream, NPBool seekable, uint16 *stype)
{
PluginObject* obj = instance->pdata;
obj->stream = stream;
*stype = NP_ASFILEONLY;
return NPERR_NO_ERROR;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment