зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1352572 - Implement nptest.cpp:streamTest(postFile) parameter; r=bsmedberg
This is an optional parameter that can be used to test streams via file. It may be necessary to back out this change when NPAPI sandbox is completed as the testplugin may no longer be able to access files. MozReview-Commit-ID: FsYxhKKr4hS --HG-- extra : rebase_source : 5ee413531b5b178c92a1d5cf5c2223e624e02296
This commit is contained in:
Родитель
3b84e93d4a
Коммит
d52bc4b27e
|
@ -372,7 +372,7 @@ If the plugin is instantiated as a full-page plugin, the following defaults
|
||||||
are used:
|
are used:
|
||||||
streammode="seek" frame="testframe" range="100,100"
|
streammode="seek" frame="testframe" range="100,100"
|
||||||
|
|
||||||
* streamTest(url, doPost, postData, writeCallback, notifyCallback, redirectCallback, allowRedirects)
|
* streamTest(url, doPost, postData, writeCallback, notifyCallback, redirectCallback, allowRedirects, postFile = false)
|
||||||
This will test how NPN_GetURLNotify and NPN_PostURLNotify behave when they are
|
This will test how NPN_GetURLNotify and NPN_PostURLNotify behave when they are
|
||||||
called with arbitrary (malformed) URLs. The function will return `true` if
|
called with arbitrary (malformed) URLs. The function will return `true` if
|
||||||
NPN_[Get/Post]URLNotify succeeds, and `false` if it fails.
|
NPN_[Get/Post]URLNotify succeeds, and `false` if it fails.
|
||||||
|
@ -383,6 +383,7 @@ NPN_[Get/Post]URLNotify succeeds, and `false` if it fails.
|
||||||
@notifyCallback will be called when the urlnotify is received with the notify result
|
@notifyCallback will be called when the urlnotify is received with the notify result
|
||||||
@redirectCallback will be called from urlredirectnotify if a redirect is attempted
|
@redirectCallback will be called from urlredirectnotify if a redirect is attempted
|
||||||
@allowRedirects boolean value indicating whether or not to allow redirects
|
@allowRedirects boolean value indicating whether or not to allow redirects
|
||||||
|
@postFile boolean optional, defaults to false, set to true if postData contains a filename
|
||||||
|
|
||||||
* postFileToURLTest(url)
|
* postFileToURLTest(url)
|
||||||
Calls NPN_PostURL/NPN_PostURLNotify to make a POST request to the URL with
|
Calls NPN_PostURL/NPN_PostURLNotify to make a POST request to the URL with
|
||||||
|
|
|
@ -2721,8 +2721,8 @@ convertPointY(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVaria
|
||||||
static bool
|
static bool
|
||||||
streamTest(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVariant* result)
|
streamTest(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVariant* result)
|
||||||
{
|
{
|
||||||
// .streamTest(url, doPost, postData, writeCallback, notifyCallback, redirectCallback, allowRedirects)
|
// .streamTest(url, doPost, postData, writeCallback, notifyCallback, redirectCallback, allowRedirects, postFile = false)
|
||||||
if (7 != argCount)
|
if (!(7 <= argCount && argCount <= 8))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
NPP npp = static_cast<TestNPObject*>(npobj)->npp;
|
NPP npp = static_cast<TestNPObject*>(npobj)->npp;
|
||||||
|
@ -2779,6 +2779,14 @@ streamTest(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVariant*
|
||||||
return false;
|
return false;
|
||||||
bool allowRedirects = NPVARIANT_TO_BOOLEAN(args[6]);
|
bool allowRedirects = NPVARIANT_TO_BOOLEAN(args[6]);
|
||||||
|
|
||||||
|
bool postFile = false;
|
||||||
|
if (argCount >= 8) {
|
||||||
|
if (!NPVARIANT_IS_BOOLEAN(args[7])) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
postFile = NPVARIANT_TO_BOOLEAN(args[7]);
|
||||||
|
}
|
||||||
|
|
||||||
URLNotifyData* ndata = new URLNotifyData;
|
URLNotifyData* ndata = new URLNotifyData;
|
||||||
ndata->cookie = "dynamic-cookie";
|
ndata->cookie = "dynamic-cookie";
|
||||||
ndata->writeCallback = writeCallback;
|
ndata->writeCallback = writeCallback;
|
||||||
|
@ -2797,7 +2805,7 @@ streamTest(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVariant*
|
||||||
if (doPost) {
|
if (doPost) {
|
||||||
err = NPN_PostURLNotify(npp, urlstr, nullptr,
|
err = NPN_PostURLNotify(npp, urlstr, nullptr,
|
||||||
postData.UTF8Length, postData.UTF8Characters,
|
postData.UTF8Length, postData.UTF8Characters,
|
||||||
false, ndata);
|
postFile, ndata);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
err = NPN_GetURLNotify(npp, urlstr, nullptr, ndata);
|
err = NPN_GetURLNotify(npp, urlstr, nullptr, ndata);
|
||||||
|
|
Загрузка…
Ссылка в новой задаче