Changeset 34988 in webkit
- Timestamp:
- Jul 3, 2008 1:52:56 PM (16 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r34986 r34988 1 2008-07-02 Jon Honeycutt <jhoneycutt@apple.com> 2 3 Test for <rdar://5983747> Safari crashes trying to load the SilverLight plugin 4 5 Reviewed by Anders. 6 7 * plugins/return-error-from-new-stream-doesnt-invoke-destroy-stream-expected.txt: Added. 8 * plugins/return-error-from-new-stream-doesnt-invoke-destroy-stream.html: Added. 9 1 10 2008-07-03 Alexey Proskuryakov <ap@webkit.org> 2 11 -
trunk/WebCore/ChangeLog
r34987 r34988 1 2008-07-02 Jon Honeycutt <jhoneycutt@apple.com> 2 3 <rdar://5983747> Safari crashes trying to load the SilverLight plugin 4 5 If a plug-in returned an error code from NPP_NewStream, we would call 6 NPP_DestroyStream while cleaning up the request. We now only call 7 NPP_DestroyStream if NPP_NewStream was successful, matching Firefox. 8 9 Reviewed by Anders. 10 11 * plugins/PluginStream.cpp: 12 (WebCore::PluginStream::startStream): If NPP_NewStream returns an error, 13 don't set m_streamState to StreamStarted, and return after calling 14 cancelAndDestroyStream. 15 (WebCore::PluginStream::destroyStream): Don't call NPP_DestroyStream if 16 the stream didn't start successfully. 17 1 18 2008-07-03 David Hyatt <hyatt@apple.com> 2 19 -
trunk/WebCore/plugins/PluginStream.cpp
r34536 r34988 188 188 return; 189 189 190 if (npErr != NPERR_NO_ERROR) { 191 cancelAndDestroyStream(npErr); 192 return; 193 } 194 190 195 m_streamState = StreamStarted; 191 192 if (npErr != NPERR_NO_ERROR)193 cancelAndDestroyStream(npErr);194 196 195 197 if (m_transferMode == NP_NORMAL) … … 253 255 } 254 256 255 if (m_loader) 256 m_loader->setDefersLoading(true); 257 NPError npErr = m_pluginFuncs->destroystream(m_instance, &m_stream, m_reason); 258 if (m_loader) 259 m_loader->setDefersLoading(false); 260 LOG_NPERROR(npErr); 257 if (m_streamState != StreamBeforeStarted) { 258 if (m_loader) 259 m_loader->setDefersLoading(true); 260 261 NPError npErr = m_pluginFuncs->destroystream(m_instance, &m_stream, m_reason); 262 263 if (m_loader) 264 m_loader->setDefersLoading(false); 265 266 LOG_NPERROR(npErr); 267 } 261 268 262 269 m_stream.ndata = 0; -
trunk/WebKitTools/ChangeLog
r34972 r34988 1 2008-07-02 Jon Honeycutt <jhoneycutt@apple.com> 2 3 Allow tests to define JavaScript to execute when NPP_DestroyStream or 4 NPP_URLNotify is called. 5 6 Reviewed by Anders. 7 8 * DumpRenderTree/TestNetscapePlugIn.subproj/PluginObject.cpp: Add a new 9 property, "returnErrorFromNewStream." This is to support the test for 10 <rdar://5983747> Safari crashes trying to load the SilverLight plugin, 11 caused by WebKit calling NPP_DestroyStream after a plug-in returns an 12 error from NPP_NewStream. 13 (pluginGetProperty): 14 (pluginSetProperty): 15 (pluginAllocate): 16 * DumpRenderTree/TestNetscapePlugIn.subproj/PluginObject.h: Added new 17 members, onStreamDestroy and onURLNotify. 18 * DumpRenderTree/win/TestNetscapePlugin/main.cpp: 19 (NPP_New): Remove initialization of onStreamLoad; this was moved to 20 pluginAllocate. Look for new arguments onStreamDestroy and 21 onURLNotify, and store their values. 22 (NPP_Destroy): Free new members. 23 (executeScript): Code moved from onStreamLoad 24 (NPP_NewStream): If returnErrorFromNewStream has been set to true, 25 return a generic error code. If onStreamLoad is set, execute it as 26 JavaScript. 27 (NPP_DestroyStream): If onStreamDestroy is set, execute it as JS. 28 (NPP_URLNotify): Same, for onURLNotify. 29 1 30 2008-07-02 Brady Eidson <beidson@apple.com> 2 31 -
trunk/WebKitTools/DumpRenderTree/TestNetscapePlugIn.subproj/PluginObject.cpp
r33076 r34988 62 62 static bool identifiersInitialized = false; 63 63 64 #define ID_PROPERTY_PROPERTY 0 65 #define ID_PROPERTY_EVENT_LOGGING 1 66 #define ID_PROPERTY_HAS_STREAM 2 67 #define ID_PROPERTY_TEST_OBJECT 3 68 #define ID_PROPERTY_LOG_DESTROY 4 69 #define NUM_PROPERTY_IDENTIFIERS 5 64 #define ID_PROPERTY_PROPERTY 0 65 #define ID_PROPERTY_EVENT_LOGGING 1 66 #define ID_PROPERTY_HAS_STREAM 2 67 #define ID_PROPERTY_TEST_OBJECT 3 68 #define ID_PROPERTY_LOG_DESTROY 4 69 #define ID_PROPERTY_RETURN_ERROR_FROM_NEWSTREAM 5 70 #define NUM_PROPERTY_IDENTIFIERS 6 70 71 71 72 static NPIdentifier pluginPropertyIdentifiers[NUM_PROPERTY_IDENTIFIERS]; … … 76 77 "testObject", 77 78 "logDestroy", 79 "returnErrorFromNewStream", 78 80 }; 79 81 … … 165 167 OBJECT_TO_NPVARIANT(testObject, *result); 166 168 return true; 169 } else if (name == pluginPropertyIdentifiers[ID_PROPERTY_RETURN_ERROR_FROM_NEWSTREAM]) { 170 BOOLEAN_TO_NPVARIANT(plugin->returnErrorFromNewStream, *result); 171 return true; 167 172 } 168 173 return false; … … 177 182 } else if (name == pluginPropertyIdentifiers[ID_PROPERTY_LOG_DESTROY]) { 178 183 plugin->logDestroy = NPVARIANT_TO_BOOLEAN(*variant); 184 return true; 185 } else if (name == pluginPropertyIdentifiers[ID_PROPERTY_RETURN_ERROR_FROM_NEWSTREAM]) { 186 plugin->returnErrorFromNewStream = NPVARIANT_TO_BOOLEAN(*variant); 179 187 return true; 180 188 } … … 575 583 newInstance->testObject = browser->createobject(npp, getTestClass()); 576 584 newInstance->eventLogging = FALSE; 585 newInstance->onStreamLoad = 0; 586 newInstance->onStreamDestroy = 0; 587 newInstance->onURLNotify = 0; 577 588 newInstance->logDestroy = FALSE; 578 589 newInstance->logSetWindow = FALSE; -
trunk/WebKitTools/DumpRenderTree/TestNetscapePlugIn.subproj/PluginObject.h
r30520 r34988 38 38 NPStream* stream; 39 39 char* onStreamLoad; 40 char* onStreamDestroy; 41 char* onURLNotify; 40 42 char* firstUrl; 41 43 char* firstHeaders; -
trunk/WebKitTools/DumpRenderTree/win/TestNetscapePlugin/main.cpp
r29663 r34988 77 77 if (browser->version >= 14) { 78 78 PluginObject* obj = (PluginObject*)browser->createobject(instance, getPluginClass()); 79 80 obj->onStreamLoad = NULL;81 79 82 80 for (int16 i = 0; i < argc; i++) { 83 81 if (_stricmp(argn[i], "onstreamload") == 0 && !obj->onStreamLoad) 84 82 obj->onStreamLoad = _strdup(argv[i]); 83 else if (_stricmp(argn[i], "onStreamDestroy") == 0 && !obj->onStreamDestroy) 84 obj->onStreamDestroy = _strdup(argv[i]); 85 else if (_stricmp(argn[i], "onURLNotify") == 0 && !obj->onURLNotify) 86 obj->onURLNotify = _strdup(argv[i]); 85 87 } 86 88 … … 97 99 if (obj->onStreamLoad) 98 100 free(obj->onStreamLoad); 99 101 102 if (obj->onURLNotify) 103 free(obj->onURLNotify); 104 105 if (obj->onStreamDestroy) 106 free(obj->onStreamDestroy); 107 100 108 if (obj->logDestroy) 101 109 printf("PLUGIN: NPP_Destroy\n"); … … 111 119 } 112 120 121 static void executeScript(const PluginObject* obj, const char* script) 122 { 123 NPObject *windowScriptObject; 124 browser->getvalue(obj->npp, NPNVWindowNPObject, &windowScriptObject); 125 126 NPString npScript; 127 npScript.UTF8Characters = script; 128 npScript.UTF8Length = strlen(script); 129 130 NPVariant browserResult; 131 browser->evaluate(obj->npp, windowScriptObject, &npScript, &browserResult); 132 browser->releasevariantvalue(&browserResult); 133 } 134 113 135 NPError NPP_NewStream(NPP instance, NPMIMEType type, NPStream *stream, NPBool seekable, uint16 *stype) 114 136 { 115 137 PluginObject* obj = (PluginObject*)instance->pdata; 138 139 if (obj->returnErrorFromNewStream) 140 return NPERR_GENERIC_ERROR; 141 116 142 obj->stream = stream; 117 143 *stype = NP_ASFILEONLY; 118 144 119 if (obj->onStreamLoad) { 120 NPObject *windowScriptObject; 121 browser->getvalue(obj->npp, NPNVWindowNPObject, &windowScriptObject); 122 123 NPString script; 124 script.UTF8Characters = obj->onStreamLoad; 125 script.UTF8Length = strlen(obj->onStreamLoad); 126 127 NPVariant browserResult; 128 browser->evaluate(obj->npp, windowScriptObject, &script, &browserResult); 129 browser->releasevariantvalue(&browserResult); 130 } 145 if (obj->onStreamLoad) 146 executeScript(obj, obj->onStreamLoad); 131 147 132 148 return NPERR_NO_ERROR; … … 135 151 NPError NPP_DestroyStream(NPP instance, NPStream *stream, NPReason reason) 136 152 { 153 PluginObject* obj = (PluginObject*)instance->pdata; 154 155 if (obj->onStreamDestroy) 156 executeScript(obj, obj->onStreamDestroy); 157 137 158 return NPERR_NO_ERROR; 138 159 } … … 169 190 { 170 191 PluginObject *obj = (PluginObject*)instance->pdata; 192 193 if (obj->onURLNotify) 194 executeScript(obj, obj->onURLNotify); 171 195 172 196 handleCallback(obj, url, reason, notifyData);
Note: See TracChangeset
for help on using the changeset viewer.