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 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 } else if (!toV8Sequence(value, length, isolate, exceptionState)) { | 173 } else if (!toV8Sequence(value, length, isolate, exceptionState)) { |
174 if (!exceptionState.hadException()) | 174 if (!exceptionState.hadException()) |
175 exceptionState.throwTypeError(ExceptionMessages::notAnArrayTypeArgum
entOrValue(argumentIndex + 1)); | 175 exceptionState.throwTypeError(ExceptionMessages::notAnArrayTypeArgum
entOrValue(argumentIndex + 1)); |
176 return false; | 176 return false; |
177 } | 177 } |
178 | 178 |
179 v8::Local<v8::Object> transferrables = v8::Local<v8::Object>::Cast(value); | 179 v8::Local<v8::Object> transferrables = v8::Local<v8::Object>::Cast(value); |
180 | 180 |
181 // Validate the passed array of transferrables. | 181 // Validate the passed array of transferrables. |
182 for (unsigned i = 0; i < length; ++i) { | 182 for (unsigned i = 0; i < length; ++i) { |
183 v8::Local<v8::Value> transferrable = transferrables->Get(i); | 183 v8::Local<v8::Value> transferrable; |
| 184 if (!transferrables->Get(isolate->GetCurrentContext(), i).ToLocal(&trans
ferrable)) |
| 185 return false; |
184 // Validation of non-null objects, per HTML5 spec 10.3.3. | 186 // Validation of non-null objects, per HTML5 spec 10.3.3. |
185 if (isUndefinedOrNull(transferrable)) { | 187 if (isUndefinedOrNull(transferrable)) { |
186 exceptionState.throwTypeError("Value at index " + String::number(i)
+ " is an untransferable " + (transferrable->IsUndefined() ? "'undefined'" : "'n
ull'") + " value."); | 188 exceptionState.throwTypeError("Value at index " + String::number(i)
+ " is an untransferable " + (transferrable->IsUndefined() ? "'undefined'" : "'n
ull'") + " value."); |
187 return false; | 189 return false; |
188 } | 190 } |
189 // Validation of Objects implementing an interface, per WebIDL spec 4.1.
15. | 191 // Validation of Objects implementing an interface, per WebIDL spec 4.1.
15. |
190 if (V8MessagePort::hasInstance(transferrable, isolate)) { | 192 if (V8MessagePort::hasInstance(transferrable, isolate)) { |
191 RefPtrWillBeRawPtr<MessagePort> port = V8MessagePort::toImpl(v8::Han
dle<v8::Object>::Cast(transferrable)); | 193 RefPtrWillBeRawPtr<MessagePort> port = V8MessagePort::toImpl(v8::Han
dle<v8::Object>::Cast(transferrable)); |
192 // Check for duplicate MessagePorts. | 194 // Check for duplicate MessagePorts. |
193 if (ports.contains(port)) { | 195 if (ports.contains(port)) { |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory(-m_exte
rnallyAllocatedMemory); | 230 v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory(-m_exte
rnallyAllocatedMemory); |
229 } | 231 } |
230 } | 232 } |
231 | 233 |
232 void SerializedScriptValue::transferArrayBuffers(v8::Isolate* isolate, ArrayBuff
erArray& arrayBuffers, ExceptionState& exceptionState) | 234 void SerializedScriptValue::transferArrayBuffers(v8::Isolate* isolate, ArrayBuff
erArray& arrayBuffers, ExceptionState& exceptionState) |
233 { | 235 { |
234 m_arrayBufferContentsArray = createArrayBuffers(isolate, arrayBuffers, excep
tionState); | 236 m_arrayBufferContentsArray = createArrayBuffers(isolate, arrayBuffers, excep
tionState); |
235 } | 237 } |
236 | 238 |
237 } // namespace blink | 239 } // namespace blink |
OLD | NEW |