Closed Bug 1552446 Opened 2 years ago Closed 1 year ago

Leverage Remote Settings attachments utils for intermediates

Categories

(Core :: Security: PSM, enhancement, P2)

68 Branch
enhancement

Tracking

()

RESOLVED FIXED
mozilla73
Tracking Status
firefox68 --- wontfix
firefox73 --- fixed

People

(Reporter: leplatrem, Assigned: leplatrem)

References

Details

(Whiteboard: [psm-backlog])

Attachments

(1 file)

In Bug 1501214 we shipped some utils to download attachments.

The intermediate preloads clients precedes it and a lot of code is duplicated between the two.

Some of the code could be rewritten to leverage the attachments utils. For example, something like that:


ChromeUtils.defineModuleGetter(this, "Downloader", "resource://services-settings/Attachments.jsm");

async updatePreloadedIntermediates() {
  const records = this.client.get({
    filters: {
      cert_import_complete: false,
    }
  });

  for (const record of records) {
    let localUri;
    try {
      localUri = await client.attachments.download(record);
    } catch (e) {
      if (e instanceof Downloader.DownloadError) {
        // download error ... 
        // Services.telemetry...
      } else if (e instanceof Downloader.ContentError) {
        // hash, length error ...
        // Services.telemetry...
      } else {
        // ...
      }
      continue;
    }

    // const buffer = await (await fetch(localUri)).arrayBuffer();
    // const bytes = new Uint8Array(buffer); 
    // const text = await (await fetch(localUri)).text();

  }
}


Priority: -- → P2
Whiteboard: [psm-backlog]
Depends on: 1559132
Assignee: nobody → mathieu

There's a r+ patch which didn't land and no activity in this bug for 2 weeks.
:leplatrem, could you have a look please?
For more information, please visit auto_nag documentation.

Flags: needinfo?(mathieu)
Pushed by mleplatre@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/8b5bcdecb7ad
Leverage Remote Settings attachments utils for intermediates r=glasserc,jcj
Status: NEW → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla73
Flags: needinfo?(mathieu)
You need to log in before you can comment on or make changes to this bug.