Changeset 95787 in webkit
- Timestamp:
- Sep 23, 2011 12:18:48 AM (13 years ago)
- Location:
- trunk
- Files:
-
- 3 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r95785 r95787 91 91 92 92 * platform/chromium/test_expectations.txt: 93 94 2011-09-22 Gavin Barraclough <barraclough@apple.com> 95 96 Incorrect this value passed to callbacks. 97 https://bugs.webkit.org/show_bug.cgi?id=68668 98 99 Reviewed by Oliver Hunt. 100 101 From Array/String prototype function. Should be undefined, but 102 global object is passed instead (this is visible for strict callbacks). 103 104 * fast/js/array-prototype-properties-expected.txt: 105 * fast/js/script-tests/strict-callback-this.js: Added. 106 (strictThrowThisString): 107 (nonstrictThrowThisString): 108 (testArrayPrototypeSort): 109 (testArrayPrototypeFilter): 110 (testArrayPrototypeMap): 111 (testArrayPrototypeEvery): 112 (testArrayPrototypeForEach): 113 (testArrayPrototypeSome): 114 (testStringPrototypeReplace): 115 * fast/js/strict-callback-this-expected.txt: Added. 116 * fast/js/strict-callback-this.html: Added. 117 * ietestcenter/Javascript/15.3.4.5-0-2-expected.txt: 93 118 94 119 2011-09-22 Gavin Barraclough <barraclough@apple.com> -
trunk/LayoutTests/fast/js/array-prototype-properties-expected.txt
r92093 r95787 24 24 FAIL Array.prototype.reduce.call(undefined, toString) should throw an exception. Was [object Object]. 25 25 FAIL Array.prototype.reduceRight.call(undefined, toString) should throw an exception. Was [object Object]. 26 FAIL Array.prototype.map.call(undefined, toString) should throw an exception. Was [object DOMWindow].26 FAIL Array.prototype.map.call(undefined, toString) should throw an exception. Was [object Undefined]. 27 27 PASS successfullyParsed is true 28 28 -
trunk/Source/JavaScriptCore/ChangeLog
r95786 r95787 44 44 45 45 * Configurations/FeatureDefines.xcconfig: 46 47 2011-09-22 Gavin Barraclough <barraclough@apple.com> 48 49 Incorrect this value passed to callbacks. 50 https://bugs.webkit.org/show_bug.cgi?id=68668 51 52 Reviewed by Oliver Hunt. 53 54 From Array/String prototype function. Should be undefined, but 55 global object is passed instead (this is visible for strict callbacks). 56 57 * runtime/ArrayPrototype.cpp: 58 (JSC::arrayProtoFuncSort): 59 (JSC::arrayProtoFuncFilter): 60 (JSC::arrayProtoFuncMap): 61 (JSC::arrayProtoFuncEvery): 62 (JSC::arrayProtoFuncForEach): 63 (JSC::arrayProtoFuncSome): 64 * runtime/JSArray.cpp: 65 (JSC::AVLTreeAbstractorForArrayCompare::compare_key_key): 66 (JSC::JSArray::sort): 67 * runtime/StringPrototype.cpp: 68 (JSC::stringProtoFuncReplace): 46 69 47 70 2011-09-22 Gavin Barraclough <barraclough@apple.com> -
trunk/Source/JavaScriptCore/runtime/ArrayPrototype.cpp
r94929 r95787 544 544 l.append(jObj); 545 545 l.append(minObj); 546 compareResult = call(exec, function, callType, callData, exec->globalThisValue(), l).toNumber(exec);546 compareResult = call(exec, function, callType, callData, jsUndefined(), l).toNumber(exec); 547 547 } else 548 548 compareResult = (jObj.toString(exec) < minObj.toString(exec)) ? -1 : 1; … … 672 672 return throwVMTypeError(exec); 673 673 674 JS Object* applyThis = exec->argument(1).isUndefinedOrNull() ? exec->globalThisValue() : exec->argument(1).toObject(exec);674 JSValue applyThis = exec->argument(1); 675 675 JSArray* resultArray = constructEmptyArray(exec); 676 676 … … 731 731 return throwVMTypeError(exec); 732 732 733 JS Object* applyThis = exec->argument(1).isUndefinedOrNull() ? exec->globalThisValue() : exec->argument(1).toObject(exec);733 JSValue applyThis = exec->argument(1); 734 734 735 735 JSArray* resultArray = constructEmptyArray(exec, length); … … 793 793 return throwVMTypeError(exec); 794 794 795 JS Object* applyThis = exec->argument(1).isUndefinedOrNull() ? exec->globalThisValue() : exec->argument(1).toObject(exec);795 JSValue applyThis = exec->argument(1); 796 796 797 797 JSValue result = jsBoolean(true); … … 851 851 return throwVMTypeError(exec); 852 852 853 JS Object* applyThis = exec->argument(1).isUndefinedOrNull() ? exec->globalThisValue() : exec->argument(1).toObject(exec);853 JSValue applyThis = exec->argument(1); 854 854 855 855 unsigned k = 0; … … 901 901 return throwVMTypeError(exec); 902 902 903 JS Object* applyThis = exec->argument(1).isUndefinedOrNull() ? exec->globalThisValue() : exec->argument(1).toObject(exec);903 JSValue applyThis = exec->argument(1); 904 904 905 905 JSValue result = jsBoolean(false); -
trunk/Source/JavaScriptCore/runtime/JSArray.cpp
r94364 r95787 1017 1017 CallType m_compareCallType; 1018 1018 const CallData* m_compareCallData; 1019 JSValue m_globalThisValue;1020 1019 OwnPtr<CachedCall> m_cachedCall; 1021 1020 … … 1056 1055 double compareResult; 1057 1056 if (m_cachedCall) { 1058 m_cachedCall->setThis( m_globalThisValue);1057 m_cachedCall->setThis(jsUndefined()); 1059 1058 m_cachedCall->setArgument(0, va); 1060 1059 m_cachedCall->setArgument(1, vb); … … 1064 1063 arguments.append(va); 1065 1064 arguments.append(vb); 1066 compareResult = call(m_exec, m_compareFunction, m_compareCallType, *m_compareCallData, m_globalThisValue, arguments).toNumber(m_exec);1065 compareResult = call(m_exec, m_compareFunction, m_compareCallType, *m_compareCallData, jsUndefined(), arguments).toNumber(m_exec); 1067 1066 } 1068 1067 return (compareResult < 0) ? -1 : 1; // Not passing equality through, because we need to store all values, even if equivalent. … … 1100 1099 tree.abstractor().m_compareCallType = callType; 1101 1100 tree.abstractor().m_compareCallData = &callData; 1102 tree.abstractor().m_globalThisValue = exec->globalThisValue();1103 1101 tree.abstractor().m_nodes.grow(nodeCount); 1104 1102 -
trunk/Source/JavaScriptCore/runtime/StringPrototype.cpp
r95505 r95787 449 449 cachedCall.setArgument(i++, sourceVal); 450 450 451 cachedCall.setThis( exec->globalThisValue());451 cachedCall.setThis(jsUndefined()); 452 452 JSValue result = cachedCall.call(); 453 453 if (LIKELY(result.isString())) … … 496 496 args.append(sourceVal); 497 497 498 replacements.append(call(exec, replacement, callType, callData, exec->globalThisValue(), args).toString(exec));498 replacements.append(call(exec, replacement, callType, callData, jsUndefined(), args).toString(exec)); 499 499 if (exec->hadException()) 500 500 break; … … 552 552 args.append(sourceVal); 553 553 554 replacementString = call(exec, replacement, callType, callData, exec->globalThisValue(), args).toString(exec);554 replacementString = call(exec, replacement, callType, callData, jsUndefined(), args).toString(exec); 555 555 } 556 556
Note: See TracChangeset
for help on using the changeset viewer.