Bug 595525 - Double data deletion in streamTest (nptest.cpp), test_streamNotify.html, r=josh, a=blocking:betaN+

This commit is contained in:
Honza Bambas 2010-10-11 21:41:11 +02:00
Родитель 33efabe286
Коммит 5176a08b72
2 изменённых файлов: 18 добавлений и 10 удалений

Просмотреть файл

@ -593,10 +593,15 @@ MakeNewNPAPIStreamInternal(NPP npp, const char *relativeURL, const char *target,
if (!pluginHost) return NPERR_GENERIC_ERROR;
nsCOMPtr<nsIPluginStreamListener> listener;
// Set aCallNotify here to false. If pluginHost->GetURL or PostURL fail,
// the listener's destructor will do the notification while we are about to
// return a failure code.
// Call SetCallNotify(true) bellow after we are sure we cannot return a failure
// code.
if (!target)
((nsNPAPIPluginInstance*)inst)->NewNotifyStream(getter_AddRefs(listener),
notifyData,
bDoNotify, relativeURL);
PR_FALSE, relativeURL);
switch (type) {
case eNPPStreamTypeInternal_Get:
@ -616,6 +621,15 @@ MakeNewNPAPIStreamInternal(NPP npp, const char *relativeURL, const char *target,
NS_ERROR("how'd I get here");
}
if (listener) {
// SetCallNotify(bDoNotify) here, see comment above.
// XXX Not sure of this cast here, we should probably have an interface API
// for this.
nsNPAPIPluginStreamListener* npAPIPluginStreamListener =
static_cast<nsNPAPIPluginStreamListener*>(listener.get());
npAPIPluginStreamListener->SetCallNotify(bDoNotify);
}
return NPERR_NO_ERROR;
}

Просмотреть файл

@ -9,7 +9,7 @@
<script class="testbody" type="application/javascript">
SimpleTest.waitForExplicitFinish();
var pending = 6;
var pending = 5;
function testDone() {
dump("testDone: " + pending + "\n")
--pending;
@ -49,10 +49,9 @@
testDone();
}), "streamTest GET bad DNS");
ok(p.streamTest("http://localhost:-8/", false, null,
ok(!p.streamTest("http://localhost:-8/", false, null,
function(r, t) {
is(r, 1, "Shouldn't load invalid URI");
testDone();
ok(false, "Shouldn't get callback from malformed URI");
}), "streamTest GET invalid URL");
ok(p.streamTest("javascript:'Hello';", false, null,
@ -80,14 +79,9 @@
testDone();
}), "streamTest GET data: URI");
/*
* XXX/bsmedberg: disable this test as well, since the pluginhost is broken
* and the testplugin is double-deleting the urlnotify context.
ok(!p.streamTest("data:malformed?", false, null,
function(r, t) {
todo(false, "Shouldn't get callback for invalid data: URI");
}), "streamTest GET bad data: URI");
*/
}
</script>