benlilaj / gears

Automatically exported from code.google.com/p/gears
0 stars 1 forks source link

captureBlob() unit test failure on safari/leopard #782

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
The test case is consistently failing in Safari/Leopard (while Safari/Tiger is 
purring like a kitten). The test that fails 
is below... looks like the content-type header value stored in the 
localserver.db doesn't get reflected when GHR'ing the 
resource.

function testCaptureBlob() {
 startAsync();
 var url = '/testcases/test_file_1024.txt';
 httpGetAsRequest(url, function(request) {
   var store = getFreshStore();
   var captureUrl = '/captured.txt';
   var responseBlob = request.responseBlob;

   store.captureBlob(responseBlob, captureUrl);
   assertBlobProbablyEqual(store.getAsBlob(captureUrl), responseBlob);
   assertEqual('application/octet-stream',
               store.getHeader(captureUrl, 'Content-Type'));

   var contentType = request.getResponseHeader('Content-Type');
   store.captureBlob(responseBlob, captureUrl, contentType);
   assertBlobProbablyEqual(store.getAsBlob(captureUrl), responseBlob);
   assertEqual(contentType, store.getHeader(captureUrl, 'Content-Type'));

   httpGetAsRequest(captureUrl, function(request2) {
     assertBlobProbablyEqual(responseBlob, request2.responseBlob);
     assertEqual(contentType, request2.getResponseHeader('Content-Type')); <---- FAILS HERE
     completeAsync();
   });
 });

Original issue reported on code.google.com by gears.te...@gmail.com on 18 Dec 2008 at 9:57

GoogleCodeExporter commented 9 years ago
I try to do the following, and hit this error:
- download a js file from the server and add it to a local store as gears 
worker code, so it is available for offline 
access. 
- For this to work a content type of "application/x-gears-worker" is required, 
so I set that during capture
- Problem when requesting the url in safari4/macosx it that the response 
content type is text/html, so it won't 
run as gears worker anymore

Original comment by breakb...@gmail.com on 22 May 2009 at 11:33

GoogleCodeExporter commented 9 years ago
I'm having the same problem with safari4/macosx and images. They are sent with a
content type of text/html, even if I set it to "image/png" :

var store = localServer.createStore('test-store');
store.captureBlob(file.blob, fileURL, "image/png");

Original comment by jerem...@gmail.com on 30 May 2009 at 5:44