| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2008, 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2008, 2009 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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 | 85 |
| 86 // Validate the passed array of transferrables. | 86 // Validate the passed array of transferrables. |
| 87 for (unsigned int i = 0; i < length; ++i) { | 87 for (unsigned int i = 0; i < length; ++i) { |
| 88 v8::Local<v8::Value> transferrable = transferrables->Get(i); | 88 v8::Local<v8::Value> transferrable = transferrables->Get(i); |
| 89 // Validation of non-null objects, per HTML5 spec 10.3.3. | 89 // Validation of non-null objects, per HTML5 spec 10.3.3. |
| 90 if (isUndefinedOrNull(transferrable)) { | 90 if (isUndefinedOrNull(transferrable)) { |
| 91 exceptionState.throwDOMException(DataCloneError, "Value at index " +
String::number(i) + " is an untransferable " + (transferrable->IsUndefined() ?
"'undefined'" : "'null'") + " value."); | 91 exceptionState.throwDOMException(DataCloneError, "Value at index " +
String::number(i) + " is an untransferable " + (transferrable->IsUndefined() ?
"'undefined'" : "'null'") + " value."); |
| 92 return false; | 92 return false; |
| 93 } | 93 } |
| 94 // Validation of Objects implementing an interface, per WebIDL spec 4.1.
15. | 94 // Validation of Objects implementing an interface, per WebIDL spec 4.1.
15. |
| 95 if (V8MessagePort::hasInstance(transferrable, isolate, worldType(isolate
))) { | 95 if (V8MessagePort::hasInstance(transferrable, isolate)) { |
| 96 RefPtr<MessagePort> port = V8MessagePort::toNative(v8::Handle<v8::Ob
ject>::Cast(transferrable)); | 96 RefPtr<MessagePort> port = V8MessagePort::toNative(v8::Handle<v8::Ob
ject>::Cast(transferrable)); |
| 97 // Check for duplicate MessagePorts. | 97 // Check for duplicate MessagePorts. |
| 98 if (ports.contains(port)) { | 98 if (ports.contains(port)) { |
| 99 exceptionState.throwDOMException(DataCloneError, "Message port a
t index " + String::number(i) + " is a duplicate of an earlier port."); | 99 exceptionState.throwDOMException(DataCloneError, "Message port a
t index " + String::number(i) + " is a duplicate of an earlier port."); |
| 100 return false; | 100 return false; |
| 101 } | 101 } |
| 102 ports.append(port.release()); | 102 ports.append(port.release()); |
| 103 } else if (V8ArrayBuffer::hasInstance(transferrable, isolate, worldType(
isolate))) { | 103 } else if (V8ArrayBuffer::hasInstance(transferrable, isolate)) { |
| 104 RefPtr<ArrayBuffer> arrayBuffer = V8ArrayBuffer::toNative(v8::Handle
<v8::Object>::Cast(transferrable)); | 104 RefPtr<ArrayBuffer> arrayBuffer = V8ArrayBuffer::toNative(v8::Handle
<v8::Object>::Cast(transferrable)); |
| 105 if (arrayBuffers.contains(arrayBuffer)) { | 105 if (arrayBuffers.contains(arrayBuffer)) { |
| 106 exceptionState.throwDOMException(DataCloneError, "ArrayBuffer at
index " + String::number(i) + " is a duplicate of an earlier ArrayBuffer."); | 106 exceptionState.throwDOMException(DataCloneError, "ArrayBuffer at
index " + String::number(i) + " is a duplicate of an earlier ArrayBuffer."); |
| 107 return false; | 107 return false; |
| 108 } | 108 } |
| 109 arrayBuffers.append(arrayBuffer.release()); | 109 arrayBuffers.append(arrayBuffer.release()); |
| 110 } else { | 110 } else { |
| 111 exceptionState.throwDOMException(DataCloneError, "Value at index " +
String::number(i) + " does not have a transferable type."); | 111 exceptionState.throwDOMException(DataCloneError, "Value at index " +
String::number(i) + " does not have a transferable type."); |
| 112 return false; | 112 return false; |
| 113 } | 113 } |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 { | 187 { |
| 188 v8::Handle<v8::Value> boundFunction = function->GetBoundFunction(); | 188 v8::Handle<v8::Value> boundFunction = function->GetBoundFunction(); |
| 189 if (boundFunction->IsFunction()) { | 189 if (boundFunction->IsFunction()) { |
| 190 return v8::Handle<v8::Function>::Cast(boundFunction); | 190 return v8::Handle<v8::Function>::Cast(boundFunction); |
| 191 } else { | 191 } else { |
| 192 return function; | 192 return function; |
| 193 } | 193 } |
| 194 } | 194 } |
| 195 | 195 |
| 196 } // namespace WebCore | 196 } // namespace WebCore |
| OLD | NEW |