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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 v8::Local<v8::Value> cache = object->GetInternalField(cacheIndex); | 56 v8::Local<v8::Value> cache = object->GetInternalField(cacheIndex); |
57 if (cache->IsNull() || cache->IsUndefined()) { | 57 if (cache->IsNull() || cache->IsUndefined()) { |
58 cache = v8::Array::New(); | 58 cache = v8::Array::New(); |
59 object->SetInternalField(cacheIndex, cache); | 59 object->SetInternalField(cacheIndex, cache); |
60 } | 60 } |
61 | 61 |
62 v8::Local<v8::Array> cacheArray = v8::Local<v8::Array>::Cast(cache); | 62 v8::Local<v8::Array> cacheArray = v8::Local<v8::Array>::Cast(cache); |
63 cacheArray->Set(v8::Integer::New(cacheArray->Length(), isolate), value); | 63 cacheArray->Set(v8::Integer::New(cacheArray->Length(), isolate), value); |
64 } | 64 } |
65 | 65 |
66 bool extractTransferables(v8::Local<v8::Value> value, MessagePortArray& ports, A
rrayBufferArray& arrayBuffers, v8::Isolate* isolate) | 66 bool extractTransferables(v8::Local<v8::Value> value, MessagePortArray& ports, A
rrayBufferArray& arrayBuffers, bool& notASequence, v8::Isolate* isolate) |
67 { | 67 { |
68 if (isUndefinedOrNull(value)) { | 68 if (isUndefinedOrNull(value)) { |
69 ports.resize(0); | 69 ports.resize(0); |
70 arrayBuffers.resize(0); | 70 arrayBuffers.resize(0); |
71 return true; | 71 return true; |
72 } | 72 } |
73 | 73 |
74 uint32_t length = 0; | 74 uint32_t length = 0; |
75 if (value->IsArray()) { | 75 if (value->IsArray()) { |
76 v8::Local<v8::Array> array = v8::Local<v8::Array>::Cast(value); | 76 v8::Local<v8::Array> array = v8::Local<v8::Array>::Cast(value); |
77 length = array->Length(); | 77 length = array->Length(); |
78 } else { | 78 } else { |
79 if (toV8Sequence(value, length, isolate).IsEmpty()) | 79 if (toV8Sequence(value, length, ¬ASequence, isolate).IsEmpty()) |
80 return false; | 80 return false; |
81 } | 81 } |
82 | 82 |
83 v8::Local<v8::Object> transferrables = v8::Local<v8::Object>::Cast(value); | 83 v8::Local<v8::Object> transferrables = v8::Local<v8::Object>::Cast(value); |
84 | 84 |
85 // Validate the passed array of transferrables. | 85 // Validate the passed array of transferrables. |
86 for (unsigned int i = 0; i < length; ++i) { | 86 for (unsigned int i = 0; i < length; ++i) { |
87 v8::Local<v8::Value> transferrable = transferrables->Get(i); | 87 v8::Local<v8::Value> transferrable = transferrables->Get(i); |
88 // Validation of non-null objects, per HTML5 spec 10.3.3. | 88 // Validation of non-null objects, per HTML5 spec 10.3.3. |
89 if (isUndefinedOrNull(transferrable)) { | 89 if (isUndefinedOrNull(transferrable)) { |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 | 155 |
156 ExecutionContext* getExecutionContext() | 156 ExecutionContext* getExecutionContext() |
157 { | 157 { |
158 if (WorkerScriptController* controller = WorkerScriptController::controllerF
orContext()) | 158 if (WorkerScriptController* controller = WorkerScriptController::controllerF
orContext()) |
159 return &controller->workerGlobalScope(); | 159 return &controller->workerGlobalScope(); |
160 | 160 |
161 return currentDocument(); | 161 return currentDocument(); |
162 } | 162 } |
163 | 163 |
164 } // namespace WebCore | 164 } // namespace WebCore |
OLD | NEW |