Search code examples
firefox-addonfirefox-addon-sdk

Request object response always empty


Here's my main.js

require('sdk/request').Request({
    url:'https://google.com'
    ,onComplete:function(response){
        console.log('response',response)
    }
}).get()

which gives me

console.log: extension: response constructor {}

At first I thought it was a permissions thing, but I whitelisted google and still no response

"permissions": {
    "private-browsing": true
     ,"cross-domain-content":["https://google.com"]
}

I'm using FF31


Solution

  • Turns out the object wasn't actually empty, it just appeared empty in the console. When I console.log(response.text) I get the results I expect. This is probably b/c text,json, etc are prototypes of the object and the console ignores prototypes.