[Greasemonkey] Re: Gm Bug in Firefox 1.5.0.4

Vectorspace vectorspace at ntlworld.com
Wed Jun 7 10:07:58 EDT 2006


I have a script that does the same thing (only the config dialog is 
launched from a menu item) and I used to do it your way, and I think I 
remember it working (as recently as FF1.5.0.1, maybe more recently).

But since my script runs on all pages, it occurred to me that somebody 
could fake the checks I made to make sure it was the config window the 
script was running on and feed my script false settings changes, so I 
modified it to reference the page directly:

//open settings window
settingsHTML="<html><head>..........blah blah........<//head><//html>"   
//html source code
settingsWindow=window.open(blah blah)        //open popup
settingsWindow.document.write(settingsHTML)    //write html source to page
settingsWindow.document.getElementById(blah blah) //access elements in 
the popup page.

It actually turned out simpler.

Aaron Boodman wrote:
> Hmm.. sounds like something that should be reported to mozilla as a bug.
>
> On the other hand, there's no reason to do all this. You can just
> manipulate the document (theWindow.document) directly -- you don't
> have to wait for the script to get executed again i the other window.
>
> make sense at all?
>
> - a
>
> On 6/6/06, Andre <gm at andrecgn.de> wrote:
>> To add a bit what I am/was doing:
>>
>> My GM script has a configuration 'dialog' which is actually a new page
>> that gets created by the script when I click on a button that is added
>> to the original window:
>>
>> function makeManageFunc(DB, title, size) {
>>      return function manage(ev) {
>>         var theWindow = window.open("Manage", title, size);
>>         //theWindow.focus();
>>         var theDoc = theWindow.document;
>>         theDoc.writeln('<html><head></head>'
>>                        + '<body bgColor="grey">'
>>                        + '<h1  style="text-align: center;" '
>>                        + 'id="Manage">'
>>                       + title
>>                       + '</h1>')
>>          theDoc.writeln('</body></html>')
>>          theDoc.close()
>>          ev.preventDefault();
>>      }
>> }
>>
>> The function is used in the EvenListener and gets executed onclick.
>>
>> That page has the same URL as the generating page and my script checks
>> for id="Manage" whether this is the original page or the configuration
>> dialog. If it is the configuration dialog, it creates all the form 
>> fields.
>>
>> This does not happen anymore.
>>
>> Checking with the DOM-Inspector both URLs are still identical as they
>> used to be.
>>
>> When the second page gets created the error console shows the following
>> error:
>>
>> Error: [Exception... "'Permission denied to get property
>> XULElement.accessKey' when calling method:
>> [nsIDOMXULLabelElement::accessKey]"  nsresult: "0x8057001e
>> (NS_ERROR_XPC_JS_THREW_STRING)"  location: "JS frame :: <unknown
>> filename> :: manage :: line 203"  data: no]
>>
>> Any idea?
>>
>> Cheers, Andre
>>
>> Andre wrote:
>> > true, I am experiencing the same problem.
>> >
>> > Andre
>> >
>> > Bill Donnelly wrote:
>> >> Gm scripts are not being executed in Javascript-created pages.
>> >>
>> >> [[ using open, write, etc. via a bookmarklet -- example:
>> >> ww=window;
>> >> zz=ww.open().document; zz.write ("the html code"); zz.close();
>> >> ]]
>> >>
>> >> Bill Donnelly wrote:
>> >>
>> >>  > Expect some (possible) weirdness between the new Firefox 1.5.0.4
>> >> update and Gm.
>> >>  > More info to follow. (Win XP)
>>
>> _______________________________________________
>> Greasemonkey mailing list
>> Greasemonkey at mozdev.org
>> http://mozdev.org/mailman/listinfo/greasemonkey
>>
> _______________________________________________
> Greasemonkey mailing list
> Greasemonkey at mozdev.org
> http://mozdev.org/mailman/listinfo/greasemonkey
>


More information about the Greasemonkey mailing list