Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrap zip lib with simple promise-based API (fixes #16) #20

Merged
merged 2 commits into from
Sep 25, 2015

Conversation

muffinresearch
Copy link
Contributor

No description provided.

@muffinresearch muffinresearch changed the title Wrap zip lib with simple promise-based API Wrap zip lib with simple promise-based API (fixes #16) Sep 24, 2015
this.zipLib.open(this.filename, {autoClose: false},
(err, zipfile) => {
if (err) {
reject(err);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we return reject(err) here? Just so we don't bother to execute the other stuff.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, we should. Good catch!

@tofumatt tofumatt mentioned this pull request Sep 24, 2015
throw new Error('path does not exist in metadata', path);
}

var entry = this.metadata[path];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

entry is only used once on the very next line. Is this here to cut down on line length on the next line?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah probably uncessary.

@tofumatt
Copy link
Contributor

Looks good, just wondering about that return reject() and the initialisation of props. After that should be good to merge.

@tofumatt tofumatt assigned muffinresearch and unassigned tofumatt Sep 24, 2015
@muffinresearch
Copy link
Contributor Author

@tofumatt ok, I think this is ready for another look.

readStream
.on('readable', function () {
var chunk;
while (null !== (chunk = readStream.read())) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Putting the null first feels a bit Pythonic, not used to that in JS.

If this is preferred style I'll just make a note of it and be sure to include it in #21.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair enough, seems good 😃

  • tofumatt (Sent from mobile)

On 25 Sep 2015, at 12:30, Stuart Colville notifications@github.com wrote:

In tests/test.xpi.js:

  • this.openStub.yieldsAsync(null, this.fakeZipFile);
  • var rstream = new Readable();
  • rstream.push('line one\n');
  • rstream.push('line two');
  • rstream.push(null);
  • this.openReadStreamStub.yields(null, rstream);


Reply to this email directly or view it on GitHub.

@tofumatt
Copy link
Contributor

r+, let me know about that while (null !== [...]) ordering bit, but good to merge. 👍

muffinresearch added a commit that referenced this pull request Sep 25, 2015
Wrap zip lib with simple promise-based API (fixes #16)
@muffinresearch muffinresearch merged commit f52a78e into mozilla:master Sep 25, 2015
@muffinresearch muffinresearch deleted the add-xpi-handling branch September 25, 2015 11:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants