0

I want to access the simple-prefs module from a XUL settings dialog. My code looks as follows.

var WINDOW = Cc["@mozilla.org/embedcomp/window-watcher;1"].getService(Ci.nsIWindowWatcher);
var mainWindow = MEDIATOR.getMostRecentWindow(null);

var pref = require("simple-prefs");
var win = WINDOW.openWindow(mainWindow, "chrome://myextension/content/settings.xul", "aboutMyExtension", "chrome,centerscreen,modal,dependant,dialog", pref);

As shown above, i give the simple prefs reference as an argument to the xul window. In the xul page, I try the following to get the simple-prefs reference.

<script type="application/x-javascript" src="chrome://global/content/XPCNativeWrapper.js"/>
... 
XPCNativeWrapper.unwrap(window.arguments[0])

window.arguments[0] is a [xpconnect wrapped nsISupports], but the unwrap() returns a [xpconnect wrapped nsISupports] instead of actually unwrapping it.

So, how do I access the simple-prefs module from the xul dialog?

4

1 回答 1

0
于 2013-01-05T00:24:36.963 回答