MicrosoftEdge / MicrosoftEdge/WebView2Feedback
Property named "length" for an object added with the AddHostObjectToScript method always returns 0 in javascript
Nobody has claimed this yet.
- Dominant language
- PowerShell
- Stars
- 526
- Forks
- 67
- PR merge metrics
- No merged PRs in 30d
Description
It seems that the "length" property is retrieved from the local javascript proxy object instead of the remote object, but a work-a-round is to do as follows:
// myobject name of object added AddHostObjectToScript
var myobject = chrome.webview.hostObjects.sync.myobject;
alert(myobject.length); // will always display 0
myobject._forceRemoteProperties.add("length"); // work-a-round
alert(myobject.length); // now shows the correct value for myobject.length
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the JavaScript example using AddHostObjectToScript and a host object with a length property. Compare direct length access with access after adding length to _forceRemoteProperties; done means the remote value is returned without the workaround.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- api, desktop
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100