-
Notifications
You must be signed in to change notification settings - Fork 339
util: util.types.isProxy does not work in Node-ChakraCore #488
Comments
Merge pull request #4806 from rhuanjl:JsGetProxyProperties Responding to issue #950 This PR: 1. Adds a JavascriptProxy::IsRevoked method to the Javascript proxy class (necessary for the below) 2. Adds a JsGetProxyProperties API to Jsrt which can: a) check if an object is a proxy -> set a provided bool to true/false b) if it is a proxy check if it's revoked c) if it is a revoked proxy set provided target and handler references to nullptr d) if it is a proxy that is not revoked provide references to it's target and handler 3. Tracks the same API through to WScriptJsrt in ch 4. Adds a test that uses the ch implementation (Targeting 1.9 as this will assist with an issue in node-chakracore nodejs/node-chakracore#488 ) **CC:** @jackhorton @kfarnung @dilijev
…fixes #950 Merge pull request #4806 from rhuanjl:JsGetProxyProperties Responding to issue #950 This PR: 1. Adds a JavascriptProxy::IsRevoked method to the Javascript proxy class (necessary for the below) 2. Adds a JsGetProxyProperties API to Jsrt which can: a) check if an object is a proxy -> set a provided bool to true/false b) if it is a proxy check if it's revoked c) if it is a revoked proxy set provided target and handler references to nullptr d) if it is a proxy that is not revoked provide references to it's target and handler 3. Tracks the same API through to WScriptJsrt in ch 4. Adds a test that uses the ch implementation (Targeting 1.9 as this will assist with an issue in node-chakracore nodejs/node-chakracore#488 ) **CC:** @jackhorton @kfarnung @dilijev
[MERGE #4806 @rhuanjl] Implement JsGetProxyProperties API fixes #950 Merge pull request #4806 from rhuanjl:JsGetProxyProperties Responding to issue #950 This PR: 1. Adds a JavascriptProxy::IsRevoked method to the Javascript proxy class (necessary for the below) 2. Adds a JsGetProxyProperties API to Jsrt which can: a) check if an object is a proxy -> set a provided bool to true/false b) if it is a proxy check if it's revoked c) if it is a revoked proxy set provided target and handler references to nullptr d) if it is a proxy that is not revoked provide references to it's target and handler 3. Tracks the same API through to WScriptJsrt in ch 4. Adds a test that uses the ch implementation (Targeting 1.9 as this will assist with an issue in node-chakracore #488 ) **CC:** @jackhorton @kfarnung @dilijev Reviewed-By: chakrabot <chakrabot@users.noreply.github.com>
[1.9>master] [MERGE #4806 @rhuanjl] Implement JsGetProxyProperties API fixes #950 Merge pull request #4806 from rhuanjl:JsGetProxyProperties Responding to issue #950 This PR: 1. Adds a JavascriptProxy::IsRevoked method to the Javascript proxy class (necessary for the below) 2. Adds a JsGetProxyProperties API to Jsrt which can: a) check if an object is a proxy -> set a provided bool to true/false b) if it is a proxy check if it's revoked c) if it is a revoked proxy set provided target and handler references to nullptr d) if it is a proxy that is not revoked provide references to it's target and handler 3. Tracks the same API through to WScriptJsrt in ch 4. Adds a test that uses the ch implementation (Targeting 1.9 as this will assist with an issue in node-chakracore #488 ) **CC:** @jackhorton @kfarnung @dilijev Reviewed-By: chakrabot <chakrabot@users.noreply.github.com>
[MERGE #4806 @rhuanjl] Implement JsGetProxyProperties API fixes #950 Merge pull request #4806 from rhuanjl:JsGetProxyProperties Responding to issue #950 This PR: 1. Adds a JavascriptProxy::IsRevoked method to the Javascript proxy class (necessary for the below) 2. Adds a JsGetProxyProperties API to Jsrt which can: a) check if an object is a proxy -> set a provided bool to true/false b) if it is a proxy check if it's revoked c) if it is a revoked proxy set provided target and handler references to nullptr d) if it is a proxy that is not revoked provide references to it's target and handler 3. Tracks the same API through to WScriptJsrt in ch 4. Adds a test that uses the ch implementation (Targeting 1.9 as this will assist with an issue in node-chakracore #488 ) **CC:** @jackhorton @kfarnung @dilijev Reviewed-By: chakrabot <chakrabot@users.noreply.github.com>
Is there a reason not to support util.types.isProxy? The JsGetProxyProperties api I added to ChakraCore should enable supporting it. Unsure what the policy for contributing to node-chakracore - but I could try and make a PR to implement this if wanted? |
No reason not to support it, we just hadn't gotten the chance to implement it yet. The contribution policy is the same as upstream node, feel free to open a PR. |
@kfarnung Thanks - ok I'll give it a try and I'll see if I can do #523 at the same time. One question though, is there an existing mechanism for exposing a native function to chakra_shim.js without exposing it globally? (I can't currently find such in the source tree though I may just not be looking closely enough) |
I don't think there is. With that being said, isProxy doesn't have to be in chakra_shim.js, it can be implemented in native (I think most of the other basic types are done in native, and only complex types like MapIterator and SetIterator are in chakra_shim.js). In general, the JS file is a grab bag of "we don't have a native API to do this, but we know how to do it in JS, so do it in JS". Now that we have a native API, the JS version shouldn't be necessary. There will be a relevant change in v8value.cc to remove |
Ok so I've made working fixes for this and util.inspect's showProxy flag. But trying to run e.g.s
I can put an if (!common.isChakraEngine) around the ESModule test in test-util-types.js but unsure on the other ones. |
|
I am also surprised to hear that |
On Linux, we use |
Implement value::IsProxy(), Proxy::GetTarget() and Proxy::GetHandler() in chakrashim. This enables util.types.isProxy() and util.inspect() with the showProxy flag as true to function correctly in node-chakracore. Also enable related tests for node-chakracore: parallel/test-util-types.js parallel/test-util-inspect.js fixes: nodejs#488 fixes: nodejs#523
Implement value::IsProxy(), Proxy::GetTarget() and Proxy::GetHandler() in chakrashim. This enables util.types.isProxy() and util.inspect() with the showProxy flag as true to function correctly in node-chakracore. Also enable related tests for node-chakracore: * parallel/test-util-types.js * parallel/test-util-inspect.js Fixes: nodejs#488 Fixes: nodejs#523 PR-URL: nodejs#525 Reviewed-By: Kyle Farnung <kfarnung@microsoft.com> Reviewed-By: Jack Horton <Jack.Horton@microsoft.com>
Implement value::IsProxy(), Proxy::GetTarget() and Proxy::GetHandler() in chakrashim. This enables util.types.isProxy() and util.inspect() with the showProxy flag as true to function correctly in node-chakracore. Also enable related tests for node-chakracore: * parallel/test-util-types.js * parallel/test-util-inspect.js Fixes: nodejs#488 Fixes: nodejs#523 PR-URL: nodejs#525 Reviewed-By: Kyle Farnung <kfarnung@microsoft.com> Reviewed-By: Jack Horton <Jack.Horton@microsoft.com>
Causes
test/parallel/test-util-types
to fail.The text was updated successfully, but these errors were encountered: