[Greasemonkey] greasemonkey for secure data over insecure networks / sites

John Plsek gm at plsek.id.au
Tue Jul 19 12:25:00 EDT 2005


Aaron Boodman wrote:

>>Can anyone explain why the following changes in dochandler.js don't
>>break any of my scripts, one of which is a 93kByte monster, and they use
>>everything but registerMenuCommand ... or why it's not a good idea even
>>though it works?
>>
>>        var theDoc=this.contentWindow.document;
>>        var theWin=theDoc.defaultView.window;
>>        var toInject = ["(function(document, window, ",
>>                "GM_xmlhttpRequest, GM_registerMenuCommand, GM_setValue, ",
>>                "GM_getValue, GM_log, GM_openInTab)",
>>                " { ",
>>                getContents(getScriptChrome(script.filename)),
>>                "\n})(theDoc, theWin, xmlhttpRequest,
>>registerMenuCommand, setValue, getValue, ",
>>                "log, GM_openInTab);"
>>                ].join("");
>>    eval(toInject);
>>    
>>
>
>I'm afraid I don't even understand the question. What changes are you
>referring to?
>_______________________________________________
>Greasemonkey mailing list
>Greasemonkey at mozdev.org
>http://mozdev.org/mailman/listinfo/greasemonkey
>
>
>  
>
Geez, I'd have sent a diff, but I thought the difference between the 
above and

        var toInject = ["(function(",
                "GM_xmlhttpRequest, GM_registerMenuCommand, GM_setValue, ",
                "GM_getValue, GM_log, GM_openInTab) { delete 
window.GM_apis; ",
                getContents(getScriptChrome(script.filename)),
                "\n}).apply(this, window.GM_apis);"
                ].join("");

    this.contentWindow.GM_apis = [xmlhttpRequest,
                                  registerMenuCommand,
                                  setValue,
                                  getValue,
                                  log,
                                  GM_openInTab];
    
scriptElm.appendChild(this.contentWindow.document.createTextNode(toInject));

    this.contentWindow.document.body.appendChild(scriptElm);
    this.contentWindow.document.body.removeChild(scriptElm);


was quite obvious

John


More information about the Greasemonkey mailing list