RESOLVED FIXED 154314
Implement Proxy.[[GetOwnProperty]]
https://bugs.webkit.org/show_bug.cgi?id=154314
Summary Implement Proxy.[[GetOwnProperty]]
Saam Barati
Reported 2016-02-16 15:22:51 PST
...
Attachments
it begins (93.01 KB, patch)
2016-02-17 13:02 PST, Saam Barati
no flags
patch (29.54 KB, patch)
2016-02-17 19:06 PST, Saam Barati
fpizlo: review+
follow up fix (4.05 KB, patch)
2016-02-18 13:48 PST, Saam Barati
fpizlo: review+
Saam Barati
Comment 1 2016-02-17 13:02:55 PST
Created attachment 271582 [details] it begins this patch still has the contents of the [[Get]] patch until it lands
Saam Barati
Comment 2 2016-02-17 14:33:19 PST
*** Bug 154353 has been marked as a duplicate of this bug. ***
Saam Barati
Comment 3 2016-02-17 19:06:01 PST
WebKit Commit Bot
Comment 4 2016-02-17 19:07:43 PST
Attachment 271616 [details] did not pass style-queue: ERROR: Source/JavaScriptCore/runtime/JSObject.h:720: The parameter name "exec" adds no information, so it should be removed. [readability/parameter_name] [5] ERROR: Source/JavaScriptCore/runtime/JSObject.h:720: The parameter name "callData" adds no information, so it should be removed. [readability/parameter_name] [5] ERROR: Source/JavaScriptCore/runtime/JSObject.h:720: The parameter name "callType" adds no information, so it should be removed. [readability/parameter_name] [5] ERROR: Source/JavaScriptCore/runtime/JSObject.h:720: The parameter name "ident" adds no information, so it should be removed. [readability/parameter_name] [5] ERROR: Source/JavaScriptCore/runtime/JSObject.h:1477: The parameter name "descriptor" adds no information, so it should be removed. [readability/parameter_name] [5] Total errors found: 5 in 9 files If any of these errors are false positives, please file a bug against check-webkit-style.
Saam Barati
Comment 5 2016-02-17 19:08:52 PST
Comment on attachment 271616 [details] patch View in context: https://bugs.webkit.org/attachment.cgi?id=271616&action=review > Source/JavaScriptCore/runtime/FunctionPrototype.cpp:167 > + if (targetObject->hasOwnProperty(exec, exec->propertyNames().length)) { > + if (exec->hadException()) > + return JSValue::encode(jsUndefined()); > + > // a. Let L be the length property of Target minus the length of A. > // b. Set the length own property of F to either 0 or L, whichever is larger. > - unsigned targetLength = (unsigned)target.get(exec, exec->propertyNames().length).asNumber(); > - if (targetLength > numBoundArgs) > - length = targetLength - numBoundArgs; > + JSValue lengthValue = target.get(exec, exec->propertyNames().length); > + if (lengthValue.isNumber()) { > + unsigned targetLength = (unsigned)lengthValue.asNumber(); > + if (targetLength > numBoundArgs) > + length = targetLength - numBoundArgs; > + } I added this here because it's wrong w.r.t to the spec. There is a kangax test that tests this in combination with Proxy.[[GetOwnProperty]]. To make us pass that test, I need to also implement Proxy.[[Call]]. I can wait or open another bug for this if anybody objects about having it in this patch.
Saam Barati
Comment 6 2016-02-18 12:29:51 PST
Saam Barati
Comment 7 2016-02-18 13:48:18 PST
Created attachment 271689 [details] follow up fix
Saam Barati
Comment 8 2016-02-18 13:56:30 PST
Darin Adler
Comment 9 2016-02-23 13:30:24 PST
Comment on attachment 271616 [details] patch View in context: https://bugs.webkit.org/attachment.cgi?id=271616&action=review > Source/JavaScriptCore/runtime/JSObject.cpp:2942 > + if (method.isUndefined() || method.isNull()) > + return jsUndefined(); > + > + if (!method.isCell()) { > + throwVMTypeError(exec, errorMessage); > + return jsUndefined(); > + } I would have written: if (!method.isCell()) { if (method.isUndefinedOrNull()) return jsUndefined(); return throwVMTypeError(exec, errorMessage); } Having one less branch seems slightly more elegant to me.
Saam Barati
Comment 10 2016-02-23 13:44:01 PST
Comment on attachment 271616 [details] patch View in context: https://bugs.webkit.org/attachment.cgi?id=271616&action=review >> Source/JavaScriptCore/runtime/FunctionPrototype.cpp:167 >> + if (targetObject->hasOwnProperty(exec, exec->propertyNames().length)) { >> + if (exec->hadException()) >> + return JSValue::encode(jsUndefined()); >> + >> // a. Let L be the length property of Target minus the length of A. >> // b. Set the length own property of F to either 0 or L, whichever is larger. >> - unsigned targetLength = (unsigned)target.get(exec, exec->propertyNames().length).asNumber(); >> - if (targetLength > numBoundArgs) >> - length = targetLength - numBoundArgs; >> + JSValue lengthValue = target.get(exec, exec->propertyNames().length); >> + if (lengthValue.isNumber()) { >> + unsigned targetLength = (unsigned)lengthValue.asNumber(); >> + if (targetLength > numBoundArgs) >> + length = targetLength - numBoundArgs; >> + } > > I added this here because it's wrong w.r.t to the spec. > There is a kangax test that tests this in combination with Proxy.[[GetOwnProperty]]. > To make us pass that test, I need to also implement Proxy.[[Call]]. I can wait > or open another bug for this if anybody objects about having it in this patch. I added this here because it's wrong w.r.t to the spec. There is a kangax test that tests this in combination with Proxy.[[GetOwnProperty]]. To make us pass that test, I need to also implement Proxy.[[Call]]. I can wait or open another bug for this if anybody objects about having it in this patch. >> Source/JavaScriptCore/runtime/JSObject.cpp:2942 >> + } > > I would have written: > > if (!method.isCell()) { > if (method.isUndefinedOrNull()) > return jsUndefined(); > return throwVMTypeError(exec, errorMessage); > } > > Having one less branch seems slightly more elegant to me. I agree. I'll upload a fix.
Saam Barati
Comment 11 2016-02-23 13:44:44 PST
(In reply to comment #10) > Comment on attachment 271616 [details] > patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=271616&action=review > > >> Source/JavaScriptCore/runtime/FunctionPrototype.cpp:167 > >> + if (targetObject->hasOwnProperty(exec, exec->propertyNames().length)) { > >> + if (exec->hadException()) > >> + return JSValue::encode(jsUndefined()); > >> + > >> // a. Let L be the length property of Target minus the length of A. > >> // b. Set the length own property of F to either 0 or L, whichever is larger. > >> - unsigned targetLength = (unsigned)target.get(exec, exec->propertyNames().length).asNumber(); > >> - if (targetLength > numBoundArgs) > >> - length = targetLength - numBoundArgs; > >> + JSValue lengthValue = target.get(exec, exec->propertyNames().length); > >> + if (lengthValue.isNumber()) { > >> + unsigned targetLength = (unsigned)lengthValue.asNumber(); > >> + if (targetLength > numBoundArgs) > >> + length = targetLength - numBoundArgs; > >> + } > > > > I added this here because it's wrong w.r.t to the spec. > > There is a kangax test that tests this in combination with Proxy.[[GetOwnProperty]]. > > To make us pass that test, I need to also implement Proxy.[[Call]]. I can wait > > or open another bug for this if anybody objects about having it in this patch. > > I added this here because it's wrong w.r.t to the spec. > There is a kangax test that tests this in combination with > Proxy.[[GetOwnProperty]]. > To make us pass that test, I need to also implement Proxy.[[Call]]. I can > wait > or open another bug for this if anybody objects about having it in this > patch. I definitely didn't mean to post this comment again. I think bugzilla cached my comment from before.
Saam Barati
Comment 12 2016-02-23 13:45:10 PST
(In reply to comment #10) > Comment on attachment 271616 [details] > patch > >> Source/JavaScriptCore/runtime/JSObject.cpp:2942 > >> + } > > > > I would have written: > > > > if (!method.isCell()) { > > if (method.isUndefinedOrNull()) > > return jsUndefined(); > > return throwVMTypeError(exec, errorMessage); > > } > > > > Having one less branch seems slightly more elegant to me. > > I agree. > I'll upload a fix. the bug for the fix: https://bugs.webkit.org/show_bug.cgi?id=154603
Note You need to log in before you can comment on or make changes to this bug.