fetching of manifests in owa extension

VERIFIED FIXED

Status

P1
normal
VERIFIED FIXED
7 years ago
7 years ago

People

(Reporter: onecyrenus, Assigned: anant)

Tracking

Details

Attachments

(1 attachment)

(Reporter)

Description

7 years ago
This is the code, basically I worry that this isn't behind a timeout, and what is our strategy to catch exceptions when they happen at this level ? 

function fetchManifest(url, cb) {
  dump("APPS | api.install.fetchManifest | Fetching manifest from " + url + "\n");
  // contact our server to retrieve the URL
  let xhr = Cc["@mozilla.org/xmlextras/xmlhttprequest;1"].
  createInstance(Ci.nsIXMLHttpRequest);
  xhr.open("GET", url, true);
  xhr.onreadystatechange = function(aEvt) {
    if (xhr.readyState == 4) {
      if (xhr.status == 200) {
        dump("APPS | api.install.fetchManifest | Got manifest (200) " + xhr.responseText.length + " bytes\n");
        cb(xhr.responseText, xhr.getResponseHeader('Content-Type'));
      } else {
        dump("Failed to get manifest (" + xhr.status + ")\n");
        cb(null);
      }
    }
  };
  xhr.send(null);
}
(Reporter)

Updated

7 years ago
Component: OpenWebApps → Extension
Priority: -- → P2
Product: Mozilla Labs → Web Apps
QA Contact: openWebApps → extension
it might be a good idea to adopt some code from 

https://mxr.mozilla.org/mozilla-central/source/toolkit/mozapps/webapps/

as it seems to be handling errors better.  Not sure if that would work in a timeline for alpha.
Duplicate of this bug: 703701
(Assignee)

Updated

7 years ago
Priority: P2 → P1
(Assignee)

Updated

7 years ago
Assignee: nobody → anant
(Assignee)

Updated

7 years ago
Blocks: 698879
(Assignee)

Comment 3

7 years ago
Created attachment 579840 [details]
More robust XHR handling

https://github.com/mozilla/openwebapps/pull/151
Attachment #579840 - Flags: review?(ianb)
(Assignee)

Comment 4

7 years ago
r+'ed on IRC: https://github.com/mozilla/openwebapps/commit/4686fe763ceb5ba20f96539d542abd8416d01fb7
Status: NEW → RESOLVED
Last Resolved: 7 years ago
Resolution: --- → FIXED
(Reporter)

Updated

7 years ago
Status: RESOLVED → VERIFIED
Attachment #579840 - Flags: review?(ianb) → review+
You need to log in before you can comment on or make changes to this bug.