Skip to content

Commit

Permalink
Revert "fix: session.getBlobData never resolves with blob sizes > 655…
Browse files Browse the repository at this point in the history
…36 (electron#35277)"

This reverts commit e3efa16.
  • Loading branch information
Pink021 committed Sep 8, 2022
1 parent e3efa16 commit 7659a69
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 48 deletions.
5 changes: 1 addition & 4 deletions shell/browser/api/electron_api_data_pipe_holder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,8 @@ class DataPipeReader {
if (result == MOJO_RESULT_OK) { // success
remaining_size_ -= length;
head_ += length;
if (remaining_size_ == 0) {
if (remaining_size_ == 0)
OnSuccess();
} else {
handle_watcher_.ArmOrNotify();
}
} else if (result == MOJO_RESULT_SHOULD_WAIT) { // IO pending
handle_watcher_.ArmOrNotify();
} else { // error
Expand Down
44 changes: 0 additions & 44 deletions spec/api-session-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -529,50 +529,6 @@ describe('session module', () => {
});
});

describe('ses.getBlobData2()', () => {
const scheme = 'cors-blob';
const protocol = session.defaultSession.protocol;
const url = `${scheme}://host`;
after(async () => {
await protocol.unregisterProtocol(scheme);
});
afterEach(closeAllWindows);

it('returns blob data for uuid', (done) => {
const content = `<html>
<script>
let fd = new FormData();
fd.append("data", new Blob(new Array(65_537).fill('a')));
fetch('${url}', {method:'POST', body: fd });
</script>
</html>`;

protocol.registerStringProtocol(scheme, (request, callback) => {
try {
if (request.method === 'GET') {
callback({ data: content, mimeType: 'text/html' });
} else if (request.method === 'POST') {
const uuid = request.uploadData![1].blobUUID;
expect(uuid).to.be.a('string');
session.defaultSession.getBlobData(uuid!).then(result => {
try {
const data = new Array(65_537).fill('a');
expect(result.toString()).to.equal(data.join(''));
done();
} catch (e) {
done(e);
}
});
}
} catch (e) {
done(e);
}
});
const w = new BrowserWindow({ show: false });
w.loadURL(url);
});
});

describe('ses.setCertificateVerifyProc(callback)', () => {
let server: http.Server;

Expand Down

0 comments on commit 7659a69

Please sign in to comment.