Pergunta

I'm writing a UserScript (=Greasemonkey) which I am developing in FireFox but works in Opera, FF and Chrome. I changed my entire script in Firefox, replacing all texts with variables as to be able to port the script easily to other languages. Now it no longer runs in Opera and it doesn't show any errors in the console (Dragonfly). The script does nothing at all, so there must be some syntax error that Firefox can handle but Opera not.

I do not use any specific FireFox features (GM_*), as I said: I only replaced strings in the scripts with variables defined in a new "translation" array.

Code to insert my script:

(
 function()
 {
    var script = document.createElement("script");
    script.textContent = "(" + myFunctionName + ")()";
    document.body.appendChild(script);
 }
)();

So...

  • Is there some JavaScript stuff that Firefox can handle but Opera not?

  • Or can I get the error console to work for a UserScript?

I did some googling and searched these forums but couldn't find anything that worked...

PS: I posted this on the Opera forums first but figured I have a much better chance getting a way to find a "debugging work-around" on SOF.

PPS: In the meanwhile I also tried locating the problem with JS Lint but that one gives an error when you as much as sneeze.

Foi útil?

Solução

The message console (Ctrl+Shift+O) should contain errors from UserScripts. Alternatively, you could try packaging your script into an extension and use Dragonfly for debugging: http://dev.opera.com/articles/view/converting-userjs-to-extensions/

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top