Changeset 107544 in webkit
- Timestamp:
- Feb 13, 2012 1:28:44 AM (12 years ago)
- Location:
- trunk
- Files:
-
- 29 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r107543 r107544 1 2012-02-13 Gavin Barraclough <barraclough@apple.com> 2 3 https://bugs.webkit.org/show_bug.cgi?id=78434 4 Unreviewed - temporarily reverting r107498 will I fix a couple of testcases. 5 6 * fast/js/Object-getOwnPropertyNames-expected.txt: 7 * fast/js/cyclic-prototypes-expected.txt: 8 * fast/js/parser-syntax-check-expected.txt: 9 * fast/js/preventExtensions-expected.txt: 10 * fast/js/prototypes-expected.txt: 11 * fast/js/script-tests/Object-getOwnPropertyNames.js: 12 * fast/js/script-tests/cyclic-prototypes.js: 13 * fast/js/script-tests/parser-syntax-check.js: 14 * fast/js/script-tests/preventExtensions.js: 15 * fast/js/script-tests/prototypes.js: 16 1 17 2012-02-13 Pavel Podivilov <podivilov@chromium.org> 2 18 -
trunk/LayoutTests/fast/js/Object-getOwnPropertyNames-expected.txt
r107498 r107544 42 42 PASS getSortedOwnPropertyNames(encodeURIComponent) is ['length', 'name'] 43 43 PASS getSortedOwnPropertyNames(Object) is ['create', 'defineProperties', 'defineProperty', 'freeze', 'getOwnPropertyDescriptor', 'getOwnPropertyNames', 'getPrototypeOf', 'isExtensible', 'isFrozen', 'isSealed', 'keys', 'length', 'name', 'preventExtensions', 'prototype', 'seal'] 44 PASS getSortedOwnPropertyNames(Object.prototype) is ['__defineGetter__', '__defineSetter__', '__lookupGetter__', '__lookupSetter__', ' __proto__', 'constructor', 'hasOwnProperty', 'isPrototypeOf', 'propertyIsEnumerable', 'toLocaleString', 'toString', 'valueOf']44 PASS getSortedOwnPropertyNames(Object.prototype) is ['__defineGetter__', '__defineSetter__', '__lookupGetter__', '__lookupSetter__', 'constructor', 'hasOwnProperty', 'isPrototypeOf', 'propertyIsEnumerable', 'toLocaleString', 'toString', 'valueOf'] 45 45 PASS getSortedOwnPropertyNames(Function) is ['length', 'name', 'prototype'] 46 46 PASS getSortedOwnPropertyNames(Function.prototype) is ['apply', 'bind', 'call', 'constructor', 'length', 'name', 'toString'] -
trunk/LayoutTests/fast/js/cyclic-prototypes-expected.txt
r107498 r107544 4 4 5 5 6 PASS o1.__proto__ = o3; threw exception Error: cyclic __proto__ value. 7 PASS ({}).hasOwnProperty.call(o1, '__proto__') is false 8 PASS ({}).hasOwnProperty.call(o1, '__proto__') is true 9 PASS Object.getPrototypeOf(o1) is null 6 PASS o1.__proto__ = o3 threw exception Error: cyclic __proto__ value. 10 7 PASS successfullyParsed is true 11 8 -
trunk/LayoutTests/fast/js/parser-syntax-check-expected.txt
r107498 r107544 542 542 PASS Invalid: "for(var a,b '" 543 543 PASS Invalid: "function f() { for(var a,b ' }" 544 PASS Valid:"function __proto__(){}"545 PASS Valid:"function f() { function __proto__(){} }"546 PASS Valid:"(function __proto__(){})"547 PASS Valid:"function f() { (function __proto__(){}) }"548 PASS Valid:"'use strict'; function __proto__(){}"549 PASS Valid:"function f() { 'use strict'; function __proto__(){} }"550 PASS Valid:"'use strict'; (function __proto__(){})"551 PASS Valid:"function f() { 'use strict'; (function __proto__(){}) }"544 PASS Invalid: "function __proto__(){}" 545 PASS Invalid: "function f() { function __proto__(){} }" 546 PASS Invalid: "(function __proto__(){})" 547 PASS Invalid: "function f() { (function __proto__(){}) }" 548 PASS Invalid: "'use strict'; function __proto__(){}" 549 PASS Invalid: "function f() { 'use strict'; function __proto__(){} }" 550 PASS Invalid: "'use strict'; (function __proto__(){})" 551 PASS Invalid: "function f() { 'use strict'; (function __proto__(){}) }" 552 552 PASS Valid: "if (0) $foo; " 553 553 PASS Valid: "function f() { if (0) $foo; }" -
trunk/LayoutTests/fast/js/preventExtensions-expected.txt
r107498 r107544 13 13 PASS Object.preventExtensions(Math.sin) is Math.sin 14 14 PASS var o = {}; Object.preventExtensions(o); o.__proto__ = { newProp: "Should not see this" }; o.newProp; is undefined. 15 PASS "use strict"; var o = {}; Object.preventExtensions(o); o.__proto__ = { newProp: "Should not see this" }; o.newProp; is undefined.15 PASS "use strict"; var o = {}; Object.preventExtensions(o); o.__proto__ = { newProp: "Should not see this" }; threw exception TypeError: Attempted to assign to readonly property.. 16 16 PASS Object.preventExtensions(Math); Math.sqrt(4) is 2 17 17 PASS successfullyParsed is true -
trunk/LayoutTests/fast/js/prototypes-expected.txt
r107498 r107544 54 54 PASS Object.__proto__.isPrototypeOf(Number) is true 55 55 PASS Object.__proto__.isPrototypeOf(String) is true 56 PASS var wasSet = false; var o = { }; o.__defineGetter__("__proto__", function() { wasSet = true }); o.__proto__; wasSet; is true57 PASS var wasSet = false; var o = { }; o.__defineSetter__("__proto__", function() { wasSet = true }); o.__proto__ = {}; wasSet; is true58 PASS var wasSet = false; var o = { }; Object.defineProperty(o, "__proto__", { "get": function() { wasSet = true } }); o.__proto__; wasSet; is true56 PASS var wasSet = false; var o = { }; o.__defineGetter__("__proto__", function() { wasSet = true }); o.__proto__; wasSet; is false 57 PASS var wasSet = false; var o = { }; o.__defineSetter__("__proto__", function() { wasSet = true }); o.__proto__ = {}; wasSet; is false 58 PASS var wasSet = false; var o = { }; Object.defineProperty(o, "__proto__", { "get": function() { wasSet = true } }); o.__proto__; wasSet; is false 59 59 PASS var wasSet = false; var o = { }; Object.defineProperty(o, "__proto__", { "__proto__": function(x) { wasSet = true } }); o.__proto__ = {}; wasSet; is false 60 PASS var o = {}; o.__proto__ = { x:true }; o.x is true61 PASS var o = {}; o.__proto__ = { x:true }; o.hasOwnProperty('__proto__') is false62 PASS var o = {}; o.__proto__ = { x:true }; o.x is undefined.63 PASS var o = {}; o.__proto__ = { x:true }; o.hasOwnProperty('__proto__') is true64 60 PASS successfullyParsed is true 65 61 -
trunk/LayoutTests/fast/js/script-tests/Object-getOwnPropertyNames.js
r107498 r107544 50 50 // Built-in ECMA objects 51 51 "Object": "['create', 'defineProperties', 'defineProperty', 'freeze', 'getOwnPropertyDescriptor', 'getOwnPropertyNames', 'getPrototypeOf', 'isExtensible', 'isFrozen', 'isSealed', 'keys', 'length', 'name', 'preventExtensions', 'prototype', 'seal']", 52 "Object.prototype": "['__defineGetter__', '__defineSetter__', '__lookupGetter__', '__lookupSetter__', ' __proto__', 'constructor', 'hasOwnProperty', 'isPrototypeOf', 'propertyIsEnumerable', 'toLocaleString', 'toString', 'valueOf']",52 "Object.prototype": "['__defineGetter__', '__defineSetter__', '__lookupGetter__', '__lookupSetter__', 'constructor', 'hasOwnProperty', 'isPrototypeOf', 'propertyIsEnumerable', 'toLocaleString', 'toString', 'valueOf']", 53 53 "Function": "['length', 'name', 'prototype']", 54 54 "Function.prototype": "['apply', 'bind', 'call', 'constructor', 'length', 'name', 'toString']", -
trunk/LayoutTests/fast/js/script-tests/cyclic-prototypes.js
r107498 r107544 7 7 o3.__proto__ = o2; 8 8 9 // Try to create a cyclical prototype chain. 10 shouldThrow("o1.__proto__ = o3;"); 9 o1.__proto__ = null; // just for sanity's sake 11 10 12 // This changes behaviour, since __proto__ is an accessor on Object.prototype. 13 o1.__proto__ = null; 14 15 shouldBeFalse("({}).hasOwnProperty.call(o1, '__proto__')"); 16 o1.__proto__ = o3; 17 shouldBeTrue("({}).hasOwnProperty.call(o1, '__proto__')"); 18 shouldBe("Object.getPrototypeOf(o1)", "null"); 11 shouldThrow("o1.__proto__ = o3"); -
trunk/LayoutTests/fast/js/script-tests/parser-syntax-check.js
r107498 r107544 348 348 invalid("for(var a,b '"); 349 349 350 valid("function __proto__(){}")351 valid("(function __proto__(){})")352 valid("'use strict'; function __proto__(){}")353 valid("'use strict'; (function __proto__(){})")350 invalid("function __proto__(){}") 351 invalid("(function __proto__(){})") 352 invalid("'use strict'; function __proto__(){}") 353 invalid("'use strict'; (function __proto__(){})") 354 354 355 355 valid("if (0) $foo; ") -
trunk/LayoutTests/fast/js/script-tests/preventExtensions.js
r107498 r107544 70 70 71 71 shouldBeUndefined('var o = {}; Object.preventExtensions(o); o.__proto__ = { newProp: "Should not see this" }; o.newProp;'); 72 should BeUndefined('"use strict"; var o = {}; Object.preventExtensions(o); o.__proto__ = { newProp: "Should not see this" }; o.newProp;');72 shouldThrow('"use strict"; var o = {}; Object.preventExtensions(o); o.__proto__ = { newProp: "Should not see this" };'); 73 73 74 74 // check that we can still access static properties on an object after calling preventExtensions. -
trunk/LayoutTests/fast/js/script-tests/prototypes.js
r107498 r107544 56 56 shouldBeTrue("Object.__proto__.isPrototypeOf(String)"); 57 57 58 shouldBe True("var wasSet = false; var o = { }; o.__defineGetter__(\"__proto__\", function() { wasSet = true }); o.__proto__; wasSet;");59 shouldBe True("var wasSet = false; var o = { }; o.__defineSetter__(\"__proto__\", function() { wasSet = true }); o.__proto__ = {}; wasSet;");60 shouldBe True("var wasSet = false; var o = { }; Object.defineProperty(o, \"__proto__\", { \"get\": function() { wasSet = true } }); o.__proto__; wasSet;");58 shouldBeFalse("var wasSet = false; var o = { }; o.__defineGetter__(\"__proto__\", function() { wasSet = true }); o.__proto__; wasSet;"); 59 shouldBeFalse("var wasSet = false; var o = { }; o.__defineSetter__(\"__proto__\", function() { wasSet = true }); o.__proto__ = {}; wasSet;"); 60 shouldBeFalse("var wasSet = false; var o = { }; Object.defineProperty(o, \"__proto__\", { \"get\": function() { wasSet = true } }); o.__proto__; wasSet;"); 61 61 shouldBeFalse("var wasSet = false; var o = { }; Object.defineProperty(o, \"__proto__\", { \"__proto__\": function(x) { wasSet = true } }); o.__proto__ = {}; wasSet;"); 62 63 // Deleting Object.prototype.__proto__ removes the ability to set the object's prototype.64 shouldBeTrue("var o = {}; o.__proto__ = { x:true }; o.x");65 shouldBeFalse("var o = {}; o.__proto__ = { x:true }; o.hasOwnProperty('__proto__')");66 delete Object.prototype.__proto__;67 shouldBeUndefined("var o = {}; o.__proto__ = { x:true }; o.x");68 shouldBeTrue("var o = {}; o.__proto__ = { x:true }; o.hasOwnProperty('__proto__')"); -
trunk/Source/JavaScriptCore/ChangeLog
r107527 r107544 1 2012-02-13 Gavin Barraclough <barraclough@apple.com> 2 3 https://bugs.webkit.org/show_bug.cgi?id=78434 4 Unreviewed - temporarily reverting r107498 will I fix a couple of testcases. 5 6 * parser/Parser.cpp: 7 (JSC::::parseFunctionInfo): 8 * runtime/ClassInfo.h: 9 (MethodTable): 10 (JSC): 11 * runtime/JSCell.cpp: 12 (JSC): 13 * runtime/JSCell.h: 14 (JSCell): 15 * runtime/JSGlobalObject.cpp: 16 (JSC::JSGlobalObject::reset): 17 * runtime/JSGlobalObjectFunctions.cpp: 18 (JSC): 19 * runtime/JSGlobalObjectFunctions.h: 20 (JSC): 21 * runtime/JSObject.cpp: 22 (JSC::JSObject::put): 23 (JSC): 24 (JSC::JSObject::putDirectAccessor): 25 (JSC::JSObject::defineOwnProperty): 26 * runtime/JSObject.h: 27 (JSC::JSObject::inlineGetOwnPropertySlot): 28 (JSC::JSValue::get): 29 * runtime/JSString.cpp: 30 (JSC::JSString::getOwnPropertySlot): 31 * runtime/JSValue.h: 32 (JSValue): 33 * runtime/ObjectConstructor.cpp: 34 (JSC::objectConstructorGetPrototypeOf): 35 * runtime/Structure.cpp: 36 (JSC::Structure::Structure): 37 * runtime/Structure.h: 38 (JSC::Structure::setHasGetterSetterProperties): 39 (Structure): 40 1 41 2012-02-12 Ashod Nakashian <ashodnakashian@yahoo.com> 2 42 -
trunk/Source/JavaScriptCore/parser/Parser.cpp
r107498 r107544 775 775 if (match(IDENT)) { 776 776 name = m_token.m_data.ident; 777 failIfTrueWithMessage(*name == m_globalData->propertyNames->underscoreProto, "Cannot name a function __proto__"); 777 778 next(); 778 779 if (!nameIsInContainingScope) -
trunk/Source/JavaScriptCore/runtime/ClassInfo.h
r107498 r107544 90 90 typedef bool (*GetOwnPropertyDescriptorFunctionPtr)(JSObject*, ExecState*, const Identifier&, PropertyDescriptor&); 91 91 GetOwnPropertyDescriptorFunctionPtr getOwnPropertyDescriptor; 92 93 typedef bool (*AllowsAccessFromFunctionPtr)(JSObject*, ExecState*);94 AllowsAccessFromFunctionPtr allowsAccessFrom;95 92 }; 96 93 … … 134 131 &ClassName::defineOwnProperty, \ 135 132 &ClassName::getOwnPropertyDescriptor, \ 136 &ClassName::allowsAccessFrom, \137 133 }, \ 138 134 sizeof(ClassName), \ -
trunk/Source/JavaScriptCore/runtime/JSCell.cpp
r107498 r107544 192 192 } 193 193 194 bool JSCell:: allowsAccessFrom(JSObject*, ExecState*)194 bool JSCell::defineOwnProperty(JSObject*, ExecState*, const Identifier&, PropertyDescriptor&, bool) 195 195 { 196 196 ASSERT_NOT_REACHED(); … … 198 198 } 199 199 200 bool JSCell:: defineOwnProperty(JSObject*, ExecState*, const Identifier&, PropertyDescriptor&, bool)200 bool JSCell::getOwnPropertyDescriptor(JSObject*, ExecState*, const Identifier&, PropertyDescriptor&) 201 201 { 202 202 ASSERT_NOT_REACHED(); … … 204 204 } 205 205 206 bool JSCell::getOwnPropertyDescriptor(JSObject*, ExecState*, const Identifier&, PropertyDescriptor&)207 {208 ASSERT_NOT_REACHED();209 return false;210 }211 212 206 } // namespace JSC -
trunk/Source/JavaScriptCore/runtime/JSCell.h
r107498 r107544 162 162 static bool defineOwnProperty(JSObject*, ExecState*, const Identifier& propertyName, PropertyDescriptor&, bool shouldThrow); 163 163 static bool getOwnPropertyDescriptor(JSObject*, ExecState*, const Identifier&, PropertyDescriptor&); 164 static bool allowsAccessFrom(JSObject*, ExecState*);165 164 166 165 private: -
trunk/Source/JavaScriptCore/runtime/JSGlobalObject.cpp
r107498 r107544 206 206 m_applyFunction.set(exec->globalData(), this, applyFunction); 207 207 m_objectPrototype.set(exec->globalData(), this, ObjectPrototype::create(exec, this, ObjectPrototype::createStructure(exec->globalData(), this, jsNull()))); 208 GetterSetter* protoAccessor = GetterSetter::create(exec);209 protoAccessor->setGetter(exec->globalData(), JSFunction::create(exec, this, 0, Identifier(), globalFuncProtoGetter));210 protoAccessor->setSetter(exec->globalData(), JSFunction::create(exec, this, 0, Identifier(), globalFuncProtoSetter));211 m_objectPrototype->putDirectAccessor(exec->globalData(), exec->propertyNames().underscoreProto, protoAccessor, Accessor | DontEnum);212 208 m_functionPrototype->structure()->setPrototypeWithoutTransition(exec->globalData(), m_objectPrototype.get()); 213 209 -
trunk/Source/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp
r107498 r107544 715 715 } 716 716 717 EncodedJSValue JSC_HOST_CALL globalFuncProtoGetter(ExecState* exec)718 {719 if (!exec->thisValue().isObject())720 return JSValue::encode(exec->thisValue().synthesizePrototype(exec));721 722 JSObject* thisObject = asObject(exec->thisValue());723 if (!thisObject->methodTable()->allowsAccessFrom(thisObject, exec))724 return JSValue::encode(jsUndefined());725 726 return JSValue::encode(thisObject->prototype());727 }728 729 EncodedJSValue JSC_HOST_CALL globalFuncProtoSetter(ExecState* exec)730 {731 JSValue value = exec->argument(0);732 733 // Setting __proto__ of a primitive should have no effect.734 if (!exec->thisValue().isObject())735 return JSValue::encode(jsUndefined());736 737 JSObject* thisObject = asObject(exec->thisValue());738 if (!thisObject->methodTable()->allowsAccessFrom(thisObject, exec))739 return JSValue::encode(jsUndefined());740 741 // Setting __proto__ to a non-object, non-null value is silently ignored to match Mozilla.742 if (!value.isObject() && !value.isNull())743 return JSValue::encode(jsUndefined());744 745 if (!thisObject->isExtensible())746 return JSValue::encode(jsUndefined());747 748 if (!thisObject->setPrototypeWithCycleCheck(exec->globalData(), value))749 throwError(exec, createError(exec, "cyclic __proto__ value"));750 751 return JSValue::encode(jsUndefined());752 }753 754 717 } // namespace JSC -
trunk/Source/JavaScriptCore/runtime/JSGlobalObjectFunctions.h
r107498 r107544 49 49 EncodedJSValue JSC_HOST_CALL globalFuncUnescape(ExecState*); 50 50 EncodedJSValue JSC_HOST_CALL globalFuncThrowTypeError(ExecState*); 51 EncodedJSValue JSC_HOST_CALL globalFuncProtoGetter(ExecState*);52 EncodedJSValue JSC_HOST_CALL globalFuncProtoSetter(ExecState*);53 51 54 52 static const double mantissaOverflowLowerBound = 9007199254740992.0; -
trunk/Source/JavaScriptCore/runtime/JSObject.cpp
r107498 r107544 133 133 JSGlobalData& globalData = exec->globalData(); 134 134 135 if (propertyName == exec->propertyNames().underscoreProto) { 136 // Setting __proto__ to a non-object, non-null value is silently ignored to match Mozilla. 137 if (!value.isObject() && !value.isNull()) 138 return; 139 140 if (!thisObject->isExtensible()) { 141 if (slot.isStrictMode()) 142 throwTypeError(exec, StrictModeReadonlyPropertyWriteError); 143 return; 144 } 145 146 if (!thisObject->setPrototypeWithCycleCheck(globalData, value)) 147 throwError(exec, createError(exec, "cyclic __proto__ value")); 148 return; 149 } 150 135 151 // Check if there are any setters or getters in the prototype chain 136 152 JSValue prototype; 137 if (propertyName != exec->propertyNames().underscoreProto) { 138 for (JSObject* obj = thisObject; !obj->structure()->hasGetterSetterPropertiesExcludingProto(); obj = asObject(prototype)) { 139 prototype = obj->prototype(); 140 if (prototype.isNull()) { 141 if (!thisObject->putDirectInternal<PutModePut>(globalData, propertyName, value, 0, slot, getJSFunction(value)) && slot.isStrictMode()) 142 throwTypeError(exec, StrictModeReadonlyPropertyWriteError); 143 return; 144 } 145 } 146 } 147 153 for (JSObject* obj = thisObject; !obj->structure()->hasGetterSetterProperties(); obj = asObject(prototype)) { 154 prototype = obj->prototype(); 155 if (prototype.isNull()) { 156 if (!thisObject->putDirectInternal<PutModePut>(globalData, propertyName, value, 0, slot, getJSFunction(value)) && slot.isStrictMode()) 157 throwTypeError(exec, StrictModeReadonlyPropertyWriteError); 158 return; 159 } 160 } 161 148 162 unsigned attributes; 149 163 JSCell* specificValue; … … 202 216 } 203 217 204 bool JSObject::allowsAccessFrom(JSObject*, ExecState*)205 {206 return true;207 }208 209 218 void JSObject::putDirectAccessor(JSGlobalData& globalData, const Identifier& propertyName, JSValue value, unsigned attributes) 210 219 { 211 220 ASSERT(value.isGetterSetter() && (attributes & Accessor)); 221 ASSERT(propertyName != globalData.propertyNames->underscoreProto); 212 222 213 223 PutPropertySlot slot; … … 220 230 setStructure(globalData, Structure::attributeChangeTransition(globalData, structure(), propertyName, attributes)); 221 231 222 structure()->setHasGetterSetterProperties( propertyName == globalData.propertyNames->underscoreProto);232 structure()->setHasGetterSetterProperties(true); 223 233 } 224 234 … … 620 630 bool JSObject::defineOwnProperty(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor, bool throwException) 621 631 { 632 // __proto__ is magic; we don't currently support setting it as a regular property. 633 // Silent filter out calls to set __proto__ at an early stage; pretend all is okay. 634 if (propertyName == exec->propertyNames().underscoreProto) 635 return true; 636 622 637 // If we have a new property we can just put it on normally 623 638 PropertyDescriptor current; -
trunk/Source/JavaScriptCore/runtime/JSObject.h
r107498 r107544 105 105 JS_EXPORT_PRIVATE static bool getOwnPropertySlotByIndex(JSCell*, ExecState*, unsigned propertyName, PropertySlot&); 106 106 JS_EXPORT_PRIVATE static bool getOwnPropertyDescriptor(JSObject*, ExecState*, const Identifier&, PropertyDescriptor&); 107 JS_EXPORT_PRIVATE static bool allowsAccessFrom(JSObject*, ExecState*);108 107 109 108 JS_EXPORT_PRIVATE static void put(JSCell*, ExecState*, const Identifier& propertyName, JSValue, PutPropertySlot&); … … 549 548 else 550 549 slot.setValue(this, location->get(), offsetForLocation(location)); 550 return true; 551 } 552 553 // non-standard Netscape extension 554 if (propertyName == exec->propertyNames().underscoreProto) { 555 slot.setValue(prototype()); 551 556 return true; 552 557 } … … 799 804 if (UNLIKELY(!isCell())) { 800 805 JSObject* prototype = synthesizePrototype(exec); 806 if (propertyName == exec->propertyNames().underscoreProto) 807 return prototype; 801 808 if (!prototype->getPropertySlot(exec, propertyName, slot)) 802 809 return jsUndefined(); -
trunk/Source/JavaScriptCore/runtime/JSString.cpp
r107498 r107544 254 254 if (thisObject->getStringPropertySlot(exec, propertyName, slot)) 255 255 return true; 256 if (propertyName == exec->propertyNames().underscoreProto) { 257 slot.setValue(exec->lexicalGlobalObject()->stringPrototype()); 258 return true; 259 } 256 260 slot.setBase(thisObject); 257 261 JSObject* object; -
trunk/Source/JavaScriptCore/runtime/JSValue.h
r107498 r107544 235 235 char* description(); 236 236 237 JS_EXPORT_PRIVATE JSObject* synthesizePrototype(ExecState*) const;238 239 237 private: 240 238 template <class T> JSValue(WriteBarrierBase<T>); … … 249 247 JS_EXPORT_PRIVATE JSObject* toThisObjectSlowCase(ExecState*) const; 250 248 249 JS_EXPORT_PRIVATE JSObject* synthesizePrototype(ExecState*) const; 251 250 JSObject* synthesizeObject(ExecState*) const; 252 251 -
trunk/Source/JavaScriptCore/runtime/ObjectConstructor.cpp
r107498 r107544 139 139 if (!exec->argument(0).isObject()) 140 140 return throwVMError(exec, createTypeError(exec, "Requested prototype of a value that is not an object.")); 141 JSObject* object = asObject(exec->argument(0)); 142 143 if (!object->methodTable()->allowsAccessFrom(object, exec)) 144 return JSValue::encode(jsUndefined()); 145 146 return JSValue::encode(object->prototype()); 141 142 // This uses JSValue::get() instead of directly accessing the prototype from the object 143 // (using JSObject::prototype()) in order to allow objects to override the behavior, such 144 // as returning jsUndefined() for cross-origin access. 145 return JSValue::encode(exec->argument(0).get(exec, exec->propertyNames().underscoreProto)); 147 146 } 148 147 -
trunk/Source/JavaScriptCore/runtime/Structure.cpp
r107499 r107544 168 168 , m_isPinnedPropertyTable(false) 169 169 , m_hasGetterSetterProperties(false) 170 , m_hasGetterSetterPropertiesExcludingProto(false)171 170 , m_hasNonEnumerableProperties(false) 172 171 , m_attributesInPrevious(0) … … 190 189 , m_isPinnedPropertyTable(false) 191 190 , m_hasGetterSetterProperties(false) 192 , m_hasGetterSetterPropertiesExcludingProto(false)193 191 , m_hasNonEnumerableProperties(false) 194 192 , m_attributesInPrevious(0) … … 210 208 , m_isPinnedPropertyTable(false) 211 209 , m_hasGetterSetterProperties(previous->m_hasGetterSetterProperties) 212 , m_hasGetterSetterPropertiesExcludingProto(previous->m_hasGetterSetterPropertiesExcludingProto)213 210 , m_hasNonEnumerableProperties(previous->m_hasNonEnumerableProperties) 214 211 , m_attributesInPrevious(0) -
trunk/Source/JavaScriptCore/runtime/Structure.h
r107498 r107544 146 146 147 147 bool hasGetterSetterProperties() const { return m_hasGetterSetterProperties; } 148 bool hasGetterSetterPropertiesExcludingProto() const { return m_hasGetterSetterPropertiesExcludingProto; } 149 void setHasGetterSetterProperties(bool isProto) 150 { 151 m_hasGetterSetterProperties = true; 152 if (!isProto) 153 m_hasGetterSetterPropertiesExcludingProto = true; 154 } 148 void setHasGetterSetterProperties(bool hasGetterSetterProperties) { m_hasGetterSetterProperties = hasGetterSetterProperties; } 155 149 156 150 bool hasNonEnumerableProperties() const { return m_hasNonEnumerableProperties; } … … 289 283 bool m_isPinnedPropertyTable : 1; 290 284 bool m_hasGetterSetterProperties : 1; 291 bool m_hasGetterSetterPropertiesExcludingProto : 1;292 285 bool m_hasNonEnumerableProperties : 1; 293 286 unsigned m_attributesInPrevious : 7; -
trunk/Source/WebCore/ChangeLog
r107542 r107544 1 2012-02-13 Gavin Barraclough <barraclough@apple.com> 2 3 https://bugs.webkit.org/show_bug.cgi?id=78434 4 Unreviewed - temporarily reverting r107498 will I fix a couple of testcases. 5 6 * bindings/js/JSDOMWindowBase.cpp: 7 (WebCore): 8 * bindings/js/JSDOMWindowBase.h: 9 (JSDOMWindowBase): 10 1 11 2012-02-13 Ilya Tikhonovsky <loislo@chromium.org> 2 12 -
trunk/Source/WebCore/bindings/js/JSDOMWindowBase.cpp
r107498 r107544 93 93 } 94 94 95 bool JSDOMWindowBase::allowsAccessFrom(JSObject* thisObject, ExecState* exec)96 {97 return static_cast<JSDOMWindowBase*>(thisObject)->allowsAccessFrom(exec);98 }99 100 95 bool JSDOMWindowBase::supportsProfiling(const JSGlobalObject* object) 101 96 { -
trunk/Source/WebCore/bindings/js/JSDOMWindowBase.h
r107498 r107544 64 64 static bool supportsRichSourceInfo(const JSC::JSGlobalObject*); 65 65 static bool shouldInterruptScript(const JSC::JSGlobalObject*); 66 static bool allowsAccessFrom(JSC::JSObject*, JSC::ExecState*); 67 66 68 67 bool allowsAccessFrom(JSC::ExecState*) const; 69 68 bool allowsAccessFromNoErrorMessage(JSC::ExecState*) const;
Note: See TracChangeset
for help on using the changeset viewer.