On Monday, April 27, 2015 at 5:40:27 PM UTC+2, Виноградов Сергей wrote:
> In frame script (with E10S) not have "require" function. And not have SDK.
Not entirely true, see
http://work.erikvold.com/jetpack-pro-tip/2015/04/03/using-toolkit-require.html
This works in frame scripts, even though many of the modules you require() are gonna break there or behave unexpectedly because they're still subject to
https://developer.mozilla.org/en-US/Firefox/Multiprocess_Firefox/Limitations_of_frame_scripts
For instance,
const { require } = Components.utils.import("resource://gre/modules/commonjs/toolkit/require.js", {});
let tab = require("sdk/tabs/utils").getTabForContentWindow(content)
"works" in a frame script, but tab is null because of the child/parent barrier.
> And window object impossible send in message to chrome code.
> Is there a replacement for require("sdk/tabs/utils").getTabForContentWindow ?
The "target" property of the object passed into the message handler on the chrome process side is the XUL <browser> receiving the message, from which you can get to the tab you're looking for.
> P.S. I have the impression that my extension, written in the SDK will now have to be entirely rewritten without it.
Quite the opposite: the plan is to make easier and easier for SDK add-ons to work without modifications or using new high-level SDK-native wrappers around the MessageManager API, just like many other low-level XPCOM details are already shielded by the SDK.
> Is it not possible to somehow enable the SDK in a frame script?
As outlined above, it is possible importing and invoking SDK modules, but there's no guarantee for them to work as expected. Ideally frame scripts should be regarded as a transient necessity for complex E10s-compatible SDK add-ons, set to eventually go away as the SDK evolves.