Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-86323

Iterating over Properties of a Proxied Object does not work

XMLWordPrintable

    • dd740d6b3469448dc1fd31c1742781e923e9f274 (qt/qtdeclarative/dev) 90307d688e8485c143ba291685aa847fb571f6fb (qt/qtdeclarative/6.0) 5a7aa7881fa2c7abffb3d34a6b642fe4efcadbf4 (qt/qtdeclarative/5.15)

      I have the need to wrap an object in a JS proxy. The proxy handler must be implemented in C++. The target "object" is empty and acts just as a dummy. More important is the functionality of the proxy to intercept property accesses and to re-route them to own logic.

      When wrapping an arbitrary object in a Javascript proxy, it is not possible to iterate over the proxied properties. I see that ownKeys() is called on the handler, but no further action is taken.

      Iterating over the object with a for..of loop requests Symbol.iterator which I have no idea of how to produce that in C++.

        1. image-2020-12-01-12-17-43-779.png
          29 kB
          Richard Weickelt
        2. image-2020-12-01-12-17-51-425.png
          29 kB
          Richard Weickelt
        3. QTBUG-86323.zip
          5 kB
          Richard Weickelt
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            fabiankosmale Fabian Kosmale
            rweickelt Richard Weickelt
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes