Closed
Bug 797871
Opened 13 years ago
Closed 13 years ago
Error when reading file from ArchiveReader
Categories
(Core :: XPCOM, defect)
Core
XPCOM
Tracking
()
RESOLVED
FIXED
mozilla19
People
(Reporter: mathieu, Assigned: baku)
References
Details
Attachments
(3 files, 3 obsolete files)
I'm trying to extract files from a zip archive, but when I use the FileReader on those files I have an error : NotReadableError
it's working fine on Nightly
fix content type and path to archive
Attachment #667988 -
Attachment is obsolete: true
Attachment #667993 -
Attachment mime type: text/plain → text/html
Attachment #667993 -
Attachment is obsolete: true
Comment on attachment 667994 [details]
test to reproduce the bug
><html>
> <head>
> <meta charset="utf8"/>
> </head>
> <body>
> <ul id="log"></ul>
>
> <script>
> $xhr = new XMLHttpRequest();
> $log = document.getElementById('log');
>
> function log($html) {
> if(typeof $html === 'object') {
> var
> $o = $html,
> $res = '<ul><h1>' + $o + '</h1>';
>
> for(var $key in $o) {
> $res += '<li>' + $key + ':' + $o[$key] + '</li>';
> }
> $res += '</ul>';
>
> $html = $res;
> }
>
> $li = document.createElement('li');
> $li.innerHTML = $html;
>
> $log.appendChild($li);
> }
>
> function import_blob($blob) {
> var $reader = new ArchiveReader($blob);
>
> var $request = $reader.getFilenames();
>
> $request.onsuccess = function($event) {
> log(
> 'filenames:<ol start="0"><li>' +
> this.result.join('</li><li>') +
> '</li></ol>');
>
> var $i = 1;
> log('getting : ' + this.result[$i]);
> var $request = $reader.getFile(this.result[$i]);
>
> $request.onsuccess = function($event) {
> log('get file success');
>
> var $blob = $event.target.result;
> var $reader = new FileReader();
>
> $reader.onload = function($event) {
> log('read success!');
> log(typeof $event.target.result);
> log($event.target.result.length);
> log($event.target.result);
> }
> $reader.onerror = function($event) {
> log('read error : ' + $event.target.error.name);
> }
> $reader.readAsText($blob);
> };
> $request.onerror = function($event) {
> log('get file error');
> };
> };
> }
>
> $xhr.open('GET', 'attachment.cgi?id=667991');
> $xhr.responseType = 'blob';
> $xhr.onreadystatechange = function($event) {
> if(this.readyState === 4) {
> log('xhr completed');
> import_blob(this.response);
> }
> }
>
> $xhr.send();
> </script>
> </body>
></html>
Attachment #667994 -
Attachment mime type: text/plain → text/html
also - and this is my last update for now -
on the device, I don't always have this error, in the testcase, I'm reading the file #1. I have the same error for each file, except file #0, it end successfully, but result seems badly decompressed (but size is right)
Assignee | ||
Updated•13 years ago
|
Assignee: nobody → amarchesini
Assignee | ||
Comment 6•13 years ago
|
||
The bug is related to the nsISeekableStream combined with the nsMultiplexInputStream.
I can reproduce it with a xpcshell test.
Status: UNCONFIRMED → NEW
Ever confirmed: true
Assignee | ||
Updated•13 years ago
|
OS: Linux → All
Product: Boot2Gecko → Core
Hardware: x86_64 → All
Version: unspecified → Trunk
Assignee | ||
Comment 7•13 years ago
|
||
Attachment #668438 -
Flags: review?(Ms2ger)
Assignee | ||
Updated•13 years ago
|
Attachment #668438 -
Flags: review?(Ms2ger) → review?(doug.turner)
Updated•13 years ago
|
Component: General → DOM: Mozilla Extensions
Comment 8•13 years ago
|
||
Comment on attachment 668438 [details] [diff] [review]
patch 1
Review of attachment 668438 [details] [diff] [review]:
-----------------------------------------------------------------
::: xpcom/tests/unit/test_seek_multiplex.js
@@ +135,5 @@
> +
> + try {
> + var MultiplexStream = CC("@mozilla.org/io/multiplex-input-stream;1",
> + "nsIMultiplexInputStream");
> + do_check_eq(1, 1);
indent of do_check_eq is off
@@ +162,5 @@
> +
> + seekable.seek(Ci.nsISeekableStream.NS_SEEK_SET, 20);
> + do_check_eq(seekable.tell(), 20);
> + } catch(e) {
> + dump(e + "\n");
Instead of a dump, maybe you should add:
do_note_exception?
Attachment #668438 -
Flags: review?(doug.turner) → review+
Assignee | ||
Comment 9•13 years ago
|
||
Attachment #668438 -
Attachment is obsolete: true
Attachment #670020 -
Flags: review+
Assignee | ||
Updated•13 years ago
|
Keywords: checkin-needed
Updated•13 years ago
|
Component: DOM: Mozilla Extensions → XPCOM
I wonder if this will fix bug 789004...
Comment 11•13 years ago
|
||
I don't see any Try results here, so I've triggered a run. I'll push it if it's green. Also, please make sure that your commit message is a description of what the patch is doing. This one is pretty meager...
https://tbpl.mozilla.org/?tree=Try&rev=b8bd135fa1a6
Comment 12•13 years ago
|
||
Flags: in-testsuite+
Keywords: checkin-needed
Comment 13•13 years ago
|
||
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla19
You need to log in
before you can comment on or make changes to this bug.
Description
•