2009-03-03 Anders Carlsson <andersca@apple.com>
Reviewed by John Sullivan.
https://bugs.webkit.org/show_bug.cgi?id=22884
<rdar://problem/
6449783>
modified layout test crashes Safari
Null check NPStream before dereferencing it.
* plugins/PluginView.cpp:
(WebCore::PluginView::destroyStream):
WebKitTools:
2009-03-03 Anders Carlsson <andersca@apple.com>
Reviewed by John Sullivan.
https://bugs.webkit.org/show_bug.cgi?id=22884
<rdar://problem/
6449783>
modified layout test crashes Safari
Add destroyNullStream test function to the test plug-in.
* DumpRenderTree/TestNetscapePlugIn.subproj/PluginObject.cpp:
(destroyNullStream):
(pluginInvoke):
LayoutTests:
2009-03-03 Anders Carlsson <andersca@apple.com>
Reviewed by John Sullivan.
https://bugs.webkit.org/show_bug.cgi?id=22884
<rdar://problem/
6449783>
modified layout test crashes Safari
Update tests.
* plugins/destroy-stream-twice-expected.txt:
* plugins/destroy-stream-twice.html:
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@41414
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2009-03-03 Anders Carlsson <andersca@apple.com>
+
+ Reviewed by John Sullivan.
+
+ https://bugs.webkit.org/show_bug.cgi?id=22884
+ <rdar://problem/6449783>
+ modified layout test crashes Safari
+
+ Update tests.
+ * plugins/destroy-stream-twice-expected.txt:
+ * plugins/destroy-stream-twice.html:
+
2009-03-03 Eric Carlson <eric.carlson@apple.com>
Reviewed by Simon Fraser.
PASS document.getElementById('plugin').hasStream is true
PASS document.getElementById('plugin').destroyStream() is 2
PASS document.getElementById('plugin').destroyStream() is 2
+PASS document.getElementById('plugin').destroyNullStream() is 2
PASS: You didn't crash.
PASS successfullyParsed is 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
+ shouldBe("document.getElementById('plugin').destroyNullStream()", "2"); // Now try destroying a null stream
+
debug("PASS: You didn't crash.\n");
shouldBeTrue("successfullyParsed");
+2009-03-03 Anders Carlsson <andersca@apple.com>
+
+ Reviewed by John Sullivan.
+
+ https://bugs.webkit.org/show_bug.cgi?id=22884
+ <rdar://problem/6449783>
+ modified layout test crashes Safari
+
+ Null check NPStream before dereferencing it.
+
+ * plugins/PluginView.cpp:
+ (WebCore::PluginView::destroyStream):
+
2009-03-03 Eric Carlson <eric.carlson@apple.com>
Reviewed by Simon Fraser.
NPError PluginView::destroyStream(NPStream* stream, NPReason reason)
{
- PluginStream* browserStream = static_cast<PluginStream*>(stream->ndata);
-
if (!stream || PluginStream::ownerForStream(stream) != m_instance)
return NPERR_INVALID_INSTANCE_ERROR;
+ PluginStream* browserStream = static_cast<PluginStream*>(stream->ndata);
browserStream->cancelAndDestroyStream(reason);
+
return NPERR_NO_ERROR;
}
+2009-03-03 Anders Carlsson <andersca@apple.com>
+
+ Reviewed by John Sullivan.
+
+ https://bugs.webkit.org/show_bug.cgi?id=22884
+ <rdar://problem/6449783>
+ modified layout test crashes Safari
+
+ Add destroyNullStream test function to the test plug-in.
+
+ * DumpRenderTree/TestNetscapePlugIn.subproj/PluginObject.cpp:
+ (destroyNullStream):
+ (pluginInvoke):
+
2009-03-03 Brady Eidson <beidson@apple.com>
Reviewed by Darin Adler
#define ID_TEST_POSTURL_FILE 14
#define ID_TEST_CONSTRUCT 15
#define ID_TEST_THROW_EXCEPTION_METHOD 16
-#define NUM_METHOD_IDENTIFIERS 17
+#define ID_DESTROY_NULL_STREAM 17
+#define NUM_METHOD_IDENTIFIERS 18
static NPIdentifier pluginMethodIdentifiers[NUM_METHOD_IDENTIFIERS];
static const NPUTF8 *pluginMethodIdentifierNames[NUM_METHOD_IDENTIFIERS] = {
"testPostURLFile",
"testConstruct",
"testThrowException",
+ "destroyNullStream"
};
static NPUTF8* createCStringFromNPVariant(const NPVariant* variant)
return true;
}
+static bool destroyNullStream(PluginObject* obj, const NPVariant* args, uint32_t argCount, NPVariant* result)
+{
+ NPError npError = browser->destroystream(obj->npp, 0, NPRES_USER_BREAK);
+ INT32_TO_NPVARIANT(npError, *result);
+ return true;
+}
+
static bool testEnumerate(PluginObject* obj, const NPVariant* args, uint32_t argCount, NPVariant* result)
{
if (argCount != 2 || !NPVARIANT_IS_OBJECT(args[0]) || !NPVARIANT_IS_OBJECT(args[1]))
else if (name == pluginMethodIdentifiers[ID_TEST_THROW_EXCEPTION_METHOD]) {
browser->setexception(header, "plugin object testThrowException SUCCESS");
return true;
- }
+ } else if (name == pluginMethodIdentifiers[ID_DESTROY_NULL_STREAM])
+ return destroyNullStream(plugin, args, argCount, result);
return false;
}