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

Side by Side Diff: src/v8natives.js

Issue 6677017: Fix a problem where Object.getOwnPropertyDescriptor and related functions uni... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 9 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-1233.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after
488 488
489 PropertyDescriptor.prototype.hasSetter = function() { 489 PropertyDescriptor.prototype.hasSetter = function() {
490 return this.hasSetter_; 490 return this.hasSetter_;
491 } 491 }
492 492
493 493
494 // Converts an array returned from Runtime_GetOwnProperty to an actual 494 // Converts an array returned from Runtime_GetOwnProperty to an actual
495 // property descriptor. For a description of the array layout please 495 // property descriptor. For a description of the array layout please
496 // see the runtime.cc file. 496 // see the runtime.cc file.
497 function ConvertDescriptorArrayToDescriptor(desc_array) { 497 function ConvertDescriptorArrayToDescriptor(desc_array) {
498 if (desc_array == false) { 498 if (desc_array === false) {
499 throw 'Internal error: invalid desc_array'; 499 throw 'Internal error: invalid desc_array';
500 } 500 }
501 501
502 if (IS_UNDEFINED(desc_array)) { 502 if (IS_UNDEFINED(desc_array)) {
503 return void 0; 503 return void 0;
504 } 504 }
505 505
506 var desc = new PropertyDescriptor(); 506 var desc = new PropertyDescriptor();
507 // This is an accessor. 507 // This is an accessor.
508 if (desc_array[IS_ACCESSOR_INDEX]) { 508 if (desc_array[IS_ACCESSOR_INDEX]) {
(...skipping 28 matching lines...) Expand all
537 537
538 538
539 // ES5 section 8.12.1. 539 // ES5 section 8.12.1.
540 function GetOwnProperty(obj, p) { 540 function GetOwnProperty(obj, p) {
541 // GetOwnProperty returns an array indexed by the constants 541 // GetOwnProperty returns an array indexed by the constants
542 // defined in macros.py. 542 // defined in macros.py.
543 // If p is not a property on obj undefined is returned. 543 // If p is not a property on obj undefined is returned.
544 var props = %GetOwnProperty(ToObject(obj), ToString(p)); 544 var props = %GetOwnProperty(ToObject(obj), ToString(p));
545 545
546 // A false value here means that access checks failed. 546 // A false value here means that access checks failed.
547 if (props == false) return void 0; 547 if (props === false) return void 0;
548 548
549 return ConvertDescriptorArrayToDescriptor(props); 549 return ConvertDescriptorArrayToDescriptor(props);
550 } 550 }
551 551
552 552
553 // ES5 8.12.9. 553 // ES5 8.12.9.
554 function DefineOwnProperty(obj, p, desc, should_throw) { 554 function DefineOwnProperty(obj, p, desc, should_throw) {
555 var current_or_access = %GetOwnProperty(ToObject(obj), ToString(p)); 555 var current_or_access = %GetOwnProperty(ToObject(obj), ToString(p));
556 // A false value here means that access checks failed. 556 // A false value here means that access checks failed.
557 if (current_or_access == false) return void 0; 557 if (current_or_access === false) return void 0;
558 558
559 var current = ConvertDescriptorArrayToDescriptor(current_or_access); 559 var current = ConvertDescriptorArrayToDescriptor(current_or_access);
560 var extensible = %IsExtensible(ToObject(obj)); 560 var extensible = %IsExtensible(ToObject(obj));
561 561
562 // Error handling according to spec. 562 // Error handling according to spec.
563 // Step 3 563 // Step 3
564 if (IS_UNDEFINED(current) && !extensible) 564 if (IS_UNDEFINED(current) && !extensible)
565 throw MakeTypeError("define_disallowed", ["defineProperty"]); 565 throw MakeTypeError("define_disallowed", ["defineProperty"]);
566 566
567 if (!IS_UNDEFINED(current)) { 567 if (!IS_UNDEFINED(current)) {
(...skipping 675 matching lines...) Expand 10 before | Expand all | Expand 10 after
1243 // ---------------------------------------------------------------------------- 1243 // ----------------------------------------------------------------------------
1244 1244
1245 function SetupFunction() { 1245 function SetupFunction() {
1246 InstallFunctions($Function.prototype, DONT_ENUM, $Array( 1246 InstallFunctions($Function.prototype, DONT_ENUM, $Array(
1247 "bind", FunctionBind, 1247 "bind", FunctionBind,
1248 "toString", FunctionToString 1248 "toString", FunctionToString
1249 )); 1249 ));
1250 } 1250 }
1251 1251
1252 SetupFunction(); 1252 SetupFunction();
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-1233.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698