Assertion Failing when JSON response is null

RESOLVED INACTIVE

Status

()

Core
DOM
P4
normal
RESOLVED INACTIVE
5 years ago
4 days ago

People

(Reporter: mchang, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

5 years ago
This assertion is failing:

jsval
XMLHttpRequest::GetResponse(JSContext* /* unused */, ErrorResult& aRv)
{
  if (NS_SUCCEEDED(mStateData.mResponseTextResult) &&
      JSVAL_IS_VOID(mStateData.mResponse)) {
    MOZ_ASSERT(mStateData.mResponseText.Length());

This occurs when returning null/undefined value from an XHR request. If the JSVAL_IS_VOID, the response is already void.
> This occurs when returning null/undefined value from an XHR request. 

In what sense?  What is the server actually sending?

Or better yet, a link to a page that shows the problem?
Flags: needinfo?(mchang)
(Reporter)

Comment 2

5 years ago
This is on the Gaia Email Libs and More test suite. Something changed in Gecko within the past 2 weeks because tests were passing on debug builds for both mozilla-aurora and mozilla-central in early November.

Essentially, the test suite creates a fake imap server, and the imap server responds to an XHR request by returning literal 'null' or 'undefined' instead of an empty JSON {}. I think this is triggering this assertion.

Andrew, maybe you can give a little more context, if I'm on the right track?
Flags: needinfo?(bugmail)
(Reporter)

Updated

5 years ago
Flags: needinfo?(mchang)
> Something changed in Gecko within the past 2 weeks 

OK, can you bisect to find out what?

I mean, I can spend a bunch of time auditing code and trying to guess what your server is sending, but if you control the server and can actually reproduce, it would be much simpler if you simply debug or provide a packet trace or something....
Oh, and for anyone else looking: and important piece of information missing from comment 0 is that this is XHR in a worker, which is quite different from mainthread XHR (and way likelier to be buggy).

That said, I tried XHR in a worker with an empty string as input and responseType set to "json" and did not hit the assert from comment 0...  Same thing with the string "null" as input.
(Reporter)

Comment 5

5 years ago
Sure I'll try to bisect, but it'll be a while until I get there. Thanks for pointing out the XHR worker as well. Can you try your test case and see what happens if you just return null, not as a string but just the null type or undefined type.

Thanks!
There is no "null type"...  What goes into XHR from the HTTP layer are strings.  Which is why I'd like to know exactly what string your web server is actually producing in this case.
I'll provide a mochitest case.
(Reporter)

Updated

4 years ago
Flags: needinfo?(bugmail)

Comment 8

4 days ago
Per policy at https://wiki.mozilla.org/Bug_Triage/Projects/Bug_Handling/Bug_Husbandry#Inactive_Bugs. If this bug is not an enhancement request or a bug not present in a supported release of Firefox, then it may be reopened.
Status: NEW → RESOLVED
Last Resolved: 4 days ago
Resolution: --- → INACTIVE
You need to log in before you can comment on or make changes to this bug.