{"action":"created","issue":{"url":"https://api.github.com/repos/mozilla/browser.html/issues/566","labels_url":"https://api.github.com/repos/mozilla/browser.html/issues/566/labels{/name}","comments_url":"https://api.github.com/repos/mozilla/browser.html/issues/566/comments","events_url":"https://api.github.com/repos/mozilla/browser.html/issues/566/events","html_url":"https://github.com/mozilla/browser.html/issues/566","id":99719593,"number":566,"title":"Pass config handle to mozbrowseropen event instead of frameElement ","user":{"login":"Gozala","id":21236,"avatar_url":"https://avatars.githubusercontent.com/u/21236?v=3","gravatar_id":"","url":"https://api.github.com/users/Gozala","html_url":"https://github.com/Gozala","followers_url":"https://api.github.com/users/Gozala/followers","following_url":"https://api.github.com/users/Gozala/following{/other_user}","gists_url":"https://api.github.com/users/Gozala/gists{/gist_id}","starred_url":"https://api.github.com/users/Gozala/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Gozala/subscriptions","organizations_url":"https://api.github.com/users/Gozala/orgs","repos_url":"https://api.github.com/users/Gozala/repos","events_url":"https://api.github.com/users/Gozala/events{/privacy}","received_events_url":"https://api.github.com/users/Gozala/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-08-07T19:56:05Z","updated_at":"2015-08-14T00:05:15Z","closed_at":null,"body":"Currently `window.open()` causes `mozbrowseropen` event on an iframe with `event.detial.frameElement` that can't be used after animation frame (see #565). Attempt to workaround that limitation by stashing it to `document.head` and then reparenting on animation frame into appropriate location causes a crash (see #564).\r\n\r\nTruth is this API is not only buggy but also really unfortunate as it does not play well with a popular libraries like react and is quite limiting as it is. As far as I can tell only reason to pass an iframe element with an event is to attach a specific configuration to it so that opener can remain connected to it. It would be much better if runtime stored that configuration / internal iframe implementation internally and exposed to a user a unique id for it that could be used by an embedder to pass that configuration to an iframe by assigning attribute with that id. In fact Electron seems to already do exactly that by passing `event.frameName` (see http://electron.atom.io/docs/v0.30.0/api/web-view-tag/#new-window)"},"comment":{"url":"https://api.github.com/repos/mozilla/browser.html/issues/comments/130894067","html_url":"https://github.com/mozilla/browser.html/issues/566#issuecomment-130894067","issue_url":"https://api.github.com/repos/mozilla/browser.html/issues/566","id":130894067,"user":{"login":"Gozala","id":21236,"avatar_url":"https://avatars.githubusercontent.com/u/21236?v=3","gravatar_id":"","url":"https://api.github.com/users/Gozala","html_url":"https://github.com/Gozala","followers_url":"https://api.github.com/users/Gozala/followers","following_url":"https://api.github.com/users/Gozala/following{/other_user}","gists_url":"https://api.github.com/users/Gozala/gists{/gist_id}","starred_url":"https://api.github.com/users/Gozala/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Gozala/subscriptions","organizations_url":"https://api.github.com/users/Gozala/orgs","repos_url":"https://api.github.com/users/Gozala/repos","events_url":"https://api.github.com/users/Gozala/events{/privacy}","received_events_url":"https://api.github.com/users/Gozala/received_events","type":"User","site_admin":false},"created_at":"2015-08-14T00:05:15Z","updated_at":"2015-08-14T00:05:15Z","body":"> Let's forget about the sync issue (discussed in #565) and let's focus on the id-over-frame proposal.\r\n\r\nWell it's hard to discuss the issues if we ignore some of them.\r\n\r\n\r\n> Gaia relies on this API, and it seems to work well for them.\r\n\r\nThat does not mean that API is sane.\r\n\r\n> What's special about us that makes it difficult to use?\r\n\r\n1. Well one thing is that our update loop (a.k.a as event handling loop) is independent of a render loop, that is because we re-render only on animation frame. Such an API forces us to make an exceptions (that can cause race conditions) and re-render in the same turn of event loop.\r\n\r\n2. Libraries like react, ember, angular all provide higher level abstraction over DOM, in other words application developer writes application logic and library deals with DOM manipulations. This API makes it difficult to use such libraries as you are forced to take over the DOM ownership and deal with an updates yourself.\r\n\r\n3. More important problem is this API is a hack that was shoehorned onto iframes that were never designed for this. There is no single standard API that emits events providing you with an element that you have to use. That is because HTML is supposed to be declarative (even though it's far from it) and this is just so far from it on so many levels.\r\n\r\n4. Special objects usually tend to be an indication of an unfortunate API. This is good example why is this iframe so special and different from the other iframes. Why can't I create a such an iframe ? The only reason is that two iframes need to be connected, so instead of solving problem of how do we expose an API to create connected iframes we ended up with special iframes that require special treatment otherwise they break. "}}