| 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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 return false; | 78 return false; |
| 79 } | 79 } |
| 80 | 80 |
| 81 v8::Local<v8::Object> transferrables = v8::Local<v8::Object>::Cast(value); | 81 v8::Local<v8::Object> transferrables = v8::Local<v8::Object>::Cast(value); |
| 82 | 82 |
| 83 // Validate the passed array of transferrables. | 83 // Validate the passed array of transferrables. |
| 84 for (unsigned int i = 0; i < length; ++i) { | 84 for (unsigned int i = 0; i < length; ++i) { |
| 85 v8::Local<v8::Value> transferrable = transferrables->Get(i); | 85 v8::Local<v8::Value> transferrable = transferrables->Get(i); |
| 86 // Validation of non-null objects, per HTML5 spec 10.3.3. | 86 // Validation of non-null objects, per HTML5 spec 10.3.3. |
| 87 if (isUndefinedOrNull(transferrable)) { | 87 if (isUndefinedOrNull(transferrable)) { |
| 88 setDOMException(INVALID_STATE_ERR, isolate); | 88 setDOMException(InvalidStateError, isolate); |
| 89 return false; | 89 return false; |
| 90 } | 90 } |
| 91 // Validation of Objects implementing an interface, per WebIDL spec 4.1.
15. | 91 // Validation of Objects implementing an interface, per WebIDL spec 4.1.
15. |
| 92 if (V8MessagePort::HasInstance(transferrable, isolate, worldType(isolate
))) { | 92 if (V8MessagePort::HasInstance(transferrable, isolate, worldType(isolate
))) { |
| 93 RefPtr<MessagePort> port = V8MessagePort::toNative(v8::Handle<v8::Ob
ject>::Cast(transferrable)); | 93 RefPtr<MessagePort> port = V8MessagePort::toNative(v8::Handle<v8::Ob
ject>::Cast(transferrable)); |
| 94 // Check for duplicate MessagePorts. | 94 // Check for duplicate MessagePorts. |
| 95 if (ports.contains(port)) { | 95 if (ports.contains(port)) { |
| 96 setDOMException(INVALID_STATE_ERR, isolate); | 96 setDOMException(InvalidStateError, isolate); |
| 97 return false; | 97 return false; |
| 98 } | 98 } |
| 99 ports.append(port.release()); | 99 ports.append(port.release()); |
| 100 } else if (V8ArrayBuffer::HasInstance(transferrable, isolate, worldType(
isolate))) | 100 } else if (V8ArrayBuffer::HasInstance(transferrable, isolate, worldType(
isolate))) |
| 101 arrayBuffers.append(V8ArrayBuffer::toNative(v8::Handle<v8::Object>::
Cast(transferrable))); | 101 arrayBuffers.append(V8ArrayBuffer::toNative(v8::Handle<v8::Object>::
Cast(transferrable))); |
| 102 else { | 102 else { |
| 103 throwTypeError(0, isolate); | 103 throwTypeError(0, isolate); |
| 104 return false; | 104 return false; |
| 105 } | 105 } |
| 106 } | 106 } |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 | 151 |
| 152 ScriptExecutionContext* getScriptExecutionContext() | 152 ScriptExecutionContext* getScriptExecutionContext() |
| 153 { | 153 { |
| 154 if (WorkerScriptController* controller = WorkerScriptController::controllerF
orContext()) | 154 if (WorkerScriptController* controller = WorkerScriptController::controllerF
orContext()) |
| 155 return controller->workerGlobalScope(); | 155 return controller->workerGlobalScope(); |
| 156 | 156 |
| 157 return currentDocument(); | 157 return currentDocument(); |
| 158 } | 158 } |
| 159 | 159 |
| 160 } // namespace WebCore | 160 } // namespace WebCore |
| OLD | NEW |