Changeset 246364 in webkit
- Timestamp:
- Jun 12, 2019, 11:16:06 AM (7 years ago)
- Location:
- branches/safari-607.3.1.2-branch
- Files:
-
- 3 added
- 4 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/http/tests/security/cross-frame-access-object-getPrototypeOf-in-put-expected.txt (added)
-
LayoutTests/http/tests/security/cross-frame-access-object-getPrototypeOf-in-put.html (added)
-
LayoutTests/http/tests/security/resources/cross-frame-iframe-for-object-getPrototypeOf-in-put-test.html (added)
-
Source/JavaScriptCore/ChangeLog (modified) (1 diff)
-
Source/JavaScriptCore/runtime/JSArrayInlines.h (modified) (1 diff)
-
Source/JavaScriptCore/runtime/JSObject.cpp (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/safari-607.3.1.2-branch/LayoutTests/ChangeLog
r245910 r246364 1 2019-06-12 Alan Coon <alancoon@apple.com> 2 3 Cherry-pick r246040. rdar://problem/51670920 4 5 [JSC] JSObject::attemptToInterceptPutByIndexOnHole should use getPrototype instead of getPrototypeDirect 6 https://bugs.webkit.org/show_bug.cgi?id=198477 7 <rdar://problem/51299504> 8 9 Reviewed by Saam Barati. 10 11 Source/JavaScriptCore: 12 13 JSObject::attemptToInterceptPutByIndexOnHole uses getPrototypeDirect, but it should use getPrototype to 14 handle getPrototype methods in derived JSObject classes correctly. 15 16 * runtime/JSArrayInlines.h: 17 (JSC::JSArray::pushInline): 18 * runtime/JSObject.cpp: 19 (JSC::JSObject::putByIndex): 20 (JSC::JSObject::attemptToInterceptPutByIndexOnHoleForPrototype): 21 (JSC::JSObject::attemptToInterceptPutByIndexOnHole): 22 (JSC::JSObject::putByIndexBeyondVectorLength): 23 24 LayoutTests: 25 26 Ensure that JSWindow::getPrototype is used. 27 28 * http/tests/security/cross-frame-access-object-getPrototypeOf-in-put-expected.txt: Added. 29 * http/tests/security/cross-frame-access-object-getPrototypeOf-in-put.html: Added. 30 * http/tests/security/resources/cross-frame-iframe-for-object-getPrototypeOf-in-put-test.html: Added. 31 32 33 git-svn-id: https://svn.webkit.org/repository/webkit/trunk@246040 268f45cc-cd09-0410-ab3c-d52691b4dbfc 34 35 2019-06-03 Yusuke Suzuki <ysuzuki@apple.com> 36 37 [JSC] JSObject::attemptToInterceptPutByIndexOnHole should use getPrototype instead of getPrototypeDirect 38 https://bugs.webkit.org/show_bug.cgi?id=198477 39 <rdar://problem/51299504> 40 41 Reviewed by Saam Barati. 42 43 Ensure that JSWindow::getPrototype is used. 44 45 * http/tests/security/cross-frame-access-object-getPrototypeOf-in-put-expected.txt: Added. 46 * http/tests/security/cross-frame-access-object-getPrototypeOf-in-put.html: Added. 47 * http/tests/security/resources/cross-frame-iframe-for-object-getPrototypeOf-in-put-test.html: Added. 48 1 49 2019-05-30 Kocsen Chung <kocsen_chung@apple.com> 2 50 -
branches/safari-607.3.1.2-branch/Source/JavaScriptCore/ChangeLog
r245910 r246364 1 2019-06-12 Alan Coon <alancoon@apple.com> 2 3 Cherry-pick r246040. rdar://problem/51670920 4 5 [JSC] JSObject::attemptToInterceptPutByIndexOnHole should use getPrototype instead of getPrototypeDirect 6 https://bugs.webkit.org/show_bug.cgi?id=198477 7 <rdar://problem/51299504> 8 9 Reviewed by Saam Barati. 10 11 Source/JavaScriptCore: 12 13 JSObject::attemptToInterceptPutByIndexOnHole uses getPrototypeDirect, but it should use getPrototype to 14 handle getPrototype methods in derived JSObject classes correctly. 15 16 * runtime/JSArrayInlines.h: 17 (JSC::JSArray::pushInline): 18 * runtime/JSObject.cpp: 19 (JSC::JSObject::putByIndex): 20 (JSC::JSObject::attemptToInterceptPutByIndexOnHoleForPrototype): 21 (JSC::JSObject::attemptToInterceptPutByIndexOnHole): 22 (JSC::JSObject::putByIndexBeyondVectorLength): 23 24 LayoutTests: 25 26 Ensure that JSWindow::getPrototype is used. 27 28 * http/tests/security/cross-frame-access-object-getPrototypeOf-in-put-expected.txt: Added. 29 * http/tests/security/cross-frame-access-object-getPrototypeOf-in-put.html: Added. 30 * http/tests/security/resources/cross-frame-iframe-for-object-getPrototypeOf-in-put-test.html: Added. 31 32 33 git-svn-id: https://svn.webkit.org/repository/webkit/trunk@246040 268f45cc-cd09-0410-ab3c-d52691b4dbfc 34 35 2019-06-03 Yusuke Suzuki <ysuzuki@apple.com> 36 37 [JSC] JSObject::attemptToInterceptPutByIndexOnHole should use getPrototype instead of getPrototypeDirect 38 https://bugs.webkit.org/show_bug.cgi?id=198477 39 <rdar://problem/51299504> 40 41 Reviewed by Saam Barati. 42 43 JSObject::attemptToInterceptPutByIndexOnHole uses getPrototypeDirect, but it should use getPrototype to 44 handle getPrototype methods in derived JSObject classes correctly. 45 46 * runtime/JSArrayInlines.h: 47 (JSC::JSArray::pushInline): 48 * runtime/JSObject.cpp: 49 (JSC::JSObject::putByIndex): 50 (JSC::JSObject::attemptToInterceptPutByIndexOnHoleForPrototype): 51 (JSC::JSObject::attemptToInterceptPutByIndexOnHole): 52 (JSC::JSObject::putByIndexBeyondVectorLength): 53 1 54 2019-05-30 Kocsen Chung <kocsen_chung@apple.com> 2 55 -
branches/safari-607.3.1.2-branch/Source/JavaScriptCore/runtime/JSArrayInlines.h
r237447 r246364 213 213 unsigned oldLength = length(); 214 214 bool putResult = false; 215 if (attemptToInterceptPutByIndexOnHole(exec, oldLength, value, true, putResult)) { 216 if (!scope.exception() && oldLength < 0xFFFFFFFFu) { 215 bool result = attemptToInterceptPutByIndexOnHole(exec, oldLength, value, true, putResult); 216 RETURN_IF_EXCEPTION(scope, void()); 217 if (result) { 218 if (oldLength < 0xFFFFFFFFu) { 217 219 scope.release(); 218 220 setLength(exec, oldLength + 1, true); -
branches/safari-607.3.1.2-branch/Source/JavaScriptCore/runtime/JSObject.cpp
r239557 r246364 916 916 WriteBarrier<Unknown>& valueSlot = storage->m_vector[propertyName]; 917 917 unsigned length = storage->length(); 918 919 auto scope = DECLARE_THROW_SCOPE(vm); 918 920 919 921 // Update length & m_numValuesInVector as necessary. 920 922 if (propertyName >= length) { 921 923 bool putResult = false; 922 if (thisObject->attemptToInterceptPutByIndexOnHole(exec, propertyName, value, shouldThrow, putResult)) 924 bool result = thisObject->attemptToInterceptPutByIndexOnHole(exec, propertyName, value, shouldThrow, putResult); 925 RETURN_IF_EXCEPTION(scope, false); 926 if (result) 923 927 return putResult; 924 928 length = propertyName + 1; … … 927 931 } else if (!valueSlot) { 928 932 bool putResult = false; 929 if (thisObject->attemptToInterceptPutByIndexOnHole(exec, propertyName, value, shouldThrow, putResult)) 933 bool result = thisObject->attemptToInterceptPutByIndexOnHole(exec, propertyName, value, shouldThrow, putResult); 934 RETURN_IF_EXCEPTION(scope, false); 935 if (result) 930 936 return putResult; 931 937 ++storage->m_numValuesInVector; … … 2671 2677 { 2672 2678 VM& vm = exec->vm(); 2679 auto scope = DECLARE_THROW_SCOPE(vm); 2680 2673 2681 for (JSObject* current = this; ;) { 2674 2682 // This has the same behavior with respect to prototypes as JSObject::put(). It only … … 2681 2689 SparseArrayValueMap::iterator iter = storage->m_sparseMap->find(i); 2682 2690 if (iter != storage->m_sparseMap->notFound() && (iter->value.attributes() & (PropertyAttribute::Accessor | PropertyAttribute::ReadOnly))) { 2691 scope.release(); 2683 2692 putResult = iter->value.put(exec, thisValue, storage->m_sparseMap.get(), value, shouldThrow); 2684 2693 return true; … … 2687 2696 2688 2697 if (current->type() == ProxyObjectType) { 2698 scope.release(); 2689 2699 ProxyObject* proxy = jsCast<ProxyObject*>(current); 2690 2700 putResult = proxy->putByIndexCommon(exec, thisValue, i, value, shouldThrow); … … 2692 2702 } 2693 2703 2694 JSValue prototypeValue = current->getPrototypeDirect(vm); 2704 JSValue prototypeValue = current->getPrototype(vm, exec); 2705 RETURN_IF_EXCEPTION(scope, false); 2695 2706 if (prototypeValue.isNull()) 2696 2707 return false; … … 2702 2713 bool JSObject::attemptToInterceptPutByIndexOnHole(ExecState* exec, unsigned i, JSValue value, bool shouldThrow, bool& putResult) 2703 2714 { 2704 JSValue prototypeValue = getPrototypeDirect(exec->vm()); 2715 VM& vm = exec->vm(); 2716 auto scope = DECLARE_THROW_SCOPE(vm); 2717 2718 JSValue prototypeValue = getPrototype(vm, exec); 2719 RETURN_IF_EXCEPTION(scope, false); 2705 2720 if (prototypeValue.isNull()) 2706 2721 return false; 2707 2722 2708 return asObject(prototypeValue)->attemptToInterceptPutByIndexOnHoleForPrototype(exec, this, i, value, shouldThrow, putResult);2723 RELEASE_AND_RETURN(scope, asObject(prototypeValue)->attemptToInterceptPutByIndexOnHoleForPrototype(exec, this, i, value, shouldThrow, putResult)); 2709 2724 } 2710 2725 … … 2892 2907 case ArrayWithSlowPutArrayStorage: { 2893 2908 // No own property present in the vector, but there might be in the sparse map! 2909 auto scope = DECLARE_THROW_SCOPE(vm); 2894 2910 SparseArrayValueMap* map = arrayStorage()->m_sparseMap.get(); 2895 2911 bool putResult = false; 2896 if (!(map && map->contains(i)) && attemptToInterceptPutByIndexOnHole(exec, i, value, shouldThrow, putResult)) 2897 return putResult; 2912 if (!(map && map->contains(i))) { 2913 bool result = attemptToInterceptPutByIndexOnHole(exec, i, value, shouldThrow, putResult); 2914 RETURN_IF_EXCEPTION(scope, false); 2915 if (result) 2916 return putResult; 2917 } 2918 scope.release(); 2898 2919 FALLTHROUGH; 2899 2920 }
Note:
See TracChangeset
for help on using the changeset viewer.