Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Side by Side Diff: src/objects.cc

Issue 2208683002: Fix a double-throw in JSReceiver::DefineProperties (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/objects.h" 5 #include "src/objects.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 #include <iomanip> 8 #include <iomanip>
9 #include <memory> 9 #include <memory>
10 #include <sstream> 10 #include <sstream>
(...skipping 6384 matching lines...) Expand 10 before | Expand all | Expand 10 after
6395 if (!object->IsJSReceiver()) { 6395 if (!object->IsJSReceiver()) {
6396 Handle<String> fun_name = 6396 Handle<String> fun_name =
6397 isolate->factory()->InternalizeUtf8String("Object.defineProperties"); 6397 isolate->factory()->InternalizeUtf8String("Object.defineProperties");
6398 THROW_NEW_ERROR(isolate, 6398 THROW_NEW_ERROR(isolate,
6399 NewTypeError(MessageTemplate::kCalledOnNonObject, fun_name), 6399 NewTypeError(MessageTemplate::kCalledOnNonObject, fun_name),
6400 Object); 6400 Object);
6401 } 6401 }
6402 // 2. Let props be ToObject(Properties). 6402 // 2. Let props be ToObject(Properties).
6403 // 3. ReturnIfAbrupt(props). 6403 // 3. ReturnIfAbrupt(props).
6404 Handle<JSReceiver> props; 6404 Handle<JSReceiver> props;
6405 if (!Object::ToObject(isolate, properties).ToHandle(&props)) { 6405 ASSIGN_RETURN_ON_EXCEPTION(isolate, props,
6406 THROW_NEW_ERROR(isolate, 6406 Object::ToObject(isolate, properties), Object);
6407 NewTypeError(MessageTemplate::kUndefinedOrNullToObject), 6407
6408 Object);
6409 }
6410 // 4. Let keys be props.[[OwnPropertyKeys]](). 6408 // 4. Let keys be props.[[OwnPropertyKeys]]().
6411 // 5. ReturnIfAbrupt(keys). 6409 // 5. ReturnIfAbrupt(keys).
6412 Handle<FixedArray> keys; 6410 Handle<FixedArray> keys;
6413 ASSIGN_RETURN_ON_EXCEPTION( 6411 ASSIGN_RETURN_ON_EXCEPTION(
6414 isolate, keys, KeyAccumulator::GetKeys(props, KeyCollectionMode::kOwnOnly, 6412 isolate, keys, KeyAccumulator::GetKeys(props, KeyCollectionMode::kOwnOnly,
6415 ALL_PROPERTIES), 6413 ALL_PROPERTIES),
6416 Object); 6414 Object);
6417 // 6. Let descriptors be an empty List. 6415 // 6. Let descriptors be an empty List.
6418 int capacity = keys->length(); 6416 int capacity = keys->length();
6419 std::vector<PropertyDescriptor> descriptors(capacity); 6417 std::vector<PropertyDescriptor> descriptors(capacity);
(...skipping 12765 matching lines...) Expand 10 before | Expand all | Expand 10 after
19185 for (PrototypeIterator iter(isolate, this, kStartAtReceiver, 19183 for (PrototypeIterator iter(isolate, this, kStartAtReceiver,
19186 PrototypeIterator::END_AT_NULL); 19184 PrototypeIterator::END_AT_NULL);
19187 !iter.IsAtEnd(); iter.AdvanceIgnoringProxies()) { 19185 !iter.IsAtEnd(); iter.AdvanceIgnoringProxies()) {
19188 if (iter.GetCurrent<Object>()->IsJSProxy()) return true; 19186 if (iter.GetCurrent<Object>()->IsJSProxy()) return true;
19189 } 19187 }
19190 return false; 19188 return false;
19191 } 19189 }
19192 19190
19193 } // namespace internal 19191 } // namespace internal
19194 } // namespace v8 19192 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698