Changeset 91483 in webkit
- Timestamp:
- Jul 21, 2011, 11:59:38 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r91481 r91483 1 2011-07-21 Gavin Barraclough <barraclough@apple.com> 2 3 https://bugs.webkit.org/show_bug.cgi?id=64900 4 Function.prototype.apply should accept an array-like object as its second argument 5 6 Reviewed by Sam Weinig. 7 8 * fast/js/function-apply-expected.txt: 9 * fast/js/script-tests/function-apply.js: 10 - Add a test for array-like objects. 11 * sputnik/Conformance/15_Native_Objects/15.3_Function/15.3.4/15.3.4.3_Function.prototype.apply/S15.3.4.3_A6_T1-expected.txt: 12 * sputnik/Conformance/15_Native_Objects/15.3_Function/15.3.4/15.3.4.3_Function.prototype.apply/S15.3.4.3_A6_T4-expected.txt: 13 - These tests are incorrect & assert ES3 behaviour. 14 1 15 2011-07-21 Enrica Casucci <enrica@apple.com> 2 16 -
trunk/LayoutTests/fast/js/function-apply-expected.txt
r62456 r91483 1 Tests to ensure that Function.apply works correctly for Arrays and arguments.1 Tests to ensure that Function.apply works correctly for Arrays, arguments and array-like objects. 2 2 3 3 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". … … 37 37 PASS var a = []; a.length = 0xFFFFFFFE; [].constructor.apply('', a).length is 0x10000 38 38 PASS var a = []; a.length = 0xFFFFFFFF; [].constructor.apply('', a).length is 0x10000 39 PASS (function(a,b,c,d){ return d ? -1 : (a+b+c); }).apply(undefined, {length:3, 0:100, 1:20, 2:3}) is 123 39 40 PASS successfullyParsed is true 40 41 -
trunk/LayoutTests/fast/js/script-tests/function-apply.js
r62456 r91483 1 description('Tests to ensure that Function.apply works correctly for Arrays and arguments.');1 description('Tests to ensure that Function.apply works correctly for Arrays, arguments and array-like objects.'); 2 2 3 3 function argumentsApply1(a, b, c) … … 292 292 shouldBe("var a = []; a.length = 0xFFFFFFFF; [].constructor.apply('', a).length", "0x10000"); 293 293 294 // ES5 permits apply with array-like objects. 295 shouldBe("(function(a,b,c,d){ return d ? -1 : (a+b+c); }).apply(undefined, {length:3, 0:100, 1:20, 2:3})", '123'); 296 294 297 var successfullyParsed = true; -
trunk/LayoutTests/sputnik/Conformance/15_Native_Objects/15.3_Function/15.3.4/15.3.4.3_Function.prototype.apply/S15.3.4.3_A6_T1-expected.txt
r58534 r91483 1 1 S15.3.4.3_A6_T1 2 2 3 PASS 3 FAIL SputnikError: #1.1: if argArray is neither an array nor an arguments object (see 10.1.8), a TypeError exception is thrown 4 4 5 5 TEST COMPLETE -
trunk/LayoutTests/sputnik/Conformance/15_Native_Objects/15.3_Function/15.3.4/15.3.4.3_Function.prototype.apply/S15.3.4.3_A6_T4-expected.txt
r58534 r91483 1 1 S15.3.4.3_A6_T4 2 2 3 PASS 3 FAIL SputnikError: #1.1: if argArray is neither an array nor an arguments object (see 10.1.8), a TypeError exception is thrown 4 4 5 5 TEST COMPLETE -
trunk/Source/JavaScriptCore/ChangeLog
r91482 r91483 1 2011-07-21 Gavin Barraclough <barraclough@apple.com> 2 3 https://bugs.webkit.org/show_bug.cgi?id=64900 4 Function.prototype.apply should accept an array-like object as its second argument 5 6 Reviewed by Sam Weinig. 7 8 * interpreter/Interpreter.cpp: 9 (JSC::Interpreter::privateExecute): 10 * jit/JITStubs.cpp: 11 (JSC::DEFINE_STUB_FUNCTION): 12 * runtime/FunctionPrototype.cpp: 13 (JSC::functionProtoFuncApply): 14 - Remove the type error if object is not an array. 15 1 16 2011-07-21 Gavin Barraclough <barraclough@apple.com> 2 17 -
trunk/Source/JavaScriptCore/interpreter/Interpreter.cpp
r91216 r91483 4314 4314 } 4315 4315 array->copyToRegisters(callFrame, callFrame->registers() + argsOffset, argCount); 4316 } else if (asObject(arguments)->inherits(&JSArray::s_info)){4316 } else { 4317 4317 JSObject* argObject = asObject(arguments); 4318 4318 argCount = argObject->get(callFrame, callFrame->propertyNames().length).toUInt32(callFrame); … … 4329 4329 CHECK_FOR_EXCEPTION(); 4330 4330 } 4331 } else {4332 exceptionValue = createInvalidParamError(callFrame, "Function.prototype.apply", arguments);4333 goto vm_throw;4334 4331 } 4335 4332 } -
trunk/Source/JavaScriptCore/jit/JITStubs.cpp
r91194 r91483 2560 2560 } 2561 2561 array->copyToRegisters(callFrame, callFrame->registers() + argsOffset, argCount); 2562 } else if (asObject(arguments)->inherits(&JSArray::s_info)){2562 } else { 2563 2563 JSObject* argObject = asObject(arguments); 2564 2564 argCount = argObject->get(callFrame, callFrame->propertyNames().length).toUInt32(callFrame); … … 2575 2575 CHECK_FOR_EXCEPTION(); 2576 2576 } 2577 } else {2578 stackFrame.globalData->exception = createInvalidParamError(callFrame, "Function.prototype.apply", arguments);2579 VM_THROW_EXCEPTION();2580 2577 } 2581 2578 } -
trunk/Source/JavaScriptCore/runtime/FunctionPrototype.cpp
r91194 r91483 122 122 else if (isJSArray(&exec->globalData(), array)) 123 123 asArray(array)->fillArgList(exec, applyArgs); 124 else if (asObject(array)->inherits(&JSArray::s_info)){125 unsigned length = as Array(array)->get(exec, exec->propertyNames().length).toUInt32(exec);124 else { 125 unsigned length = asObject(array)->get(exec, exec->propertyNames().length).toUInt32(exec); 126 126 for (unsigned i = 0; i < length; ++i) 127 127 applyArgs.append(asArray(array)->get(exec, i)); 128 } else 129 return throwVMTypeError(exec); 128 } 130 129 } 131 130
Note:
See TracChangeset
for help on using the changeset viewer.