Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 4 of 4

Thread: Issue with reverse engineering what format this guy expects. Out of ideas

  1. #1
    Junior Member
    Join Date
    Nov 2011
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Issue with reverse engineering what format this guy expects. Out of ideas

    I am trying to make plugins, for an extension (Anticontainer) for the Firefox add-on (DownThemAll).

    So, I tried to get help actually writing add-ons for this but that did not work. I suspect either, anybody using this is running it completely independently, and they know the coding and just write everything themselves. Nobody is writing about it so I am not sure what kind of following it has.

    Maybe they just delete any ticket posted on github so there is no trace of their support. It has no forums.

    So, long story short. I gave up trying to get help.

    I taught myself how to write regexp to make plugins. I fixed the Facebook plugin because apparently nobody else tried. Thorough Google search turned up maybe 3-4 posts simply stating "it stopped working", "ok".
    So I gave up and taught myself how to write plugins for it.

    It works, however, I keep running into this damned problem. It took me far more time than it should of to get the Facebook album downloader plugin to work than it should have.

    The issue is, and this is very specific through hours of breaking down each plugin to figure out what caused it and what didn't is, with certain RegExp strings in the "resolver" (plugin type), "finder" domain, stop the plugin from being imported.

    Frankly, I have figured out why it doesn't work (Anticontainer, or DownThemAll or Firefox) won't import it. I change just the finder domain to some basic RegExp string and it will import, but obviously the plugin won't, because the finder sequence is not matching the part of the site I want (the part that is embedded in the source text that I want to download).

    That's the background of the issue. Long story short. Anticontainer plugins won't import because it finds something wrong with the RegExp sequence of the "finder" domain of the plugin. Problem is, Anticontainer does not give any indication as to why it wont import.

    Simply, if it works, it says "successfully imported". If it does not work, nothing happens. Import dialog closes and the plugin doesn't show up.

    Using Firefox's error console has returned a vary vague error for this.

    Error: uncaught exception: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIJSON.decodeFromStream]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: resource://dtaac/plugins.jsm :: loadPluginFromStream :: line 211" data: no]
    Any time a plugin fails to import to AntiContainer, that shows up. If it imports correctly, that does not show up.

    The plugins are .JSON files. That error points to this line of code
    return validatePlugin(nsJSON.decodeFromStream(stream, size));
    . This is part of the following function

    /**
    * Loads a plugin directly from a nsIInputStream
    * @param stream Stream to load from
    * @param size Size to read from the Stream
    * @return Loaded plugin
    */
    function loadPluginFromStream(stream, size) {
    return validatePlugin(nsJSON.decodeFromStream(stream, size));
    }
    .
    This loadPluginFromStream is called one other time in the code in the following function (immediately below the one I just mentioned).

    function loadPluginFromFile(file) {
    if (!(file instanceof Ci.nsIFile)) {
    file = new LocalFile(file);
    }
    let fs = new FileInputStream(file, 0x01, 0, 1<<2);
    let o = loadPluginFromStream(fs, file.size);
    fs.close();
    o.file = file;
    o.date = file.lastModifiedTime;
    return o;
    }
    These are from the plugins file at .

    I have tried countless methods to figure out why certain RegExp in the "finder" domain of the plugin will cause the plugin to import or not.

    How can i figure out what format the original writers of this code want their RegExp.

    For example, simple plugin will import with
    "finder": "<img src=\"(resized/([^\"]+))\"",
    but it will not if I have
    "finder": "src="(http://.*.cdn..*.com.*-\d+x\d+.jpg)"\Wclass="",
    Both are valid RegExp according to the tester I use, RegExr.

    I am at a loss. How can i figure out why this code thinks one RegExp string is correct while another isn't.

    That is, "finder": "src="(http://.*.cdn..*.com.*-\d+x\d+.jpg)"\Wclass="", throws the Firefox error listed above, while the other does not. I can not figure out if it's an issue with my RegExp or something else.

    Suggestions?


  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    22,311
    Thanks
    56
    Thanked 2,373 Times in 2,344 Posts

    Default Re: Issue with reverse engineering what format this guy expects. Out of ideas

    function loadPluginFromFile(file) {
    Is this java or javascript? This is a java forum.

  3. #3
    Junior Member
    Join Date
    Nov 2011
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Issue with reverse engineering what format this guy expects. Out of ideas

    Quote Originally Posted by Norm View Post
    Is this java or javascript? This is a java forum.
    Sorry I didn't note it.
    I am actually not sure. I assume it's javascript but I do not know. The plugins are .json files. The plugin code (part of what you quoted) is in a .jsm file. It uses the XPCOMUtils.jsm from Gecko. That is javascript isn't it?

    I looked all over and couldn't find a distinction one way or the other.

  4. #4
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    22,311
    Thanks
    56
    Thanked 2,373 Times in 2,344 Posts

    Default Re: Issue with reverse engineering what format this guy expects. Out of ideas

    I have never heard of any of those items you mentioned.

Similar Threads

  1. Issue with output format
    By mael331 in forum What's Wrong With My Code?
    Replies: 2
    Last Post: September 25th, 2011, 03:12 PM
  2. Replies: 0
    Last Post: June 20th, 2011, 08:56 AM
  3. Anybody know anything about software engineering
    By jwill22 in forum Java Theory & Questions
    Replies: 1
    Last Post: October 11th, 2010, 05:17 PM
  4. New to Programming, Starting college for computer engineering
    By TheBLC84 in forum Java Theory & Questions
    Replies: 1
    Last Post: September 17th, 2010, 05:06 AM
  5. Any ideas for begginer?
    By SwEeTAcTioN in forum Java Theory & Questions
    Replies: 11
    Last Post: October 27th, 2009, 04:28 AM