[Greasemonkey] New GM_ function request.

Nikolas Coukouma lists at atrus.org
Tue Aug 23 17:28:01 EDT 2005


Adam Judson wrote:

>What are the chances of adding the following:
>
>to miscapis.js
>
>function GM_openDialog(location, title, settings, otherParams) {
> window.openDialog(location, title, settings, otherParams);
>}
>
>to dochandler.js
>...
> sandbox.GM_openDialog = GM_openDialog;
>...
>
>Basically I want to use GM to modify the page to open a chrome window
>when triggered by user events.
>e.g. form submition - trying to use my extension - tamperdata - to
>modify GET parameters.
>
>Adam Judson
>adamsplugins at gmail.com
>
You'll get a security error if you use window.open . If you didn't you
would have access to a chrome window and be able to twiddle it:
var chromeWin = window.open("chrome://browser/content/pref/pref.xul",
"Preferences", "");
var chromeDoc = chromeWin.document;
// Insert evil here

Your suggestion has two noticable features: it doesn't return a
reference to the window and it lets you pass in parameters. I will note
that GM_openInTab will let you open a chrome URL in a tab and you can
use the usual query string mechanism (but not complete objects).

The more general solution for "I want to use my extension from user
scripts" is to allow extensions to export functions to Greasemonkey.
I've filed a bug[1] about it, if you're interested.
[1] http://mozdev.org/bugs/show_bug.cgi?id=10969

-Nikolas


More information about the Greasemonkey mailing list