Yes, this would work. The problem with this approach is that it assumes that javascript is enabled in the page, which in my case is not true. Fortunately I've found a workaround, see [1].
Thanks again for the pointing to the Ubiquity code of sandboxfactory.js. Honestly, I still don't quite understand the reason, but I'll try harder :-) [1] http://groups.google.com/group/greasemonkey-dev/msg/4e57bda147f8b23c On Tue, Dec 29, 2009 at 1:17 PM, satyr <[email protected]> wrote: >> If you do that, you'll see in the error console: >> >> Error: Greasemonkey access violation: unsafeWindow cannot call GM_setValue. > > I see. I guess you'd have to work around it somehow, like: > > function cmd_manageUserScriptCommand(){ > var $s = $('<script>'); > $s[0].innerHTML = <![CDATA[(function({Utils}){ > var mi = Utils.currentChromeWindow.document.querySelector( > '#userscript-commands-sb > menupopup > menuitem'); > mi && mi._commandFunc(); > })(Components.utils.import('resource://ubiquity/modules/utils.js', null))]]>; > $s.appendTo('body').remove(); > } > > Ubiquity scripts are indeed "unsafe," so we can't really complain =p > > >> I am curious about why >> Ubiquity scripts are "file:" urls and not "chrome:" > > From line 89-91 of sandboxfactory.js: > > // We need to prefix any source code URI's with a known > // "protected" file URI so that XPConnect wrappers are implicitly > // made for them. -- You received this message because you are subscribed to the Google Groups "ubiquity-firefox" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/ubiquity-firefox?hl=en.
