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

Side by Side Diff: third_party/WebKit/Source/bindings/core/v8/NativeValueTraitsImpl.h

Issue 2801003005: bindings: Skip undefined property descriptors when creating records. (Closed)
Patch Set: Created 3 years, 8 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 | « third_party/WebKit/LayoutTests/bindings/record-type.html ('k') | 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 (c) 2017 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2017 The Chromium 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 #ifndef NativeValueTraitsImpl_h 5 #ifndef NativeValueTraitsImpl_h
6 #define NativeValueTraitsImpl_h 6 #define NativeValueTraitsImpl_h
7 7
8 #include "bindings/core/v8/IDLTypes.h" 8 #include "bindings/core/v8/IDLTypes.h"
9 #include "bindings/core/v8/NativeValueTraits.h" 9 #include "bindings/core/v8/NativeValueTraits.h"
10 #include "bindings/core/v8/V8Binding.h" 10 #include "bindings/core/v8/V8Binding.h"
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after
368 .ToLocal(&desc)) { 368 .ToLocal(&desc)) {
369 exceptionState.rethrowV8Exception(block.Exception()); 369 exceptionState.rethrowV8Exception(block.Exception());
370 return ImplType(); 370 return ImplType();
371 } 371 }
372 372
373 // "4.2. If desc is not undefined and desc.[[Enumerable]] is true:" 373 // "4.2. If desc is not undefined and desc.[[Enumerable]] is true:"
374 // We can call ToLocalChecked() and ToChecked() here because 374 // We can call ToLocalChecked() and ToChecked() here because
375 // GetOwnPropertyDescriptor is responsible for catching any exceptions 375 // GetOwnPropertyDescriptor is responsible for catching any exceptions
376 // and failures, and if we got to this point of the code we have a proper 376 // and failures, and if we got to this point of the code we have a proper
377 // object that was not created by a user. 377 // object that was not created by a user.
378 if (desc->IsUndefined())
379 continue;
378 DCHECK(desc->IsObject()); 380 DCHECK(desc->IsObject());
379 v8::Local<v8::Value> enumerable = 381 v8::Local<v8::Value> enumerable =
380 v8::Local<v8::Object>::Cast(desc) 382 v8::Local<v8::Object>::Cast(desc)
381 ->Get(context, v8String(isolate, "enumerable")) 383 ->Get(context, v8String(isolate, "enumerable"))
382 .ToLocalChecked(); 384 .ToLocalChecked();
383 if (!enumerable->BooleanValue(context).ToChecked()) 385 if (!enumerable->BooleanValue(context).ToChecked())
384 continue; 386 continue;
385 387
386 // "4.2.1. Let typedKey be key converted to an IDL value of type K." 388 // "4.2.1. Let typedKey be key converted to an IDL value of type K."
387 String typedKey = 389 String typedKey =
(...skipping 30 matching lines...) Expand all
418 } 420 }
419 } 421 }
420 // "5. Return result." 422 // "5. Return result."
421 return result; 423 return result;
422 } 424 }
423 }; 425 };
424 426
425 } // namespace blink 427 } // namespace blink
426 428
427 #endif // NativeValueTraitsImpl_h 429 #endif // NativeValueTraitsImpl_h
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/bindings/record-type.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698