summaryrefslogtreecommitdiffstats
path: root/webkit/glue
diff options
context:
space:
mode:
authormattm@chromium.org <mattm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-22 04:58:05 +0000
committermattm@chromium.org <mattm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-22 04:58:05 +0000
commitde6a994d26a0445c7a2b06895f025a507fcbfb8f (patch)
tree9ab49859e09c2850c94fa253a00e9106c4ed96ac /webkit/glue
parent78fcb78177fc33f3a8558bf266191375e5ac0218 (diff)
downloadchromium_src-de6a994d26a0445c7a2b06895f025a507fcbfb8f.zip
chromium_src-de6a994d26a0445c7a2b06895f025a507fcbfb8f.tar.gz
chromium_src-de6a994d26a0445c7a2b06895f025a507fcbfb8f.tar.bz2
Fix FORWARD_NULL errors in plugin test helpers.
CID=468,469,470,471,472,473,474 BUG=none Review URL: http://codereview.chromium.org/212041 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@26796 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/glue')
-rw-r--r--webkit/glue/plugins/test/plugin_get_javascript_url_test.cc16
-rw-r--r--webkit/glue/plugins/test/plugin_geturl_test.cc20
2 files changed, 27 insertions, 9 deletions
diff --git a/webkit/glue/plugins/test/plugin_get_javascript_url_test.cc b/webkit/glue/plugins/test/plugin_get_javascript_url_test.cc
index ebdd745..46d1ef9 100644
--- a/webkit/glue/plugins/test/plugin_get_javascript_url_test.cc
+++ b/webkit/glue/plugins/test/plugin_get_javascript_url_test.cc
@@ -88,8 +88,10 @@ void CALLBACK ExecuteGetJavascriptUrlTest::TimerProc(
NPError ExecuteGetJavascriptUrlTest::NewStream(NPMIMEType type, NPStream* stream,
NPBool seekable, uint16* stype) {
- if (stream == NULL)
+ if (stream == NULL) {
SetError("NewStream got null stream");
+ return NPERR_INVALID_PARAM;
+ }
if (npn_evaluate_context_) {
SetError("NewStream received in context of NPN_Evaluate");
@@ -119,10 +121,14 @@ int32 ExecuteGetJavascriptUrlTest::WriteReady(NPStream *stream) {
int32 ExecuteGetJavascriptUrlTest::Write(NPStream *stream, int32 offset, int32 len,
void *buffer) {
- if (stream == NULL)
+ if (stream == NULL) {
SetError("Write got null stream");
- if (len < 0 || len > STREAM_CHUNK)
+ return -1;
+ }
+ if (len < 0 || len > STREAM_CHUNK) {
SetError("Write got bogus stream chunk size");
+ return -1;
+ }
if (npn_evaluate_context_) {
SetError("Write received in context of NPN_Evaluate");
@@ -146,8 +152,10 @@ int32 ExecuteGetJavascriptUrlTest::Write(NPStream *stream, int32 offset, int32 l
NPError ExecuteGetJavascriptUrlTest::DestroyStream(NPStream *stream, NPError reason) {
- if (stream == NULL)
+ if (stream == NULL) {
SetError("NewStream got null stream");
+ return NPERR_INVALID_PARAM;
+ }
#ifdef OS_WIN
KillTimer(window_, kNPNEvaluateTimerID);
diff --git a/webkit/glue/plugins/test/plugin_geturl_test.cc b/webkit/glue/plugins/test/plugin_geturl_test.cc
index baf9080..cdce37d 100644
--- a/webkit/glue/plugins/test/plugin_geturl_test.cc
+++ b/webkit/glue/plugins/test/plugin_geturl_test.cc
@@ -85,8 +85,10 @@ NPError PluginGetURLTest::SetWindow(NPWindow* pNPWindow) {
NPError PluginGetURLTest::NewStream(NPMIMEType type, NPStream* stream,
NPBool seekable, uint16* stype) {
- if (stream == NULL)
+ if (stream == NULL) {
SetError("NewStream got null stream");
+ return NPERR_INVALID_PARAM;
+ }
if (test_completed()) {
return PluginTest::NewStream(type, stream, seekable, stype);
@@ -179,10 +181,14 @@ int32 PluginGetURLTest::Write(NPStream *stream, int32 offset, int32 len,
return -1;
}
- if (stream == NULL)
+ if (stream == NULL) {
SetError("Write got null stream");
- if (len < 0 || len > STREAM_CHUNK)
+ return -1;
+ }
+ if (len < 0 || len > STREAM_CHUNK) {
SetError("Write got bogus stream chunk size");
+ return -1;
+ }
COMPILE_ASSERT(sizeof(unsigned long) <= sizeof(stream->notifyData),
cast_validity_check);
@@ -221,8 +227,10 @@ NPError PluginGetURLTest::DestroyStream(NPStream *stream, NPError reason) {
return PluginTest::DestroyStream(stream, reason);
}
- if (stream == NULL)
+ if (stream == NULL) {
SetError("NewStream got null stream");
+ return NPERR_INVALID_PARAM;
+ }
COMPILE_ASSERT(sizeof(unsigned long) <= sizeof(stream->notifyData),
cast_validity_check);
@@ -259,8 +267,10 @@ NPError PluginGetURLTest::DestroyStream(NPStream *stream, NPError reason) {
}
void PluginGetURLTest::StreamAsFile(NPStream* stream, const char* fname) {
- if (stream == NULL)
+ if (stream == NULL) {
SetError("NewStream got null stream");
+ return;
+ }
COMPILE_ASSERT(sizeof(unsigned long) <= sizeof(stream->notifyData),
cast_validity_check);