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 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 } | 114 } |
115 return true; | 115 return true; |
116 } | 116 } |
117 | 117 |
118 bool getMessagePortArray(v8::Local<v8::Value> value, const String& propertyName,
MessagePortArray& ports, v8::Isolate* isolate) | 118 bool getMessagePortArray(v8::Local<v8::Value> value, const String& propertyName,
MessagePortArray& ports, v8::Isolate* isolate) |
119 { | 119 { |
120 if (isUndefinedOrNull(value)) { | 120 if (isUndefinedOrNull(value)) { |
121 ports.resize(0); | 121 ports.resize(0); |
122 return true; | 122 return true; |
123 } | 123 } |
124 if (!value->IsArray()) { | |
125 throwTypeError(ExceptionMessages::notASequenceTypeProperty(propertyName)
, isolate); | |
126 return false; | |
127 } | |
128 bool success = false; | 124 bool success = false; |
129 ports = toRefPtrNativeArray<MessagePort, V8MessagePort>(value, propertyName,
isolate, &success); | 125 ports = toRefPtrNativeArray<MessagePort, V8MessagePort>(value, propertyName,
isolate, &success); |
130 return success; | 126 return success; |
131 } | 127 } |
132 | 128 |
133 bool getMessagePortArray(v8::Local<v8::Value> value, int argumentIndex, MessageP
ortArray& ports, v8::Isolate* isolate) | 129 bool getMessagePortArray(v8::Local<v8::Value> value, int argumentIndex, MessageP
ortArray& ports, v8::Isolate* isolate) |
134 { | 130 { |
135 if (isUndefinedOrNull(value)) { | 131 if (isUndefinedOrNull(value)) { |
136 ports.resize(0); | 132 ports.resize(0); |
137 return true; | 133 return true; |
138 } | 134 } |
139 if (!value->IsArray()) { | |
140 throwTypeError(ExceptionMessages::notAnArrayTypeArgumentOrValue(argument
Index), isolate); | |
141 return false; | |
142 } | |
143 bool success = false; | 135 bool success = false; |
144 ports = toRefPtrNativeArray<MessagePort, V8MessagePort>(value, argumentIndex
, isolate, &success); | 136 ports = toRefPtrNativeArray<MessagePort, V8MessagePort>(value, argumentIndex
, isolate, &success); |
145 return success; | 137 return success; |
146 } | 138 } |
147 | 139 |
148 void removeHiddenDependency(v8::Handle<v8::Object> object, v8::Local<v8::Value>
value, int cacheIndex, v8::Isolate* isolate) | 140 void removeHiddenDependency(v8::Handle<v8::Object> object, v8::Local<v8::Value>
value, int cacheIndex, v8::Isolate* isolate) |
149 { | 141 { |
150 v8::Local<v8::Value> cache = object->GetInternalField(cacheIndex); | 142 v8::Local<v8::Value> cache = object->GetInternalField(cacheIndex); |
151 if (!cache->IsArray()) | 143 if (!cache->IsArray()) |
152 return; | 144 return; |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 { | 179 { |
188 v8::Handle<v8::Value> boundFunction = function->GetBoundFunction(); | 180 v8::Handle<v8::Value> boundFunction = function->GetBoundFunction(); |
189 if (boundFunction->IsFunction()) { | 181 if (boundFunction->IsFunction()) { |
190 return v8::Handle<v8::Function>::Cast(boundFunction); | 182 return v8::Handle<v8::Function>::Cast(boundFunction); |
191 } else { | 183 } else { |
192 return function; | 184 return function; |
193 } | 185 } |
194 } | 186 } |
195 | 187 |
196 } // namespace WebCore | 188 } // namespace WebCore |
OLD | NEW |