Changeset 64449 in webkit
- Timestamp:
- Aug 1, 2010 4:05:55 PM (14 years ago)
- Location:
- trunk/WebKit2
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebKit2/ChangeLog
r64448 r64449 1 2010-08-01 Anders Carlsson <andersca@apple.com> 2 3 Reviewed by Sam Weinig. 4 5 Implement NPN_SetException 6 https://bugs.webkit.org/show_bug.cgi?id=43320 7 8 * WebProcess/Plugins/JSNPObject.cpp: 9 (WebKit::JSNPObject::callConstructor): 10 (WebKit::JSNPObject::put): 11 (WebKit::JSNPObject::getOwnPropertyNames): 12 (WebKit::JSNPObject::propertyGetter): 13 Call NPRuntimeObjectMap::moveGlobalExceptionToExecState. 14 15 * WebProcess/Plugins/NPRuntimeObjectMap.cpp: 16 (WebKit::globalExceptionString): 17 Add static global. 18 19 (WebKit::NPRuntimeObjectMap::setGlobalException): 20 Set the global exception string. 21 22 (WebKit::NPRuntimeObjectMap::moveGlobalExceptionToExecState): 23 Create an error from the exception string. 24 25 * WebProcess/Plugins/NPRuntimeObjectMap.h: 26 * WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp: 27 (WebKit::NPN_SetException): 28 Call NetscapePlugin::setException. 29 30 * WebProcess/Plugins/Netscape/NetscapePlugin.cpp: 31 (WebKit::NetscapePlugin::setException): 32 Call NPRuntimeObjectMap::setGlobalException. 33 1 34 2010-08-01 Sam Weinig <sam@webkit.org> 2 35 -
trunk/WebKit2/WebProcess/Plugins/JSNPObject.cpp
r64365 r64449 152 152 JSLock::DropAllLocks dropAllLocks(SilenceAssertionsOnly); 153 153 returnValue = m_npObject->_class->construct(m_npObject, arguments.data(), argumentCount, &result); 154 155 // FIXME: Handle construct setting an exception.154 NPRuntimeObjectMap::moveGlobalExceptionToExecState(exec); 155 156 156 // FIXME: Find out what happens if calling construct causes the plug-in to go away. 157 157 } … … 274 274 m_npObject->_class->setProperty(m_npObject, npIdentifier, &variant); 275 275 276 // FIXME: Handle setProperty setting an exception. 276 NPRuntimeObjectMap::moveGlobalExceptionToExecState(exec); 277 277 278 // FIXME: Find out what happens if calling setProperty causes the plug-in to go away. 278 279 // FIXME: Should we throw an exception if setProperty returns false? … … 298 299 JSLock::DropAllLocks dropAllLocks(SilenceAssertionsOnly); 299 300 300 // FIXME: Handle enumerate setting an exception.301 301 // FIXME: Find out what happens if calling enumerate causes the plug-in to go away. 302 302 // FIXME: Should we throw an exception if enumerate returns false? 303 303 if (!m_npObject->_class->enumerate(m_npObject, &identifiers, &identifierCount)) 304 304 return; 305 306 NPRuntimeObjectMap::moveGlobalExceptionToExecState(exec); 305 307 } 306 308 … … 343 345 returnValue = thisObj->m_npObject->_class->getProperty(thisObj->m_npObject, npIdentifier, &result); 344 346 345 // FIXME: Handle getProperty setting an exception. 347 NPRuntimeObjectMap::moveGlobalExceptionToExecState(exec); 348 346 349 // FIXME: Find out what happens if calling getProperty causes the plug-in to go away. 347 350 } -
trunk/WebKit2/WebProcess/Plugins/NPRuntimeObjectMap.cpp
r64447 r64449 31 31 #include "NotImplemented.h" 32 32 #include "PluginView.h" 33 #include <JavaScriptCore/Error.h> 33 34 #include <JavaScriptCore/JSLock.h> 34 35 #include <JavaScriptCore/SourceCode.h> … … 235 236 } 236 237 238 static String& globalExceptionString() 239 { 240 DEFINE_STATIC_LOCAL(String, exceptionString, ()); 241 return exceptionString; 242 } 243 244 void NPRuntimeObjectMap::setGlobalException(const String& exceptionString) 245 { 246 globalExceptionString() = exceptionString; 247 } 248 249 void NPRuntimeObjectMap::moveGlobalExceptionToExecState(ExecState* exec) 250 { 251 if (globalExceptionString().isNull()) 252 return; 253 254 { 255 JSLock lock(SilenceAssertionsOnly); 256 throwError(exec, createError(exec, stringToUString(globalExceptionString()))); 257 } 258 259 globalExceptionString() = String(); 260 } 261 237 262 } // namespace WebKit -
trunk/WebKit2/WebProcess/Plugins/NPRuntimeObjectMap.h
r64377 r64449 66 66 JSC::JSValue convertNPVariantToJSValue(JSC::ExecState*, JSC::JSGlobalObject*, const NPVariant&); 67 67 68 bool evaluate(NPObject*, const WebCore::String& scriptString, NPVariant* result);68 bool evaluate(NPObject*, const WebCore::String& scriptString, NPVariant* result); 69 69 70 70 // Called when the plug-in is destroyed. Will invalidate all the NPObjects. … … 73 73 JSC::JSGlobalObject* globalObject() const; 74 74 JSC::ExecState* globalExec() const; 75 76 static void setGlobalException(const WebCore::String& exceptionString); 77 static void moveGlobalExceptionToExecState(JSC::ExecState*); 75 78 76 79 private: -
trunk/WebKit2/WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp
r64447 r64449 620 620 } 621 621 622 static void NPN_SetException(NPObject* npobj, const NPUTF8* message)623 { 624 notImplemented();622 static void NPN_SetException(NPObject*, const NPUTF8* message) 623 { 624 NetscapePlugin::setException(message); 625 625 } 626 626 -
trunk/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp
r64377 r64449 26 26 #include "NetscapePlugin.h" 27 27 28 #include "NPRuntimeObjectMap.h" 28 29 #include "NetscapePluginStream.h" 29 30 #include "PluginController.h" … … 149 150 } 150 151 152 void NetscapePlugin::setException(const String& exceptionString) 153 { 154 // FIXME: If the plug-in is running in its own process, this needs to send a CoreIPC message instead of 155 // calling the runtime object map directly. 156 NPRuntimeObjectMap::setGlobalException(exceptionString); 157 } 158 151 159 bool NetscapePlugin::evaluate(NPObject* npObject, const String& scriptString, NPVariant* result) 152 160 { -
trunk/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h
r64377 r64449 61 61 NPError destroyStream(NPStream*, NPReason); 62 62 void setStatusbarText(const WebCore::String&); 63 static void setException(const WebCore::String&); 63 64 bool evaluate(NPObject*, const WebCore::String&scriptString, NPVariant* result); 64 65
Note: See TracChangeset
for help on using the changeset viewer.