OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 Google Inc. 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 2992 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3003 if (isUndefinedOrNull(value)) { | 3003 if (isUndefinedOrNull(value)) { |
3004 ports.resize(0); | 3004 ports.resize(0); |
3005 arrayBuffers.resize(0); | 3005 arrayBuffers.resize(0); |
3006 return true; | 3006 return true; |
3007 } | 3007 } |
3008 | 3008 |
3009 uint32_t length = 0; | 3009 uint32_t length = 0; |
3010 if (value->IsArray()) { | 3010 if (value->IsArray()) { |
3011 v8::Local<v8::Array> array = v8::Local<v8::Array>::Cast(value); | 3011 v8::Local<v8::Array> array = v8::Local<v8::Array>::Cast(value); |
3012 length = array->Length(); | 3012 length = array->Length(); |
3013 } else if (toV8Sequence(value, length, isolate).IsEmpty()) { | 3013 } else if (!toV8Sequence(value, length, isolate, exceptionState)) { |
3014 exceptionState.throwTypeError(ExceptionMessages::notAnArrayTypeArgumentO
rValue(argumentIndex + 1)); | 3014 if (!exceptionState.hadException()) |
| 3015 exceptionState.throwTypeError(ExceptionMessages::notAnArrayTypeArgum
entOrValue(argumentIndex + 1)); |
3015 return false; | 3016 return false; |
3016 } | 3017 } |
3017 | 3018 |
3018 v8::Local<v8::Object> transferrables = v8::Local<v8::Object>::Cast(value); | 3019 v8::Local<v8::Object> transferrables = v8::Local<v8::Object>::Cast(value); |
3019 | 3020 |
3020 // Validate the passed array of transferrables. | 3021 // Validate the passed array of transferrables. |
3021 for (unsigned i = 0; i < length; ++i) { | 3022 for (unsigned i = 0; i < length; ++i) { |
3022 v8::Local<v8::Value> transferrable = transferrables->Get(i); | 3023 v8::Local<v8::Value> transferrable = transferrables->Get(i); |
3023 // Validation of non-null objects, per HTML5 spec 10.3.3. | 3024 // Validation of non-null objects, per HTML5 spec 10.3.3. |
3024 if (isUndefinedOrNull(transferrable)) { | 3025 if (isUndefinedOrNull(transferrable)) { |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3062 // If the allocated memory was not registered before, then this class is lik
ely | 3063 // If the allocated memory was not registered before, then this class is lik
ely |
3063 // used in a context other then Worker's onmessage environment and the prese
nce of | 3064 // used in a context other then Worker's onmessage environment and the prese
nce of |
3064 // current v8 context is not guaranteed. Avoid calling v8 then. | 3065 // current v8 context is not guaranteed. Avoid calling v8 then. |
3065 if (m_externallyAllocatedMemory) { | 3066 if (m_externallyAllocatedMemory) { |
3066 ASSERT(v8::Isolate::GetCurrent()); | 3067 ASSERT(v8::Isolate::GetCurrent()); |
3067 v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory(-m_exte
rnallyAllocatedMemory); | 3068 v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory(-m_exte
rnallyAllocatedMemory); |
3068 } | 3069 } |
3069 } | 3070 } |
3070 | 3071 |
3071 } // namespace blink | 3072 } // namespace blink |
OLD | NEW |