Closed Bug 647286 Opened 13 years ago Closed 13 years ago

Request throw exception when options.content contains a null value

Categories

(Add-on SDK Graveyard :: General, defect, P1)

defect

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: nicolas.cotenolin, Assigned: irakli)

Details

Attachments

(1 file)

User-Agent:       Mozilla/5.0 (X11; U; Linux x86_64; en-US) AppleWebKit/534.16 (KHTML, like Gecko) Chrome/10.0.648.151 Safari/534.16
Build Identifier: addon-sdk-1.0b4

An exception is thrown when sending a request (using the request) object and one of the parametres (options.content) contains a null value.

Reproducible: Always

Steps to Reproduce:
var request = Request({
    url: 'someUrl',
    content: { 'key1' : null, 'key2' : 'some value' },
    onComplete: function (response) {
        // do something
   }
});

request.post();
Actual Results:  
Stack trace :
Traceback (most recent call last):
  File "resource://jid0-ik4aoel78ao5udcgocwq4eep76c-api-utils-lib/timer.js", line 64, in notifyOnTimeout
    this._callback.apply(null, this._params);
  File "resource://jid0-ik4aoel78ao5udcgocwq4eep76c-api-utils-lib/content/worker.js", line 64, in emitter
    emit.apply(scope, params);
  File "resource://jid0-ik4aoel78ao5udcgocwq4eep76c-api-utils-lib/events.js", line 147, in _emit
    return this._emitOnObject.apply(this, args);
  File "resource://jid0-ik4aoel78ao5udcgocwq4eep76c-api-utils-lib/events.js", line 177, in _emitOnObject
    listener.apply(targetObj, params);
  File "resource://jid0-ik4aoel78ao5udcgocwq4eep76c-ff-extension-lib/main.js", line 47, in 
    function(response) {
  File "resource://jid0-ik4aoel78ao5udcgocwq4eep76c-ff-extension-lib/internal/backend/backendRequestHandler.js", line 161, in onRequest
    tabWorker.sendMessage(request.message, request.completeUrl, function(data) {
  File "resource://jid0-ik4aoel78ao5udcgocwq4eep76c-ff-extension-lib/internal/backend/TabWorker.js", line 180, in 
    req.send(params);
  File "resource://jid0-ik4aoel78ao5udcgocwq4eep76c-ff-extension-lib/XhrAdapter.js", line 50, in 
    request.post();
  File "resource://jid0-ik4aoel78ao5udcgocwq4eep76c-addon-kit-lib/request.js", line 143, in 
    makeRequest("POST");
  File "resource://jid0-ik4aoel78ao5udcgocwq4eep76c-addon-kit-lib/request.js", line 94, in makeRequest
    let data = makeQueryString(options.content);
  File "resource://jid0-ik4aoel78ao5udcgocwq4eep76c-addon-kit-lib/request.js", line 196, in makeQueryString
    make(k, v);
  File "resource://jid0-ik4aoel78ao5udcgocwq4eep76c-addon-kit-lib/request.js", line 187, in make
    for ([k, v] in Iterator(val)) {
  File "resource://jid0-ik4aoel78ao5udcgocwq4eep76c-api-utils-lib/es5.js", line 45, in Iterator
    if ("__iterator__" in obj && !keysOnly)
TypeError: invalid 'in' operand obj

Expected Results:  
My guess is that this should be handled somehow.
OS: Linux → All
Priority: -- → P2
Hardware: x86_64 → All
Target Milestone: --- → 1.0
(automatic reprioritization of 1.0 bugs)
Priority: P2 → P1
Target Milestone: 1.0 → 1.1
Assignee: nobody → rFobic
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Attachment #542797 - Flags: review?(dietrich)
Attachment #542797 - Flags: review?(dietrich) → review+
https://github.com/mozilla/addon-sdk/commit/d99ffa93dd0f1853b7c7d52cebbd01f786aaaf31
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: