Skip to content

fix: js/html perf tests#25961

Merged
asmorkalov merged 1 commit intoopencv:4.xfrom
gblikas:gblikas_4.x_ts_js
Jul 30, 2024
Merged

fix: js/html perf tests#25961
asmorkalov merged 1 commit intoopencv:4.xfrom
gblikas:gblikas_4.x_ts_js

Conversation

@gblikas
Copy link
Copy Markdown
Contributor

@gblikas gblikas commented Jul 26, 2024

modules/js/perf/perf_helpfunc.js and target tests all contain const isNodeJs, leading to re-definition when using associated *.html files:

	//... script above
     <script src="https://cdnjs.cloudflare.com/ajax/libs/benchmark/2.1.4/benchmark.js"></script>$
     <script src="../../opencv.js" type="text/javascript"></script>$
     <script src="../base.js"></script>$
     <script src="../perf_helpfunc.js"></script>$
     <script src="./perf_gaussianBlur.js"></script>$
   </body>$
</html>$

perf_helpfunc.js was imported (which globally defined const isNodeJs) and then perf_gussianBlur.js was imported (which globally defined const isNodeJs). Changing them to var resolves scoping issues when running in browser, while maintaining nodejs support.

Special thanks to https://github.com/youar for supporting this work; please inform if applying a copyright-header is appropriate attribution.

Pull Request Readiness Checklist

See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request

  • I agree to contribute to the project under Apache 2 License.
  • To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV
  • The PR is proposed to the proper branch
  • There is a reference to the original bug report and related work
  • There is accuracy test, performance test and test data in opencv_extra repository, if applicable
    Patch to opencv_extra has the same branch name.
  • The feature is well documented and sample code can be built with the project CMake
force_builders=Custom
build_image:Docs=docs-js
build_image:Custom=javascript
buildworker:Custom=linux-1,linux-4,linux-f1

modules/js/perf/perf_helpfunc.js and target tests, e.g. perf_gaussianBlur.js contained "const isNodeJs", leading to re-definition when using associated *.html files.
@asmorkalov asmorkalov self-requested a review July 29, 2024 17:17
@asmorkalov asmorkalov added this to the 4.11.0 milestone Jul 29, 2024
@asmorkalov asmorkalov merged commit 89fff35 into opencv:4.x Jul 30, 2024
@gblikas gblikas deleted the gblikas_4.x_ts_js branch July 30, 2024 17:24
@asmorkalov asmorkalov mentioned this pull request Aug 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants