I'm working on a side project to help me learn javascript, and seem to be having a bit of trouble getting the code to do what I want.

What I'm doing: I'm making a chrome extension that reads in the tab url and returns an image based on the ascii of that url

Code:
var urlPath;
var URLNum;
var num;

var something = {

    grabURL: function() {
        // grab the url of current tab using Chrome API 'chrome.tabs.query'
        chrome.tabs.query({active: true, lastFocusedWindow: true}, function(tabArray) {
            var tab = tabArray[0];
            urlPath = tab;
        });
    },
	
    generateNum_: function() {
        var path = grabTabURL();
		
        for(var i = 0; i < path.length; i++) {
            URLNum += path.charCodeAt(i);
        }
		
        return URLNum;
    },
	
    generateSomething_: function() {
        num = generateNum_();
        var c = new Class(); // mostly abstract right now and doesn't really do anything - will probably move the generate image into these class/sub classes
		
        if(num >= 0 && num < 800) {
            //a = new ChildClassA();
            var img = document.createElement("img");
            img.src = "img/imageA.gif";
            document.body.appendChild(img);
        } else if(num >= 300 && num < 600) {
            b = new ChildClassB();
            // repeat the image generate part
        }
    }
};


// Run script as soon as the document's DOM is ready.
document.addEventListener('DOMContentLoaded', function() {
  something.grabURL();
});
What's wrong with my code: The urlNum and num remains as undefined. Following what the code does, urlNum is suppose to use whatever urlPath is to generate a number. Which "num" then uses to determine what picture to show.

urlPath does seem to return an object with a url in it (I checked the debugger) so I'm not really sure what's wrong.

Can someone help me?