Uploaded image for project: 'Apache Cordova'
  1. Apache Cordova
  2. CB-7444

Success callback for XHR to local file that doesn't exist on device never called.

    XMLWordPrintableJSON

Details

    Description

      XHR request for local file that doesn't exist on device causes a runtime exception:

      An exception of type 'System.OutOfMemoryException' occurred in Microsoft.Phone.Interop.ni.dll but was not handled in user code
      

      that catched in the XHRHelper code and __onXHRLocalCallback for this request is never called.

      Repro steps:
      1. Create blank MDD app, add WP8 platform.
      2. Try to get an unexistant file, e.g.:

      var xhr = new XMLHttpRequest();
      xhr.open("GET", "../this.file.is.not.exists", true);
      xhr.onload = xhr.onerror = function() {
          console.log ('Callback called');
      }
      

      Expected:
      'Callback called' is printed to console

      Actual:
      No output in console.

      Problem is in arguments array, that passed to __onXHRLocalCallback. Seems that member of this array can't be null, so replace

       new string[] { "404", null, reqId } 

      with

       new string [] { "404", string.Empty, reqId }

      solves the problem.

      Attachments

        Activity

          People

            purplecabbage Jesse MacFadyen
            vladimir.kotikov Vladimir Kotikov
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: