Hi Chris,
The exception when accessing the .status property after a network error is
by design. The XHR1 spec calls for a NetworkException to be thrown in this
case on that property access. When the request fails due to a network error,
the .status property can't reflect a valid HTTP response status code,
instead it's spec'd to throw an exception I think XHR2 spec tries to provide
a friendlier programming interface around this flavor of failure, but
regardless, the Gears API is modeled off of XHR1.

The random gibberish in the responseText property is a bug that has been
fixed in an upcoming release, in 0.5.4.0 and newer responseText will reflect
an empty string.

Michael


On Sun, Nov 16, 2008 at 2:16 AM, Khookie <[EMAIL PROTECTED]> wrote:

>
> Hi
>
> When I try to make a http request when the network is offline, it
> seems to come back with strange results.
>
> For example, I used a managed resource store to store an index.html &
> index.js file offline, and then when I work offline and have some
> script make a GET request with the beta.httprequest object, calling
> req.status in the onreadystatechange event throws an "Internal error"
> in Firebug.  Also, when I check req.responseText, it comes back with
> random gibberish, which I'm guessing has something to do with some
> memory being allocated but never used.
>
> Cheers
>
> Chris
>
> PS. check below relevant code:
>
> *** index.js
> // init store
> var _localServer = google.gears.factory.create('beta.localserver');
> var _managedStore = _localServer.createManagedStore('test');
> _managedStore.manifestUrl = 'manifest.txt';
> _managedStore.checkForUpdate();
>
> var req = google.gears.factory.create('beta.httprequest');
> req.open('GET', 'test.txt');
> req.onreadystatechange = function() {
>        if (req.readyState == 4) {
>                alert(req.status);
>        }
> }
> req.send(null);
>
> *** manifest.txt
> {
>        "betaManifestVersion": 1,
>        "version": "1",
>        "entries": [
>                { "url": ".", "redirect": "index.html" },
>                { "url": "gears_init.js" },
>                { "url": "index.html" },
>                { "url": "index.js" }
>        ]
> }
>
> *** test.txt just has :-) in it if you really wanted to know
>

Reply via email to