[email/IMAP][test] intermittent-failure on test_imap_parallelfetch.js

RESOLVED WORKSFORME

Status

Firefox OS
Gaia::E-Mail
RESOLVED WORKSFORME
5 years ago
5 years ago

People

(Reporter: asuth, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

5 years ago
test_imap_parallelfetch.js will sometimes fail because of a race stemming from this code:

      header.onchange = function() {
        // intentionally omitting options... body should be downloaded here.
        header.getBody(function(body) {
...
    folderView.slice.maybeRequestBodies(0, messageCount + 1);


This occurs on messages that contain multiple body parts.  The problem is that onchange is fired as a result of the snippet being generated for the message after the first body-part is downloaded and is independent of fetches for all of the body parts being downloaded.

I think the comment was just being overly optimistic and the right thing is probably to just have the test add an 'onchange' listener on body parts that are not yet fetched and emit the log results only when all parts are downloaded.  I think this still meets the spirit of the test.

needinfoing :lightsofapollo for thoughts in case I missed intended semantics and we should be fixing the implementation proper instead.
Flags: needinfo?(jlal)
(Reporter)

Comment 1

5 years ago
I just added a variant to getBody so we can have it not return until the body reps are fully downloaded, since we can already do that.  So now I think we should just use that.  (Doing this as part of getting test_compose working for fake activesync.  Quite a slog.)

doc-block for getBody will soon be:
  /**
   * Request the `MailBody` instance for this message, passing it to the
   * provided callback function once retrieved.
   *
   * @args[
   *   @param[options @dict[
   *     @key[downloadBodyReps #:default false]{
   *       Asynchronously initiate download of the body reps.  The body may
   *       be returned before the body parts are downloaded, but they will
   *       eventually show up.  Use the 'onchange' event to hear as the body
   *       parts get added.
   *     }
   *     @key[withBodyReps #:default false]{
   *       Don't return until the body parts are fully downloaded.
   *     }
   *   ]]
   * ]
   */
(Reporter)

Comment 2

5 years ago
okay, I'm just fixing this using withBodyReps, since it's straightforward.  Speak up if you take issue!
Status: NEW → RESOLVED
Last Resolved: 5 years ago
Flags: needinfo?(jlal)
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.