Changeset 90372 in webkit
- Timestamp:
- Jul 4, 2011 12:58:56 PM (13 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r90370 r90372 1 2011-07-04 Anders Carlsson <andersca@apple.com> 2 3 NP_RemoveProperty is not called back by Safari when delete npObject.prop is encountered in JavaScript 4 https://bugs.webkit.org/show_bug.cgi?id=63915 5 <rdar://problem/7124300> 6 7 Reviewed by Sam Weinig. 8 9 Add a test. I made this Mac-WebKit2 specific for now since no other plug-in implementations support this, 10 and there doesn't seem to be a way to make a WebKit2 specific test. 11 12 * platform/mac-wk2/plugins/npruntime/remove-property-from-javascript-expected.txt: Added. 13 * platform/mac-wk2/plugins/npruntime/remove-property-from-javascript.html: Added. 14 1 15 2011-07-04 Stephen White <senorblanco@chromium.org> 2 16 -
trunk/Source/WebKit2/ChangeLog
r90338 r90372 1 2011-07-04 Anders Carlsson <andersca@apple.com> 2 3 NP_RemoveProperty is not called back by Safari when delete npObject.prop is encountered in JavaScript 4 https://bugs.webkit.org/show_bug.cgi?id=63915 5 <rdar://problem/7124300> 6 7 Reviewed by Sam Weinig. 8 9 * WebProcess/Plugins/Netscape/JSNPObject.cpp: 10 (WebKit::JSNPObject::deleteProperty): 11 Call NP_RemoveProperty on the NPObject. 12 13 * WebProcess/Plugins/Netscape/JSNPObject.h: 14 Add deleteProperty. 15 1 16 2011-06-23 Robert Hogan <robert@webkit.org> 2 17 -
trunk/Source/WebKit2/WebProcess/Plugins/Netscape/JSNPObject.cpp
r87179 r90372 322 322 } 323 323 324 bool JSNPObject::deleteProperty(ExecState* exec, const Identifier& propertyName) 325 { 326 return deleteProperty(exec, npIdentifierFromIdentifier(propertyName)); 327 } 328 329 bool JSNPObject::deleteProperty(ExecState* exec, unsigned propertyName) 330 { 331 return deleteProperty(exec, static_cast<NPIdentifier>(IdentifierRep::get(propertyName))); 332 } 333 334 bool JSNPObject::deleteProperty(ExecState* exec, NPIdentifier propertyName) 335 { 336 ASSERT_GC_OBJECT_INHERITS(this, &s_info); 337 if (!m_npObject) { 338 throwInvalidAccessError(exec); 339 return false; 340 } 341 342 if (!m_npObject->_class->removeProperty) { 343 // FIXME: Should we throw an exception here? 344 return false; 345 } 346 347 // Calling NPClass::setProperty will call into plug-in code, and there's no telling what the plug-in can do. 348 // (including destroying the plug-in). Because of this, we make sure to keep the plug-in alive until 349 // the call has finished. 350 NPRuntimeObjectMap::PluginProtector protector(m_objectMap); 351 352 { 353 JSLock::DropAllLocks dropAllLocks(SilenceAssertionsOnly); 354 355 // FIXME: Should we throw an exception if removeProperty returns false? 356 if (!m_npObject->_class->removeProperty(m_npObject, propertyName)) 357 return false; 358 359 NPRuntimeObjectMap::moveGlobalExceptionToExecState(exec); 360 } 361 362 return true; 363 } 364 324 365 void JSNPObject::getOwnPropertyNames(ExecState* exec, PropertyNameArray& propertyNameArray, EnumerationMode mode) 325 366 { -
trunk/Source/WebKit2/WebProcess/Plugins/Netscape/JSNPObject.h
r84052 r90372 68 68 virtual void put(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::JSValue, JSC::PutPropertySlot&); 69 69 70 virtual bool deleteProperty(JSC::ExecState*, const JSC::Identifier& propertyName); 71 virtual bool deleteProperty(JSC::ExecState*, unsigned propertyName); 72 73 bool deleteProperty(JSC::ExecState*, NPIdentifier propertyName); 74 70 75 virtual void getOwnPropertyNames(JSC::ExecState*, JSC::PropertyNameArray&, JSC::EnumerationMode mode = JSC::ExcludeDontEnumProperties); 71 76 -
trunk/Tools/ChangeLog
r90361 r90372 1 2011-07-04 Anders Carlsson <andersca@apple.com> 2 3 NP_RemoveProperty is not called back by Safari when delete npObject.prop is encountered in JavaScript 4 https://bugs.webkit.org/show_bug.cgi?id=63915 5 <rdar://problem/7124300> 6 7 Reviewed by Sam Weinig. 8 9 Extend the NPRuntimeRemoveProperty to handle delete object.property from JavaScript. 10 11 * DumpRenderTree/TestNetscapePlugIn/PluginTest.cpp: 12 (PluginTest::NPN_IdentifierIsString): 13 (PluginTest::NPN_UTF8FromIdentifier): 14 (PluginTest::NPN_IntFromIdentifier): 15 (PluginTest::NPN_RetainObject): 16 (PluginTest::NPN_ReleaseObject): 17 * DumpRenderTree/TestNetscapePlugIn/PluginTest.h: 18 (PluginTest::Object::removeProperty): 19 (PluginTest::Object::identifierIs): 20 (PluginTest::Object::NP_RemoveProperty): 21 (PluginTest::Object::npClass): 22 * DumpRenderTree/TestNetscapePlugIn/Tests/NPRuntimeRemoveProperty.cpp: 23 (NPRuntimeRemoveProperty::TestObject::TestObject): 24 (NPRuntimeRemoveProperty::TestObject::hasProperty): 25 (NPRuntimeRemoveProperty::TestObject::getProperty): 26 (NPRuntimeRemoveProperty::TestObject::removeProperty): 27 (NPRuntimeRemoveProperty::PluginObject::PluginObject): 28 (NPRuntimeRemoveProperty::PluginObject::~PluginObject): 29 (NPRuntimeRemoveProperty::PluginObject::hasMethod): 30 (NPRuntimeRemoveProperty::PluginObject::invoke): 31 (NPRuntimeRemoveProperty::PluginObject::hasProperty): 32 (NPRuntimeRemoveProperty::PluginObject::getProperty): 33 (NPRuntimeRemoveProperty::NPP_GetValue): 34 1 35 2011-07-04 Leandro Pereira <leandro@profusion.mobi> 2 36 -
trunk/Tools/DumpRenderTree/TestNetscapePlugIn/PluginTest.cpp
r86467 r90372 170 170 } 171 171 172 bool PluginTest::NPN_IdentifierIsString(NPIdentifier npIdentifier) 173 { 174 return browser->identifierisstring(npIdentifier); 175 } 176 177 NPUTF8* PluginTest::NPN_UTF8FromIdentifier(NPIdentifier npIdentifier) 178 { 179 return browser->utf8fromidentifier(npIdentifier); 180 } 181 182 int32_t PluginTest::NPN_IntFromIdentifier(NPIdentifier npIdentifier) 183 { 184 return browser->intfromidentifier(npIdentifier); 185 } 186 172 187 NPObject* PluginTest::NPN_CreateObject(NPClass* npClass) 173 188 { 174 189 return browser->createobject(m_npp, npClass); 175 190 } 191 192 NPObject* PluginTest::NPN_RetainObject(NPObject* npObject) 193 { 194 return browser->retainobject(npObject); 195 } 196 197 void PluginTest::NPN_ReleaseObject(NPObject* npObject) 198 { 199 browser->releaseobject(npObject); 200 } 176 201 177 202 bool PluginTest::NPN_RemoveProperty(NPObject* npObject, NPIdentifier propertyName) -
trunk/Tools/DumpRenderTree/TestNetscapePlugIn/PluginTest.h
r86467 r90372 49 49 DEFINE_HAS_MEMBER_CHECK(hasProperty, bool, (NPIdentifier propertyName)); 50 50 DEFINE_HAS_MEMBER_CHECK(getProperty, bool, (NPIdentifier propertyName, NPVariant* result)); 51 DEFINE_HAS_MEMBER_CHECK(removeProperty, bool, (NPIdentifier propertyName)); 51 52 52 53 class PluginTest { … … 79 80 NPIdentifier NPN_GetStringIdentifier(const NPUTF8* name); 80 81 NPIdentifier NPN_GetIntIdentifier(int32_t intid); 82 bool NPN_IdentifierIsString(NPIdentifier); 83 NPUTF8* NPN_UTF8FromIdentifier(NPIdentifier); 84 int32_t NPN_IntFromIdentifier(NPIdentifier); 85 81 86 NPObject* NPN_CreateObject(NPClass*); 87 NPObject* NPN_RetainObject(NPObject*); 88 void NPN_ReleaseObject(NPObject*); 82 89 bool NPN_RemoveProperty(NPObject*, NPIdentifier propertyName); 83 90 … … 160 167 } 161 168 169 bool removeProperty(NPIdentifier propertyName) 170 { 171 assert(false); 172 return false; 173 } 174 175 // Helper functions. 176 bool identifierIs(NPIdentifier identifier, const char* value) 177 { 178 return pluginTest()->NPN_GetStringIdentifier(value) == identifier; 179 } 180 162 181 protected: 163 182 Object() … … 206 225 { 207 226 return static_cast<T*>(npObject)->getProperty(propertyName, result); 227 } 228 229 static bool NP_RemoveProperty(NPObject* npObject, NPIdentifier propertyName) 230 { 231 return static_cast<T*>(npObject)->removeProperty(propertyName); 208 232 } 209 233 … … 221 245 has_member_getProperty<T>::value ? NP_GetProperty : 0, 222 246 0, // NPClass::setProperty 223 0, // NPClass::removeProperty247 has_member_removeProperty<T>::value ? NP_RemoveProperty : 0, 224 248 0, // NPClass::enumerate 225 249 0 // NPClass::construct -
trunk/Tools/DumpRenderTree/TestNetscapePlugIn/Tests/NPRuntimeRemoveProperty.cpp
r89202 r90372 37 37 38 38 private: 39 struct TestObject : Object<TestObject> { 39 struct TestObject : Object<TestObject> { 40 40 public: 41 TestObject() 42 : m_lastRemovedProperty(0) 43 { 44 } 45 46 bool hasProperty(NPIdentifier propertyName) 47 { 48 if (identifierIs(propertyName, "lastRemovedProperty")) 49 return true; 50 51 return false; 52 } 53 54 bool getProperty(NPIdentifier propertyName, NPVariant* result) 55 { 56 assert(identifierIs(propertyName, "lastRemovedProperty")); 57 58 if (!m_lastRemovedProperty) 59 return false; 60 61 if (pluginTest()->NPN_IdentifierIsString(m_lastRemovedProperty)) { 62 char* lastRemovedPropertyName = pluginTest()->NPN_UTF8FromIdentifier(m_lastRemovedProperty); 63 64 STRINGZ_TO_NPVARIANT(lastRemovedPropertyName, *result); 65 return true; 66 } 67 68 int intIdentifier = pluginTest()->NPN_IntFromIdentifier(m_lastRemovedProperty); 69 DOUBLE_TO_NPVARIANT(intIdentifier, *result); 70 return true; 71 } 72 73 bool removeProperty(NPIdentifier propertyName) 74 { 75 m_lastRemovedProperty = propertyName; 76 return true; 77 } 78 79 private: 80 NPIdentifier m_lastRemovedProperty; 81 }; 82 83 struct PluginObject : Object<PluginObject> { 84 public: 85 PluginObject() 86 : m_testObject(0) 87 { 88 } 89 90 ~PluginObject() 91 { 92 if (m_testObject) 93 pluginTest()->NPN_ReleaseObject(m_testObject); 94 } 95 41 96 bool hasMethod(NPIdentifier methodName) 42 97 { 43 return methodName == pluginTest()->NPN_GetStringIdentifier("testRemoveProperty"); 98 if (identifierIs(methodName, "testRemoveProperty")) 99 return true; 100 101 return false; 44 102 } 45 103 46 104 bool invoke(NPIdentifier methodName, const NPVariant* arguments, uint32_t argumentCount, NPVariant* result) 47 105 { 48 assert( methodName == pluginTest()->NPN_GetStringIdentifier("testRemoveProperty"));106 assert(identifierIs(methodName, "testRemoveProperty")); 49 107 50 108 if (argumentCount != 2) … … 73 131 return true; 74 132 } 133 134 bool hasProperty(NPIdentifier propertyName) 135 { 136 if (identifierIs(propertyName, "testObject")) 137 return true; 138 139 return false; 140 } 141 142 bool getProperty(NPIdentifier propertyName, NPVariant* result) 143 { 144 assert(identifierIs(propertyName, "testObject")); 145 146 if (!m_testObject) 147 m_testObject = TestObject::create(pluginTest()); 148 149 OBJECT_TO_NPVARIANT(pluginTest()->NPN_RetainObject(m_testObject), *result); 150 return true; 151 } 152 153 private: 154 NPObject* m_testObject; 75 155 }; 76 156 … … 80 160 return NPERR_GENERIC_ERROR; 81 161 82 *(NPObject**)value = TestObject::create(this);162 *(NPObject**)value = PluginObject::create(this); 83 163 84 164 return NPERR_NO_ERROR;
Note: See TracChangeset
for help on using the changeset viewer.