WebKit Bugzilla
Attachment 371843 Details for
Bug 177398
: JSC should throw if proxy set returns falsish in strict mode context
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-177398-20190611172710.patch (text/plain), 4.74 KB, created by
Alexey Shvayka
on 2019-06-11 07:27:12 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Alexey Shvayka
Created:
2019-06-11 07:27:12 PDT
Size:
4.74 KB
patch
obsolete
>Index: JSTests/ChangeLog >=================================================================== >--- JSTests/ChangeLog (revision 246310) >+++ JSTests/ChangeLog (working copy) >@@ -1,3 +1,16 @@ >+2019-06-11 Alexey Shvayka <shvaikalesh@gmail.com> >+ >+ JSC should throw if proxy set returns falsish in strict mode context >+ https://bugs.webkit.org/show_bug.cgi?id=177398 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ RegExp.prototype methods throw if [[Set]] doesn't succeed. >+ Return `true` from Proxy's `set` traps to fix the tests. >+ >+ * stress/regexp-match-proxy.js: >+ * stress/regexp-replace-proxy.js: >+ > 2019-06-10 Yusuke Suzuki <ysuzuki@apple.com> > > [JSC] UnlinkedCodeBlock should be eventually jettisoned in VM mini mode >Index: JSTests/stress/regexp-match-proxy.js >=================================================================== >--- JSTests/stress/regexp-match-proxy.js (revision 246067) >+++ JSTests/stress/regexp-match-proxy.js (working copy) >@@ -53,6 +53,7 @@ let getSetProxyNullExec = new Proxy( > set.push(k); > getSet.push(k); > o[k] = v; >+ return true; > } > }); > >@@ -83,6 +84,7 @@ let getSetProxyMatches_s = new Proxy( > set.push(k); > getSet.push(k); > o[k] = v; >+ return true; > } > }); > >@@ -117,6 +119,7 @@ let getSetProxyMatches_tx_Greedy = new P > if (k.toString() == "lastIndex") > regExpGlobal_tx_Greedy.lastIndex = v; > o[k] = v; >+ return true; > } > }); > >@@ -152,6 +155,7 @@ let getSetProxyMatchesUnicode_digit_nonG > if (k.toString() == "lastIndex") > regExpGlobalUnicode_digit_nonGreedy.lastIndex = v; > o[k] = v; >+ return true; > } > }); > >Index: JSTests/stress/regexp-replace-proxy.js >=================================================================== >--- JSTests/stress/regexp-replace-proxy.js (revision 246067) >+++ JSTests/stress/regexp-replace-proxy.js (working copy) >@@ -50,6 +50,7 @@ let getSetProxyNullExec = new Proxy( > { > getSet.push(k); > o[k] = v; >+ return true; > } > }); > >@@ -78,6 +79,7 @@ let getSetProxyMatches_comma = new Proxy > { > getSet.push(k); > o[k] = v; >+ return true; > } > }); > >@@ -110,6 +112,7 @@ let getSetProxyReplace_phoneNumber = new > if (k.toString() == "lastIndex") > regExp_phoneNumber.lastIndex = v; > o[k] = v; >+ return true; > } > }); > >@@ -141,6 +144,7 @@ let getSetProxyReplaceUnicode_digit_nonG > if (k.toString() == "lastIndex") > regExpGlobalUnicode_digit_nonGreedy.lastIndex = v; > o[k] = v; >+ return true; > } > }); > >Index: Source/JavaScriptCore/ChangeLog >=================================================================== >--- Source/JavaScriptCore/ChangeLog (revision 246302) >+++ Source/JavaScriptCore/ChangeLog (working copy) >@@ -1,3 +1,16 @@ >+2019-06-11 Alexey Shvayka <shvaikalesh@gmail.com> >+ >+ JSC should throw if proxy set returns falsish in strict mode context >+ https://bugs.webkit.org/show_bug.cgi?id=177398 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Throw TypeError exception if Proxy's `set` trap returns falsy value. >+ (step 6.c of https://tc39.es/ecma262/#sec-putvalue) >+ >+ * runtime/ProxyObject.cpp: >+ (JSC::ProxyObject::put): Check result of performPut. >+ > 2019-06-10 Basuke Suzuki <Basuke.Suzuki@sony.com> > > [WinCairo] Remove build warning from RemoteInspector. >Index: Source/JavaScriptCore/runtime/ProxyObject.cpp >=================================================================== >--- Source/JavaScriptCore/runtime/ProxyObject.cpp (revision 246067) >+++ Source/JavaScriptCore/runtime/ProxyObject.cpp (working copy) >@@ -478,7 +478,12 @@ bool ProxyObject::put(JSCell* cell, Exec > JSObject* target = jsCast<JSObject*>(thisObject->target()); > return target->methodTable(vm)->put(target, exec, propertyName, value, slot); > }; >- return thisObject->performPut(exec, value, slot.thisValue(), propertyName, performDefaultPut); >+ auto scope = DECLARE_THROW_SCOPE(vm); >+ bool success = thisObject->performPut(exec, value, slot.thisValue(), propertyName, performDefaultPut); >+ RETURN_IF_EXCEPTION(scope, encodedJSValue()); >+ if (!success && slot.isStrictMode()) >+ throwVMTypeError(exec, scope, makeString("Proxy object's 'set' trap returned falsy value for property '", String(propertyName.uid()), "'")); >+ RELEASE_AND_RETURN(scope, success); > } > > bool ProxyObject::putByIndexCommon(ExecState* exec, JSValue thisValue, unsigned propertyName, JSValue putValue, bool shouldThrow)
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 177398
:
371809
|
371843
|
371847
|
371864
|
371877
|
371906