Changeset 28366 in webkit
- Timestamp:
- Dec 3, 2007, 2:07:43 PM (18 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/ChangeLog
r28346 r28366 1 2007-12-03 Dan Bernstein <mitz@apple.com> 2 3 Reviewed by Darin Adler. 4 5 - fix an ASSERT when getIntIdentifier is called with 0 or -1 6 7 * bindings/npruntime.cpp: 8 (_NPN_GetIntIdentifier): We cannot use the hashmap for 0 and -1 since 9 they are the empty value and the deleted value. Instead, keep the 10 identifiers for those two integers in a static array. 11 1 12 2007-12-02 Darin Adler <darin@apple.com> 2 13 -
trunk/JavaScriptCore/bindings/npruntime.cpp
r25000 r28366 97 97 NPIdentifier _NPN_GetIntIdentifier(int32_t intid) 98 98 { 99 PrivateIdentifier* identifier = 0; 100 101 identifier = getIntIdentifierMap()->get(intid); 102 if (identifier == 0) { 103 identifier = (PrivateIdentifier*)malloc(sizeof(PrivateIdentifier)); 104 // We never release identifier names, so this dictionary will grow. 105 identifier->isString = false; 106 identifier->value.number = intid; 107 108 getIntIdentifierMap()->set(intid, identifier); 99 PrivateIdentifier* identifier; 100 101 if (intid == 0 || intid == -1) { 102 static PrivateIdentifier* negativeOneAndZeroIdentifiers[2]; 103 104 identifier = negativeOneAndZeroIdentifiers[intid + 1]; 105 if (!identifier) { 106 identifier = (PrivateIdentifier*)malloc(sizeof(PrivateIdentifier)); 107 identifier->isString = false; 108 identifier->isString = intid; 109 110 negativeOneAndZeroIdentifiers[intid + 1] = identifier; 111 } 112 } else { 113 identifier = getIntIdentifierMap()->get(intid); 114 if (!identifier) { 115 identifier = (PrivateIdentifier*)malloc(sizeof(PrivateIdentifier)); 116 // We never release identifier names, so this dictionary will grow. 117 identifier->isString = false; 118 identifier->value.number = intid; 119 120 getIntIdentifierMap()->set(intid, identifier); 121 } 109 122 } 110 123 return (NPIdentifier)identifier; -
trunk/LayoutTests/ChangeLog
r28363 r28366 1 2007-12-03 Dan Bernstein <mitz@apple.com> 2 3 Reviewed by Darin Adler. 4 5 - added a test of the behavior of getIntIdentifier with the integers 6 0 and -1 7 8 * plugins/getintidentifier-special-values-expected.txt: Added. 9 * plugins/getintidentifier-special-values.html: Added. 10 1 11 2007-12-03 Rob Buis <buis@kde.org> 2 12 -
trunk/WebKitTools/ChangeLog
r28338 r28366 1 2007-12-03 Dan Bernstein <mitz@apple.com> 2 3 Reviewed by Darin Adler. 4 5 - added a testGetIntIdentifier() method to TestNetscapePlugIn 6 7 * DumpRenderTree/TestNetscapePlugIn.subproj/PluginObject.c: 8 (pluginInvoke): 9 1 10 2007-12-03 Alexey Proskuryakov <ap@webkit.org> 2 11 -
trunk/WebKitTools/DumpRenderTree/TestNetscapePlugIn.subproj/PluginObject.c
r25128 r28366 94 94 #define ID_DESTROY_STREAM 6 95 95 #define ID_TEST_ENUMERATE 7 96 #define NUM_METHOD_IDENTIFIERS 8 96 #define ID_TEST_GETINTIDENTIFIER 8 97 #define NUM_METHOD_IDENTIFIERS 9 97 98 98 99 static NPIdentifier pluginMethodIdentifiers[NUM_METHOD_IDENTIFIERS]; … … 105 106 "testInvokeDefault", 106 107 "destroyStream", 107 "testEnumerate" 108 "testEnumerate", 109 "testGetIntIdentifier" 108 110 }; 109 111 … … 283 285 NPObject* outArray = NPVARIANT_TO_OBJECT(args[1]); 284 286 NPIdentifier pushIdentifier = browser->getstringidentifier("push"); 285 287 286 288 for (uint32_t i = 0; i < count; i++) { 287 289 NPUTF8* string = browser->utf8fromidentifier(identifiers[i]); … … 297 299 browser->memfree(string); 298 300 } 299 301 300 302 browser->memfree(identifiers); 301 303 } … … 308 310 INT32_TO_NPVARIANT(npError, *result); 309 311 return true; 310 } 312 } else if (name == pluginMethodIdentifiers[ID_TEST_GETINTIDENTIFIER]) { 313 if (argCount == 1 && NPVARIANT_IS_DOUBLE(args[0])) { 314 NPIdentifier identifier = browser->getintidentifier((int)NPVARIANT_TO_DOUBLE(args[0])); 315 INT32_TO_NPVARIANT((int32)identifier, *result); 316 return true; 317 } 318 } 311 319 return false; 312 320 }
Note:
See TracChangeset
for help on using the changeset viewer.