mozilla / positron

a experimental, Electron-compatible runtime on top of Gecko
Other
562 stars 64 forks source link

changing src property on <webview> doesn't trigger attributeChangedCallback #65

Closed mykmelez closed 8 years ago

mykmelez commented 8 years ago

When you press the Go button in the webview/browser sample app, the app sets the src property of the <webview> element, which triggers a call to the attributeChangedCallback on that element in Electron, but doesn't trigger a call to that function in Positron. We should figure out if this is a bug in Positron or a difference in the behavior of Gecko vis-a-vis Blink when modifying properties of a custom element.

mykmelez commented 8 years ago

The WebViewAttribute class in Electron has a defineProperty method that defines a property for the attribute, and its setter sets the attribute. But it looks like that property definition is invisible to the code running in the page. Investigating…

mykmelez commented 8 years ago

I landed a workaround on my webview-element branch: https://github.com/mykmelez/positron/commit/8b0134dff78ba866e53e03a00e04cb6c064bbac7. It unwraps the element before setting the property on it.

But when the property's setter is called, and it calls setAttribute on the <webview> node, which triggers a mutation event, the event handler for that event fails with Buffer is undefined in remote.js line 38.

mykmelez commented 8 years ago

Once #66 was resolved, it resolved this problem as well, so I was able to undo the workaround I had landed on the webview-element branch. Thus this is now resolved.