Debugging prettified Js in Firefox - Quantum - firefox

In Firefox pretty print js, whenever a breakpoint is added, the breakpoint is added in original file, making the developer to go through the multiple unwanted lines of code to debug. Is there any solution or workaround for this?

There are currently (as of Firefox 63) a lot of bugs around pretty-printing and setting breakpoints in the Firefox DevTools. Regarding your problem, I'd say that's covered in issue 6947. You may also want to see the list of bugs around pretty-printing.
As far as I know, Mozilla is actively working on fixing them, but one workaround might be to use source maps, which allow you to work with the original sources instead of the minified files when debugging. It's hard to debug minified code, anyway.

Related

What to do about "The Components object is deprecated. It will soon be removed." in dev tools Console

For almost every page I open in Firefox, I see this error in the Console of the developer tool bar:
(!) The Components object is deprecated. It will soon be removed.
The source is the html page. It happens with pages I create, but also on many common websites.
I found this documentation on Components object on MDN web docs, but that does not clarify a lot. Note that even that page shows this message(!)
It looks like a warning, but according to the Console filter, it is an error.
My main questions are:
Is this something for me, as a developer of the page reporting this, to solve?
If so, how do I go about that?
I am not aware of any problems as a result of this. For now, that is.
I have seen this for over a year, maybe longer. I mostly ignore this, but every now and then it starts nagging me again. I don't want my code to break suddenly and would like to get rid of this message obscuring other messages.
This is not for the developer of the page to solve.
While biking back home, a possible cause popped up in my mind: could one of the add-ons I use cause this and yes, that appears to be the case.
I restarted with disabled add-ons and the message was gone.
Then I enabled them one at a time and the culprit is
Selenium IDE.
A bug report on this issue was closed with Won't fix, with the message:
This error will resolve itself when we move to a native app later this year.
In a MozillaZine topic of 2012, it is explained how it could have been solved.
The first one is just a warning that the addon is using "Components"
directly, which won't necessarily always be possible when using the
Add-on SDK. (The preferred way to do it is to access the aliases for
Components.classes and Components.interfaces and such that the SDK
provides by requiring the "chrome" module.) It shouldn't be a problem
right now, but might become one in the future.
it happened for me after installing Selenium plugin in my FireFox.

RStudio interface / behavior changes in 1.0.136

Various things are different in 1.0.136, e.g. running code with ctrl-enter has all sorts of strange behavior in an RMarkdown document, running code that has a syntax error somehow leads to all of the code being run in a block above (below?) the wrong code, etc. Sorry for not posting an MWE, but at the moment I just want to know if anyone is aware of these new "features" and if so how they can be turned off or better yet how I can just downgrade to the previous version of RStudio (which I can't currently find on the website).
Yes they changed some default settings that were present in the old interface.
Change the setting in markdown next to the knit button, from:
Chunk Output Inline -> Chunk Output in Console
Pictured here.
You can probably mess with the the Global Setting->Rmarkdowns under Tools to get it back the way it was before, but this was the fastest way for me.

require-less throwing lessc error in firefox

So I'm working with RequireJS and BackboneJS. I can get everything to work fine in Chrome but when I load up in Firefox I'm getting that lessc is not defined. Obviously pulling out the less files will prevent the error from occurring. Does anyone have any ideas why require is unable to load lessc in firefox but its doing fine in chrome?
Screenshot:
http://screencast.com/t/WenocFdCA0V
Video w/ lessc not being defined in Chrome but not Firefox
http://screencast.com/t/ac96qZrpQb3R
Let me know what other info may be useful.
Thanks in advance!
Seth
less.js is broken, because it uses loadStyles before it defines it, and Firefox stopped hoisting functions according to the spec. There are probably more such mistakes, but this is the first one that is triggered during execution. Please note that the minified version is not affected because of the minification rewriting the code.
less-require is similarly broken, as it contains less.js and therefore contains the same bug.
You might want to replace lessc.js in require-less with the 1.5 beta or master version of less.js to work around this, or wait for upstream to officially release it and require-less to pick it up.
However, it appears that lessc.js is a modified version, so it isn't likely as easy as replacing the file. You would need to merge the changes back.
It might be easier just to move the affected latedefs around until it runs correctly instead of upgrading to a later less.js version.

Add-on support after update

In a previous project I wrote a Firefox extensions - nothing too complex - that used xmpp4moz, an add-on for Firefox that integrates the xmpp/Jabber protocol. At that time Firefox 3.6 most the most recent one and everything worked quite well. Now with Firefox 5 xmpp4moz does produces errors, starting with
Error: Component.classes['#something/something/...'] is undefined
and naturally resulting in further 'undefined' errors. In some sense this is ok, since xmpp4moz is officially not available for Firefox 5. And given that the last update was in 2009 I don't really expect a updated version. Currently I see the following two options:
Looking for alternatives/workarounds/...; so far I haven't found anything. Any ideas?
Trying to update/modify xmpp4moz myself to make it running in Firefox 5
The thing is that at the moment I cannot really assess the required efforts.
Summing up, I'm stuck :)
The sameplace download at http://www.sameplace.cc/ appears to include a slightly newer version of xmpp4moz (I didn't really check whether install.rdf is the only difference from the source code repository however). Still, it is only compatible with Firefox 3.6. From the look of it, there are no big issues, main problem is that the XPCOM components aren't being registered. See https://developer.mozilla.org/en/XPCOM/XPCOM_changes_in_Gecko_2.0 for information on the relevant changes, usually updating the components and chrome.manifest is easy.

How to detect syntax errors when debugging Firefox extensions

When working on a large Firefox plugin, I sometimes accidentally make a syntax error not caught by my editor. When this happens, then calling
Components.utils.import("resource://modules/Foo.js")
will simply fail to import or return anything, without any kind of helpful hint as to where in the file to look for the syntax error. Is there any way I can get Firefox to give me some kind of clue when my imports fail?
EDIT: I fixed my own problem, which turned out to be that I was using code which had a global reference to the navigator object. What made this especially annoying was that the code would work when loaded in the browser (as Wladimir suggested below), but would still fail when importing in my extension.
Eventually I resorted to a sort of manual binary search: I'd delete half of the file and then see whether the import still failed. If so, then I'd delete half of what remained and repeat. As soon as it didn't fail, I had a more precise notion of where the problem was, which allowed me to either continue the binary search or scan the smaller area manually looking for the problem.
This is extremely time-consuming and I'd still appreciate any suggestions about how to speed up this debugging process.
The issue here is most likely the one described on https://developer.mozilla.org/en/Exception_logging_in_JavaScript and setting dom.report_all_js_exceptions preference to true should work. I must admit that I haven't tried that however because setting this preference makes the error console very noisy. Instead I use an ugly hack and load the module as a script in a local HTML file - this is enough to show me syntax errors and fortunately isn't something I need to do all too often (it is only an issue with syntax errors, runtime errors are reported as usually).

Resources