0

I accidentally deleted two Firefox files (recovery.js and recovery.bak) that contained the details of a huge number of tabs that I have open when I use Firefox.

The tabs (website information) are everso important to me.

I understand that recovery.js is javascript.

I have recovered the contents of recovery.js by grepping the hard drive, but there are 5 syntax errors in it, so Firefox doesn't recognise it or use it. The recovery.js is 2.1 MB in size and is one long record, with no newlines.

The following rhino-jsc command gives some sparse information about the syntax errors. I know nothing about rhino-jsc, other than that it will show syntax errors. :

$ rhino-jsc RECOVERED-recovery.js

<the javascript was printed here>

Exception in thread "main" org.mozilla.javascript.EvaluatorException: Compilation produced 5 syntax errors. (RECOVERED-recovery.js#1) at org.mozilla.javascript.tools.ToolErrorReporter.runtimeError(ToolErrorReporter. java:111) at org.mozilla.javascript.Parser.parse(Parser.java:569) at org.mozilla.javascript.Parser.parse(Parser.java:478) at org.mozilla.javascript.optimizer.ClassCompiler.compileToClassFiles(ClassCompiler .java:134) at org.mozilla.javascript.tools.jsc.Main.processSource(Main.java:242) at org.mozilla.javascript.tools.jsc.Main.main(Main.java:39)

Unfortunately, I don't know anything about javascript, and don't know what the above error messages are telling me.

My Questions:

  1. Could you tell me how to find out WHERE in the file, those 5 syntax errors are, and preferably EXACTLY WHICH character(s) they are?

  2. Is there a better syntax checker that will enable me to locate precisely WHERE the errors are, and WHAT they are? I'd rather not use an ONLINE syntax checker because of privacy concerns.

  3. If I can't work out, what to change, in order to correct the syntax errors, is there a typical block* of script that I can safely delete that contains each error, even if it means losing the tabs that the deletion results in? (*A very small section hopefully).

  4. What editor can I use to edit the huge .js file? I have the Bluefish editor on my system but it exhibits faulty behaviour. I've tried opening the file in Kate but it doesn't load. The problem with a hex editor is that the text is inconveniently displayed in a small 16-character-wide column.

If I can correct the syntax errors, or delete the block(s) they're in, hopefully Firefox will then recognise this recovery.js.

dave99
  • 1

1 Answers1

-1

The error shows you the area here, so it is identifying section called parser and line 569

Parser.java:569 Parser.java:478 Main.java:242 Main.java:39

These are java files though, I checked and rhino converts javascript into java I don't think that is what you want. Instead to check the file install node.js and run node --check RECOVERED_recovery.js then use the line numbers from that output to proceed

If you just delete chunks of javascript it is very likely you will create more syntax errors not less or at least render it unreadable by firefox. You could reinstall firefox in another directory and recreate the default files, maybe open some example tabs and quit to create a sample working recovery file, then use that as a find the difference to fill in the gaps or isolate your tab data from the corrupt one and paste it in?

If vim, nano or emacs don't work try atom as a text editor

Koffee
  • 29