Changeset 62739 in webkit
- Timestamp:
- Jul 7, 2010 6:47:59 PM (14 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 6 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r62735 r62739 1 2010-07-07 Anders Carlsson <andersca@apple.com> 2 3 Reviewed by Sam Weinig. 4 5 Test that we call NPP_DestroyStream if a plug-in returns -1 from its NPP_Write function 6 https://bugs.webkit.org/show_bug.cgi?id=41821 7 8 * plugins/return-error-from-new-stream-doesnt-invoke-destroy-stream.html: 9 Update for changes to onstreamdestroy. 10 11 * plugins/return-negative-one-from-write-expected.txt: Added. 12 * plugins/return-negative-one-from-write.html: Added. 13 Add new test. 14 1 15 2010-07-07 Chris Fleizach <cfleizach@apple.com> 2 16 -
trunk/LayoutTests/plugins/return-error-from-new-stream-doesnt-invoke-destroy-stream.html
r34988 r62739 39 39 type="application/x-webkit-test-netscape" 40 40 onStreamLoad="streamStarted()" 41 onStreamDestroy="streamDestroyed ()"41 onStreamDestroy="streamDestroyed" 42 42 onURLNotify="requestCompleted()" 43 43 id="plugin"> -
trunk/LayoutTests/plugins/return-negative-one-from-write.html
r62738 r62739 9 9 10 10 <script> 11 var newStreamCalled = false; 11 12 var destroyStreamCalled = false; 12 13 … … 22 23 23 24 function streamStarted() { 24 testFailed("TestNetscapePlugin should have returned an error from NewStream."); 25 shouldBeFalse('newStreamCalled'); 26 newStreamCalled = true; 25 27 } 26 28 27 function streamDestroyed() { destroyStreamCalled = true; } 29 function streamDestroyed(reason) { 30 window.reason = reason; 28 31 29 function requestCompleted() {30 shouldBe False("destroyStreamCalled");32 shouldBeTrue('newStreamCalled') 33 shouldBe('reason', '1'); 31 34 32 35 debug('<br><span class="pass">TEST COMPLETE</span>'); … … 39 42 type="application/x-webkit-test-netscape" 40 43 onStreamLoad="streamStarted()" 41 onStreamDestroy="streamDestroyed()" 42 onURLNotify="requestCompleted()" 44 onStreamDestroy="streamDestroyed" 43 45 id="plugin"> 44 46 </body> 45 47 <script> 46 description("This tests that NPP_DestroyStream is not called if a plug-in returns an error from its NPP_NewStreamcallback.");48 description("This tests that NPP_DestroyStream is called with NPRES_NETWORK_ERR not called if a plug-in returns -1 its NPP_Write callback."); 47 49 48 50 var plugin = document.getElementById("plugin"); 49 51 50 plugin.return ErrorFromNewStream= true;51 shouldBeTrue("plugin.return ErrorFromNewStream");52 plugin.returnNegativeOneFromWrite = true; 53 shouldBeTrue("plugin.returnNegativeOneFromWrite"); 52 54 53 plugin.getURLNotify("data: ,", null, "callback");55 plugin.getURLNotify("data:text/html,Test", null, "callback"); 54 56 </script> 55 57 </html> -
trunk/WebKitTools/ChangeLog
r62737 r62739 1 2010-07-07 Anders Carlsson <andersca@apple.com> 2 3 Reviewed by Sam Weinig. 4 5 Test that we call NPP_DestroyStream if a plug-in returns -1 from its NPP_Write function 6 https://bugs.webkit.org/show_bug.cgi?id=41821 7 8 * DumpRenderTree/TestNetscapePlugIn/PluginObject.cpp: 9 (pluginGetProperty): 10 (pluginSetProperty): 11 (pluginAllocate): 12 * DumpRenderTree/TestNetscapePlugIn/PluginObject.h: 13 Add and initialize the returnNegativeOneFromWrite property. 14 15 * DumpRenderTree/TestNetscapePlugIn/main.cpp: 16 (NPP_NewStream): 17 Set the stream type to NP_NORMAL so we'll get write callbacks. 18 19 (NPP_DestroyStream): 20 Treat the onstreamdestroy attribute as a function name and not a string. 21 22 (NPP_WriteReady): 23 Have this return a nonzero value. 24 25 (NPP_Write): 26 If returnNegativeOneFromWrite is true return -1. 27 1 28 2010-07-07 Kevin Ollivier <kevino@theolliviers.com> 2 29 -
trunk/WebKitTools/DumpRenderTree/TestNetscapePlugIn/PluginObject.cpp
r62685 r62739 133 133 ID_PROPERTY_LOG_DESTROY, 134 134 ID_PROPERTY_RETURN_ERROR_FROM_NEWSTREAM, 135 ID_PROPERTY_RETURN_NEGATIVE_ONE_FROM_WRITE, 135 136 ID_PROPERTY_PRIVATE_BROWSING_ENABLED, 136 137 ID_PROPERTY_CACHED_PRIVATE_BROWSING_ENABLED, … … 148 149 "logDestroy", 149 150 "returnErrorFromNewStream", 151 "returnNegativeOneFromWrite", 150 152 "privateBrowsingEnabled", 151 153 "cachedPrivateBrowsingEnabled", … … 283 285 BOOLEAN_TO_NPVARIANT(plugin->returnErrorFromNewStream, *result); 284 286 return true; 287 } else if (name == pluginPropertyIdentifiers[ID_PROPERTY_RETURN_NEGATIVE_ONE_FROM_WRITE]) { 288 BOOLEAN_TO_NPVARIANT(plugin->returnNegativeOneFromWrite, *result); 289 return true; 285 290 } else if (name == pluginPropertyIdentifiers[ID_PROPERTY_PRIVATE_BROWSING_ENABLED]) { 286 291 NPBool privateBrowsingEnabled = FALSE; … … 317 322 } else if (name == pluginPropertyIdentifiers[ID_PROPERTY_RETURN_ERROR_FROM_NEWSTREAM]) { 318 323 plugin->returnErrorFromNewStream = NPVARIANT_TO_BOOLEAN(*variant); 324 return true; 325 } else if (name == pluginPropertyIdentifiers[ID_PROPERTY_RETURN_NEGATIVE_ONE_FROM_WRITE]) { 326 plugin->returnNegativeOneFromWrite = NPVARIANT_TO_BOOLEAN(*variant); 319 327 return true; 320 328 } else if (name == pluginPropertyIdentifiers[ID_PROPERTY_THROW_EXCEPTION_PROPERTY]) { … … 968 976 newInstance->logSetWindow = FALSE; 969 977 newInstance->returnErrorFromNewStream = FALSE; 978 newInstance->returnNegativeOneFromWrite = FALSE; 970 979 newInstance->stream = 0; 971 980 -
trunk/WebKitTools/DumpRenderTree/TestNetscapePlugIn/PluginObject.h
r62685 r62739 35 35 NPBool logSetWindow; 36 36 NPBool logDestroy; 37 NPBool returnNegativeOneFromWrite; 37 38 NPBool returnErrorFromNewStream; 38 39 NPBool cachedPrivateBrowsingMode; -
trunk/WebKitTools/DumpRenderTree/TestNetscapePlugIn/main.cpp
r62700 r62739 240 240 PluginObject* obj = static_cast<PluginObject*>(instance->pdata); 241 241 obj->stream = stream; 242 *stype = NP_ ASFILEONLY;242 *stype = NP_NORMAL; 243 243 244 244 if (obj->returnErrorFromNewStream) … … 258 258 PluginObject* obj = (PluginObject*)instance->pdata; 259 259 260 if (obj->onStreamDestroy) 261 executeScript(obj, obj->onStreamDestroy); 260 if (obj->onStreamDestroy) { 261 NPObject* windowObject = 0; 262 NPError error = browser->getvalue(instance, NPNVWindowNPObject, &windowObject); 263 264 if (error == NPERR_NO_ERROR) { 265 NPVariant onStreamDestroyVariant; 266 if (browser->getproperty(instance, windowObject, browser->getstringidentifier(obj->onStreamDestroy), &onStreamDestroyVariant)) { 267 if (NPVARIANT_IS_OBJECT(onStreamDestroyVariant)) { 268 NPObject* onStreamDestroyFunction = NPVARIANT_TO_OBJECT(onStreamDestroyVariant); 269 270 NPVariant reasonVariant; 271 INT32_TO_NPVARIANT(reason, reasonVariant); 272 273 NPVariant result; 274 browser->invokeDefault(instance, onStreamDestroyFunction, &reasonVariant, 1, &result); 275 browser->releasevariantvalue(&result); 276 } 277 browser->releasevariantvalue(&onStreamDestroyVariant); 278 } 279 browser->releaseobject(windowObject); 280 } 281 } 262 282 263 283 if (obj->testDocumentOpenInDestroyStream) { … … 271 291 int32_t NPP_WriteReady(NPP instance, NPStream *stream) 272 292 { 273 return 0;293 return 4096; 274 294 } 275 295 276 296 int32_t NPP_Write(NPP instance, NPStream *stream, int32_t offset, int32_t len, void *buffer) 277 297 { 278 return 0; 298 PluginObject* obj = (PluginObject*)instance->pdata; 299 300 if (obj->returnNegativeOneFromWrite) 301 return -1; 302 303 return len; 279 304 } 280 305
Note: See TracChangeset
for help on using the changeset viewer.