mozilla/addon-sdk — pull request #1571 by Gozala (2014-08-05 23:24:40+00:00)
Title: Draft a low level API hooks to allow more customisations.

This pull request is a attempt to respond to [a request of adding more API hooks](https://bugzilla.mozilla.org/show_bug.cgi?id=980410#c7) that would allow add-on's to do more customizations, but without SDK team commiting to a long term support.

Note that API hooks intentionally are not added to a high level API as that would require SDK team to support them in long term, which we are not ready to commit to. As an alternative hooks has being exposed under different low level modules that may break if devtools API break backwards compatibility.

To address current request following changes:

1. Provide an implementation of `require("sdk/view/core").viewFor(panel) -> HTMLIFrameElement` polymorphic function. Note that `viewFor` has a matching behavior for most high level APIs like windows, tabs, toolbars, etc.. so it seemed natural to provide implementation for panels as well. This is intended to address request of having `iframe` be passed to a `setup` hook. While in this case `iframe` itself isn't passed, it's still possible to obtain it in the `setup` hook calling `viewFor(panel)`.

2. Additional low level hook in form of `require("dev/panel/view").createView(panel, document) -> HTMLIFrameElement` polymorphic function has being added. This let's add-on authors take full control of the iframe creation (although some attributes are still enforced). This hook also let's add-on take control of injecting iframe to location different from designated node (To be fare I'm not fully supportive of this, if we need that I'd rather design API tailored for that), although by default it still will be added to a designated area in the UI. Given that this hook is invoked prior to `setup` I expect that final request of changing listener registration is also addressed.