| OLD | NEW |
| 1 // Copyright (c) 2008, Google Inc. | 1 // Copyright (c) 2008, Google Inc. |
| 2 // All rights reserved. | 2 // All rights reserved. |
| 3 // | 3 // |
| 4 // Redistribution and use in source and binary forms, with or without | 4 // Redistribution and use in source and binary forms, with or without |
| 5 // modification, are permitted provided that the following conditions are | 5 // modification, are permitted provided that the following conditions are |
| 6 // met: | 6 // met: |
| 7 // | 7 // |
| 8 // * Redistributions of source code must retain the above copyright | 8 // * Redistributions of source code must retain the above copyright |
| 9 // notice, this list of conditions and the following disclaimer. | 9 // notice, this list of conditions and the following disclaimer. |
| 10 // * Redistributions in binary form must reproduce the above | 10 // * Redistributions in binary form must reproduce the above |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 NPVariant* result) { | 46 NPVariant* result) { |
| 47 VOID_TO_NPVARIANT(*result); | 47 VOID_TO_NPVARIANT(*result); |
| 48 | 48 |
| 49 // It is really the caller's responsibility to deal with the empty handle | 49 // It is really the caller's responsibility to deal with the empty handle |
| 50 // case because there could be different actions to take in different | 50 // case because there could be different actions to take in different |
| 51 // contexts. | 51 // contexts. |
| 52 ASSERT(!object.IsEmpty()); | 52 ASSERT(!object.IsEmpty()); |
| 53 | 53 |
| 54 if (object.IsEmpty()) return; | 54 if (object.IsEmpty()) return; |
| 55 | 55 |
| 56 if (object->IsNumber()) { | 56 if (object->IsInt32()) { |
| 57 INT32_TO_NPVARIANT(object->NumberValue(), *result); |
| 58 |
| 59 } else if (object->IsNumber()) { |
| 57 DOUBLE_TO_NPVARIANT(object->NumberValue(), *result); | 60 DOUBLE_TO_NPVARIANT(object->NumberValue(), *result); |
| 58 | 61 |
| 59 } else if (object->IsBoolean()) { | 62 } else if (object->IsBoolean()) { |
| 60 BOOLEAN_TO_NPVARIANT(object->BooleanValue(), *result); | 63 BOOLEAN_TO_NPVARIANT(object->BooleanValue(), *result); |
| 61 | 64 |
| 62 } else if (object->IsNull()) { | 65 } else if (object->IsNull()) { |
| 63 NULL_TO_NPVARIANT(*result); | 66 NULL_TO_NPVARIANT(*result); |
| 64 | 67 |
| 65 } else if (object->IsUndefined()) { | 68 } else if (object->IsUndefined()) { |
| 66 VOID_TO_NPVARIANT(*result); | 69 VOID_TO_NPVARIANT(*result); |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 // not when we use the heap. | 134 // not when we use the heap. |
| 132 char stack_buf[kStackBufSize]; | 135 char stack_buf[kStackBufSize]; |
| 133 str->WriteAscii(stack_buf); | 136 str->WriteAscii(stack_buf); |
| 134 return NPN_GetStringIdentifier(stack_buf); | 137 return NPN_GetStringIdentifier(stack_buf); |
| 135 } | 138 } |
| 136 | 139 |
| 137 scoped_array<char> heap_buf(new char[buf_len]); | 140 scoped_array<char> heap_buf(new char[buf_len]); |
| 138 str->WriteAscii(heap_buf.get()); | 141 str->WriteAscii(heap_buf.get()); |
| 139 return NPN_GetStringIdentifier(heap_buf.get()); | 142 return NPN_GetStringIdentifier(heap_buf.get()); |
| 140 } | 143 } |
| OLD | NEW |