Changeset 35067 in webkit
- Timestamp:
- Jul 8, 2008 4:46:17 PM (16 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebKit/mac/ChangeLog
r35061 r35067 1 2008-07-08 Jon Honeycutt <jhoneycutt@apple.com> 2 3 Reviewed by Anders. 4 5 Port r34988 to Mac: don't call NPP_DestroyStream if NPP_NewStream was 6 unsuccessful. 7 8 * Plugins/WebBaseNetscapePluginStream.h: Added new member, 9 newStreamSuccessful. 10 * Plugins/WebBaseNetscapePluginStream.mm: 11 (-[WebBaseNetscapePluginStream initWithRequestURL:plugin:notifyData:sendNotification:]): Initialize new member. 12 (-[WebBaseNetscapePluginStream startStreamResponseURL:expectedContentLength:lastModifiedDate:MIMEType:headers:]): If NPP_NewStream is successful, set 13 newStreamSuccessful to YES. 14 (-[WebBaseNetscapePluginStream _destroyStream]): Only call 15 NPP_DestroyStream if newStreamSuccessful is true. 16 1 17 2008-07-08 Dan Bernstein <mitz@apple.com> 2 18 -
trunk/WebKit/mac/Plugins/WebBaseNetscapePluginStream.h
r30897 r35067 55 55 NPReason reason; 56 56 BOOL isTerminated; 57 57 BOOL newStreamSuccessful; 58 58 59 NPP_NewStreamProcPtr NPP_NewStream; 59 60 NPP_DestroyStreamProcPtr NPP_DestroyStream; -
trunk/WebKit/mac/Plugins/WebBaseNetscapePluginStream.mm
r30897 r35067 119 119 sendNotification = flag; 120 120 fileDescriptor = -1; 121 newStreamSuccessful = NO; 121 122 122 123 streams().add(&stream, thePlugin); … … 278 279 return; 279 280 } 281 282 newStreamSuccessful = YES; 280 283 281 284 switch (transferMode) { … … 400 403 } 401 404 402 NPError npErr; 403 WebBaseNetscapePluginView *pv = pluginView; 404 [pv willCallPlugInFunction]; 405 npErr = NPP_DestroyStream(plugin, &stream, reason); 406 [pv didCallPlugInFunction]; 407 LOG(Plugins, "NPP_DestroyStream responseURL=%@ error=%d", responseURL, npErr); 405 if (newStreamSuccessful) { 406 NPError npErr; 407 WebBaseNetscapePluginView *pv = pluginView; 408 [pv willCallPlugInFunction]; 409 npErr = NPP_DestroyStream(plugin, &stream, reason); 410 [pv didCallPlugInFunction]; 411 LOG(Plugins, "NPP_DestroyStream responseURL=%@ error=%d", responseURL, npErr); 412 } 408 413 409 414 free(headers); -
trunk/WebKitTools/ChangeLog
r35048 r35067 1 2008-07-08 Jon Honeycutt <jhoneycutt@apple.com> 2 3 Reviewed by Anders. 4 5 Port r34988 to Mac: allow tests to define JavaScript to execute when 6 NPP_DestroyStream or NPP_URLNotify is called. 7 8 * DumpRenderTree/TestNetscapePlugIn.subproj/main.cpp: 9 (NPP_New): Remove initialization that happens in pluginAllocate. Look 10 for new arguments onStreamDestroy and onURLNotify. 11 (NPP_Destroy): Free onStreamDestroy and onURLNotify. 12 (executeScript): Code moved from onStreamLoad. 13 (NPP_NewStream): Call executeScript. 14 (NPP_DestroyStream): Same. 15 (NPP_URLNotify): Same. 16 1 17 2008-07-07 Beth Dakin <bdakin@apple.com> 2 18 -
trunk/WebKitTools/DumpRenderTree/TestNetscapePlugIn.subproj/main.cpp
r33019 r35067 85 85 if (browser->version >= 14) { 86 86 PluginObject* obj = (PluginObject*)browser->createobject(instance, getPluginClass()); 87 88 obj->onStreamLoad = NULL; 89 87 90 88 for (int i = 0; i < argc; i++) { 91 89 if (strcasecmp(argn[i], "onstreamload") == 0 && !obj->onStreamLoad) 92 90 obj->onStreamLoad = strdup(argv[i]); 91 else if (strcasecmp(argn[i], "onStreamDestroy") == 0 && !obj->onStreamDestroy) 92 obj->onStreamDestroy = strdup(argv[i]); 93 else if (strcasecmp(argn[i], "onURLNotify") == 0 && !obj->onURLNotify) 94 obj->onURLNotify = strdup(argv[i]); 93 95 else if (strcasecmp(argn[i], "src") == 0 && 94 96 strcasecmp(argv[i], "data:application/x-webkit-test-netscape,returnerrorfromnewstream") == 0) … … 110 112 if (obj->onStreamLoad) 111 113 free(obj->onStreamLoad); 114 115 if (obj->onStreamDestroy) 116 free(obj->onStreamDestroy); 117 118 if (obj->onURLNotify) 119 free(obj->onURLNotify); 112 120 113 121 if (obj->logDestroy) … … 133 141 } 134 142 143 static void executeScript(const PluginObject* obj, const char* script) 144 { 145 NPObject *windowScriptObject; 146 browser->getvalue(obj->npp, NPNVWindowNPObject, &windowScriptObject); 147 148 NPString npScript; 149 npScript.UTF8Characters = script; 150 npScript.UTF8Length = strlen(script); 151 152 NPVariant browserResult; 153 browser->evaluate(obj->npp, windowScriptObject, &npScript, &browserResult); 154 browser->releasevariantvalue(&browserResult); 155 } 156 135 157 NPError NPP_NewStream(NPP instance, NPMIMEType type, NPStream *stream, NPBool seekable, uint16 *stype) 136 158 { … … 145 167 notifyStream(obj, stream->url, stream->headers); 146 168 147 if (obj->onStreamLoad) { 148 NPObject *windowScriptObject; 149 browser->getvalue(obj->npp, NPNVWindowNPObject, &windowScriptObject); 150 151 NPString script; 152 script.UTF8Characters = obj->onStreamLoad; 153 script.UTF8Length = strlen(obj->onStreamLoad); 154 155 NPVariant browserResult; 156 browser->evaluate(obj->npp, windowScriptObject, &script, &browserResult); 157 browser->releasevariantvalue(&browserResult); 158 } 159 169 if (obj->onStreamLoad) 170 executeScript(obj, obj->onStreamLoad); 171 160 172 return NPERR_NO_ERROR; 161 173 } … … 163 175 NPError NPP_DestroyStream(NPP instance, NPStream *stream, NPReason reason) 164 176 { 177 PluginObject* obj = (PluginObject*)instance->pdata; 178 179 if (obj->onStreamDestroy) 180 executeScript(obj, obj->onStreamDestroy); 181 165 182 return NPERR_NO_ERROR; 166 183 } … … 286 303 { 287 304 PluginObject* obj = static_cast<PluginObject*>(instance->pdata); 288 305 306 if (obj->onURLNotify) 307 executeScript(obj, obj->onURLNotify); 308 289 309 handleCallback(obj, url, reason, notifyData); 290 310 }
Note: See TracChangeset
for help on using the changeset viewer.