Changeset 202334 in webkit
- Timestamp:
- Jun 22, 2016 10:50:15 AM (8 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r202326 r202334 1 2016-06-22 Youenn Fablet <youennf@gmail.com> 2 3 JSDOMIterator forEach should support second optional parameter 4 https://bugs.webkit.org/show_bug.cgi?id=159020 5 6 Reviewed by Chris Dumez. 7 8 * fast/dom/nodeListIterator-expected.txt: 9 * fast/dom/nodeListIterator.html: Adding 'thisValue' various checks. 10 1 11 2016-06-22 Per Arne Vollan <pvollan@apple.com> 2 12 -
trunk/LayoutTests/fast/dom/nodeListIterator-expected.txt
r202307 r202334 12 12 PASS forEachIndex is index 13 13 PASS node is children[index++] 14 PASS thisValue is window 14 15 PASS forEachContainer is nodeList 15 16 PASS forEachIndex is index 16 17 PASS node is children[index++] 18 PASS thisValue is window 19 PASS thisValue is window 20 PASS thisValue is window 21 PASS thisValue is givenThisValue 22 PASS thisValue is givenThisValue 17 23 PASS iterator.next().value is children[0] 18 24 PASS iterator.next().value is children[1] -
trunk/LayoutTests/fast/dom/nodeListIterator.html
r202307 r202334 40 40 var forEachIndex; 41 41 var forEachContainer; 42 var thisValue; 42 43 nodeList.forEach(function(n, i, c) { 43 44 node = n; 44 45 forEachIndex = i; 45 46 forEachContainer = c; 47 thisValue = this; 46 48 shouldBe('forEachContainer', 'nodeList'); 47 49 shouldBe('forEachIndex', 'index'); 48 50 shouldBe('node', 'children[index++]'); 51 shouldBe('thisValue', 'window'); 49 52 }); 50 53 54 nodeList.forEach(function() { 55 thisValue = this; 56 shouldBe('thisValue', 'window'); 57 }, undefined); 58 59 var givenThisValue = nodeList; 60 nodeList.forEach(function() { 61 thisValue = this; 62 shouldBe('thisValue', 'givenThisValue'); 63 }, givenThisValue); 64 51 65 var iterator = nodeList.keys(); 52 66 shouldBe('iterator.next().value', 'children[0]'); -
trunk/Source/WebCore/ChangeLog
r202333 r202334 1 2016-06-22 Youenn Fablet <youennf@gmail.com> 2 3 JSDOMIterator forEach should support second optional parameter 4 https://bugs.webkit.org/show_bug.cgi?id=159020 5 6 Reviewed by Chris Dumez. 7 8 Covered by beefed up test. 9 10 * bindings/js/JSDOMIterator.h: 11 (WebCore::iteratorForEach): Setting callback thisValue to the second argument passed to forEach. 12 1 13 2016-06-22 Jer Noble <jer.noble@apple.com> 2 14 -
trunk/Source/WebCore/bindings/js/JSDOMIterator.h
r202307 r202334 183 183 return throwThisTypeError(state, JSWrapper::info()->className, propertyName); 184 184 185 JSC::JSValue callback = state.argument(0); 186 JSC::JSValue thisValue = state.argument(1); 187 185 188 JSC::CallData callData; 186 JSC::CallType callType = JSC::getCallData( state.argument(0), callData);189 JSC::CallType callType = JSC::getCallData(callback, callData); 187 190 if (callType == JSC::CallType::None) 188 191 return throwVMTypeError(&state); … … 194 197 appendForEachArguments(state, wrapper->globalObject(), arguments, value, index); 195 198 arguments.append(wrapper); 196 JSC::call(&state, state.argument(0), callType, callData, wrapper, arguments);199 JSC::call(&state, callback, callType, callData, thisValue, arguments); 197 200 if (state.hadException()) 198 201 break; 199 } 202 } 200 203 return JSC::JSValue::encode(JSC::jsUndefined()); 201 204 }
Note: See TracChangeset
for help on using the changeset viewer.