Closed Bug 797871 Opened 12 years ago Closed 12 years ago

Error when reading file from ArchiveReader

Categories

(Core :: XPCOM, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla19

People

(Reporter: mathieu, Assigned: baku)

References

Details

Attachments

(3 files, 3 obsolete files)

Attached file test to reproduce the bug (obsolete) —
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
Attached file zip archive
used by testcase
Attached file test to reproduce the bug (obsolete) —
fix content type and path to archive
Attachment #667988 - Attachment is obsolete: true
Attachment #667993 - Attachment mime type: text/plain → text/html
maybe I got it right this time
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: nobody → amarchesini
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
OS: Linux → All
Product: Boot2Gecko → Core
Hardware: x86_64 → All
Version: unspecified → Trunk
Attached patch patch 1 (obsolete) — Splinter Review
Attachment #668438 - Flags: review?(Ms2ger)
Attachment #668438 - Flags: review?(Ms2ger) → review?(doug.turner)
Component: General → DOM: Mozilla Extensions
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+
Attached patch patch 1bSplinter Review
Attachment #668438 - Attachment is obsolete: true
Attachment #670020 - Flags: review+
Keywords: checkin-needed
Component: DOM: Mozilla Extensions → XPCOM
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
https://hg.mozilla.org/mozilla-central/rev/c8cd1795c6f8
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla19
Blocks: 799234
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: