Re: [PR] Add SpiderMonkey backward compatibility [couchdb]
jiahuili430 commented on code in PR #5364: URL: https://github.com/apache/couchdb/pull/5364#discussion_r1895884319 ## share/server/util.js: ## @@ -116,7 +116,14 @@ var Couch = { "Expression does not eval to a function. (" + source.toString() + ")"]); }; }, - recursivelySeal : deepFreeze + recursivelySeal: function (obj) { Review Comment: Tried the following 2 methods but get same errors in `chttpd_view_test` when using `SpiderMonkey 1.8.5`. ```diff recursivelySeal: function (obj) { -seal(obj); +deepFreeze(obj); for (var propname in obj) { if (typeof obj[propname] == "object") { arguments.callee(obj[propname]); } } }, ``` ```diff + recursivelySeal: deepFreeze }; ... function deepFreeze(object) { ... // Freeze properties before freezing self for (var i in propNames) { const value = object[propNames[i]]; - if ((value && typeof value === "object") || typeof value === "function") { + if (value && typeof value == "object") { deepFreeze(value); } } } ``` Error message: ``` [2024-12-23T15:18:42.050Z] module 'chttpd_view_test' [2024-12-23T15:18:42.050Z] chttpd view tests [2024-12-23T15:18:45.302Z] chttpd_view_test:74: -view_test_/0-fun-30- (t_view_with_queries_keys)...*failed* [2024-12-23T15:18:45.302Z] in function chttpd_view_test:t_view_with_queries_keys/1 (test/eunit/chttpd_view_test.erl, line 132) [2024-12-23T15:18:45.302Z] in call from eunit_test:run_testfun/1 (eunit_test.erl, line 71) [2024-12-23T15:18:45.302Z] in call from eunit_proc:run_test/1 (eunit_proc.erl, line 543) [2024-12-23T15:18:45.302Z] in call from eunit_proc:with_timeout/3 (eunit_proc.erl, line 368) [2024-12-23T15:18:45.302Z] in call from eunit_proc:handle_test/2 (eunit_proc.erl, line 526) [2024-12-23T15:18:45.302Z] in call from eunit_proc:tests_inorder/3 (eunit_proc.erl, line 468) [2024-12-23T15:18:45.302Z] in call from eunit_proc:with_timeout/3 (eunit_proc.erl, line 358) [2024-12-23T15:18:45.302Z] in call from eunit_proc:run_group/2 (eunit_proc.erl, line 582) [2024-12-23T15:18:45.302Z] **error:{assertMatch,[{module,chttpd_view_test}, [2024-12-23T15:18:45.302Z] {line,132}, [2024-12-23T15:18:45.302Z] {expression,"Res"}, [2024-12-23T15:18:45.302Z] {pattern,"# { << \"results\" >> := [ # { << \"total_rows\" >> := 3 , << \"offset\" >> := 1 , << \"rows\" >> := [ # { << \"id\" >> := << \"a\" >> } , # { << \"id\" >> := << \"c\" >> } ] } ] }"}, [2024-12-23T15:18:45.302Z] {value,#{<<"error">> => <<"ReferenceError">>, [2024-12-23T15:18:45.302Z]<<"reason">> => [2024-12-23T15:18:45.302Z] <<"{[{<<\"message\">>,<<\"Reflect is not d"...>>}}]} [2024-12-23T15:18:45.302Z] output:<<"">> ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@couchdb.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
Re: [PR] Add SpiderMonkey backward compatibility [couchdb]
jiahuili430 commented on code in PR #5364: URL: https://github.com/apache/couchdb/pull/5364#discussion_r1895871637 ## share/server/util.js: ## @@ -116,7 +116,14 @@ var Couch = { "Expression does not eval to a function. (" + source.toString() + ")"]); }; }, - recursivelySeal : deepFreeze + recursivelySeal: function (obj) { +seal(obj); +for (var propname in obj) { Review Comment: `propname` is the index, if the element type is `object`, this `function(obj) { seal(obj); ... }` will be called again with the new argument `obj = obj[propname]`. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@couchdb.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
Re: [PR] Add SpiderMonkey backward compatibility [couchdb]
janl commented on code in PR #5364: URL: https://github.com/apache/couchdb/pull/5364#discussion_r1895611996 ## share/server/util.js: ## @@ -116,7 +116,14 @@ var Couch = { "Expression does not eval to a function. (" + source.toString() + ")"]); }; }, - recursivelySeal : deepFreeze + recursivelySeal: function (obj) { Review Comment: this effectively bypasses the new deepFreeze() function we introduced for this. Can’t we do duck-typing here and call deepFreeze if it is available and seal if it isn’t? ## share/server/util.js: ## @@ -116,7 +116,14 @@ var Couch = { "Expression does not eval to a function. (" + source.toString() + ")"]); }; }, - recursivelySeal : deepFreeze + recursivelySeal: function (obj) { +seal(obj); +for (var propname in obj) { Review Comment: What does this for-loop do? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@couchdb.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
Re: [PR] Add SpiderMonkey backward compatibility [couchdb]
jiahuili430 merged PR #5364: URL: https://github.com/apache/couchdb/pull/5364 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@couchdb.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
Re: [PR] Add SpiderMonkey backward compatibility [couchdb]
nickva commented on PR #5364: URL: https://github.com/apache/couchdb/pull/5364#issuecomment-2546178864 Oops, it does look like we broke SM 1.8.5 support. It's still one of the fastest SM engine versions out of the box, especially when using custom reduces. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@couchdb.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
Re: [PR] Add SpiderMonkey backward compatibility [couchdb]
jiahuili430 commented on PR #5364: URL: https://github.com/apache/couchdb/pull/5364#issuecomment-2542666467 Tested in the [`jenkins-sm-backward-compatibility`](https://github.com/apache/couchdb/compare/main...jenkins-sm-backward-compatibility) branch.  -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@couchdb.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[PR] Add SpiderMonkey backward compatibility [couchdb]
jiahuili430 opened a new pull request, #5364: URL: https://github.com/apache/couchdb/pull/5364 ## Overview - Using `for in` to fix syntax error when using SpiderMonkey 1.8.5 ``` [2024-12-12T22:46:32.210Z] Failed to compile script. [2024-12-12T22:46:32.210Z] SyntaxError: missing ; after for-loop initializer [2024-12-12T22:46:32.210Z] Stacktrace: [2024-12-12T22:46:32.210Z] @:0 ``` - Add backward compatibility ## Testing recommendations ## Related Issues or Pull Requests ## Checklist - [ ] Code is written and works correctly - [ ] Changes are covered by tests - [ ] Any new configurable parameters are documented in `rel/overlay/etc/default.ini` - [ ] Documentation changes were made in the `src/docs` folder - [ ] Documentation changes were backported (separated PR) to affected branches -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@couchdb.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org