Extension stopped working with Google Chrome manifest v2

I am developing an extension for Google Chrome that was working perfectly, but now stopped working with version 2 of the manifest.

It is giving me the following error:

Uncaught SyntaxError: Unexpected end of input

popup.js:

chrome.tabs.getSelected(null, function (aba) {
    link = aba.url;
    titulo = aba.title;
    document.getElementById('mensagem').value = link;
});

function GrabIFrameURL(feedDescription) {
    var regex = new RegExp("iframe(?:.*?)src='(.*?)'", 'g');
    var matches = regex.exec(feedDescription);
    var url = '';
    if (matches.length == 2) {
        url = matches[1];
    }
    var quebra = url.split("/");
    return quebra[4];
}

$(document).ready(function () {
    if (localStorage.nome == '' || localStorage.nome == null || localStorage.email == '' || localStorage.email == null) {
        jQuery('#formulario').hide();
        jQuery('#erros').html('Configure seus dados <a href="options.html" target="_blank">aqui</a>');
    }

    jQuery("#resposta").ajaxStart(function () {
        jQuery(this).html("<img src='img/loading.gif'> <b>Sugestão sendo enviada, aguarde...</b>");
    });

    jQuery('#submit').click(function () {

        var nome = localStorage.nome;
        var email = localStorage.email;
        var mensagem = titulo + "\
\
<br><br>" + link;

        jQuery('#formulario').hide();
        jQuery.post('http://blabloo.com.br/naosalvo/mail.php', {
            nome: nome,
            email: email,
            mensagem: mensagem
        },

        function (data, ajaxStart) {
            jQuery('#resposta').html(data);
            console.log(data);
        });
        return false;
    });

    //Listagem de posts
    var bkg = chrome.extension.getBackgroundPage();

    jQuery('#close').click(function () {
        window.close();
    });

    jQuery('#markeall').click(function () {
        bkg.lidoAll();
        $('.naolido').attr('class', 'lido');
    });

    jQuery.each(bkg.getFeed(), function (id, item) {
        if (item.naolido == '1')
            lidoClass = 'naolido';
        else
            lidoClass = 'lido';
        var thumb = GrabIFrameURL(item.description);
        $('#feed').append('<li><a id="' + item.id + '" href="' + item.link + '" class="' + lidoClass + '"><img src="' + $.jYoutube(thumb, 'small') + '" class="' + lidoClass + '"/>' + item.title + '</a></li>');
    });

    $('.naolido').click(function (e) {
        e.preventDefault();
        klicked = $(this).attr('id');
        console.log(klicked);
        bkg.setLido(klicked);
        $(this).attr('class', 'lido');
        openLink($(this).attr('href'));
    });

    $('.lido').click(function (e) {
        openLink($(this).attr('href'));
    });

    var openLink = function (link) {
        chrome.tabs.create({
            'url': link,
            'selected': true
        });
        window.close();
    }

});

I think the problem is in this part of popup.js (line 61):

jQuery.each(bkg.getFeed(), function (id, item) {
        if (item.naolido == '1')
            lidoClass = 'naolido';
        else
            lidoClass = 'lido';
        var thumb = GrabIFrameURL(item.description);
        $('#feed').append('<li><a id="' + item.id + '" href="' + item.link + '" class="' + lidoClass + '"><img src="' + $.jYoutube(thumb, 'small') + '" class="' + lidoClass + '"/>' + item.title + '</a></li>');
});

Do not know if it’s accurate but all hosted files for extension: http://www.mediafire.com/?0f7mrjvxtw5u4ad

Someone?

The problem is with your jquery.jfeed.pack.js file, as that tries to eval code, which is not allowed anymore in chrome under manifest 2. See http://stackoverflow.com/questions/11968234/chrome-extension-uncaught-error-code-generation-from-strings-disallowed-for-th

What you should do:

  1. Download jquery.jfeed (https://github.com/jfhovinne/jFeed/downloads)
  2. Extract it
  3. Remove js/jquery.jfeed.pack.js from your extension
  4. Place jfhovinne-jFeed-0d411f7/build/dist/jquery.jfeed.js in your js/ directory
  5. Change js/jquery.jfeed.pack.js to js/jquery.jfeed.js in background.html and manifest.json

After that the extension works again, at least it does for me :slight_smile: