MCPcopy Create free account
hub / github.com/angular/dev-infra / execute

Method execute

github-actions/browserstack/set-browserstack-env.js:6105–6145  ·  view source on GitHub ↗
(data)

Source from the content-addressed store, hash-verified

6103 }
6104 }
6105 execute(data) {
6106 assert(this.ptr != null);
6107 assert(currentParser == null);
6108 assert(!this.paused);
6109 const { socket, llhttp } = this;
6110 if (data.length > currentBufferSize) {
6111 if (currentBufferPtr) {
6112 llhttp.free(currentBufferPtr);
6113 }
6114 currentBufferSize = Math.ceil(data.length / 4096) * 4096;
6115 currentBufferPtr = llhttp.malloc(currentBufferSize);
6116 }
6117 new Uint8Array(llhttp.memory.buffer, currentBufferPtr, currentBufferSize).set(data);
6118 try {
6119 let ret;
6120 try {
6121 currentBufferRef = data;
6122 currentParser = this;
6123 ret = llhttp.llhttp_execute(this.ptr, currentBufferPtr, data.length);
6124 } catch (err) {
6125 throw err;
6126 } finally {
6127 currentParser = null;
6128 currentBufferRef = null;
6129 }
6130 const offset = llhttp.llhttp_get_error_pos(this.ptr) - currentBufferPtr;
6131 if (ret !== constants3.ERROR.OK) {
6132 const body = data.subarray(offset);
6133 if (ret === constants3.ERROR.PAUSED_UPGRADE) {
6134 this.onUpgrade(body);
6135 } else if (ret === constants3.ERROR.PAUSED) {
6136 this.paused = true;
6137 socket.unshift(body);
6138 } else {
6139 throw this.createError(ret, body);
6140 }
6141 }
6142 } catch (err) {
6143 util.destroy(socket, err);
6144 }
6145 }
6146 finish() {
6147 assert(currentParser === null);
6148 assert(this.ptr != null);

Callers 2

resumeMethod · 0.45
readMoreMethod · 0.45

Calls 5

freeMethod · 0.45
setMethod · 0.45
onUpgradeMethod · 0.45
createErrorMethod · 0.45
destroyMethod · 0.45

Tested by

no test coverage detected