v86 0.5.43 → 0.5.64
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/libv86-debug.js +75 -49
- package/build/libv86-debug.mjs +109 -108
- package/build/libv86.js +15 -14
- package/build/libv86.mjs +102 -100
- package/build/v86-debug.wasm +0 -0
- package/build/v86-fallback.wasm +0 -0
- package/build/v86.wasm +0 -0
- package/package.json +1 -1
package/build/libv86-debug.js
CHANGED
|
@@ -3845,42 +3845,56 @@ $FetchNetworkAdapter$$module$src$browser$fetch_network$$.prototype.connect = fun
|
|
|
3845
3845
|
$FetchNetworkAdapter$$module$src$browser$fetch_network$$.prototype.tcp_probe = function($port$jscomp$1$$) {
|
|
3846
3846
|
return $fake_tcp_probe$$module$src$browser$fake_network$$($port$jscomp$1$$, this);
|
|
3847
3847
|
};
|
|
3848
|
-
async function $on_data_http$$module$src$browser$fetch_network$$($data$jscomp$
|
|
3848
|
+
async function $on_data_http$$module$src$browser$fetch_network$$($data$jscomp$132_data$jscomp$133_offset$jscomp$48$$) {
|
|
3849
3849
|
this.read = this.read || "";
|
|
3850
|
-
if ((this.read += (new TextDecoder).decode($data$jscomp$
|
|
3851
|
-
|
|
3852
|
-
$
|
|
3853
|
-
$data$jscomp$133_offset$jscomp$48$$ = this.read.substring($data$jscomp$133_offset$jscomp$48$$ + 4);
|
|
3850
|
+
if ((this.read += (new TextDecoder).decode($data$jscomp$132_data$jscomp$133_offset$jscomp$48$$)) && -1 !== this.read.indexOf("\r\n\r\n")) {
|
|
3851
|
+
$data$jscomp$132_data$jscomp$133_offset$jscomp$48$$ = this.read.indexOf("\r\n\r\n");
|
|
3852
|
+
var $headers_localport_opts$$ = this.read.substring(0, $data$jscomp$132_data$jscomp$133_offset$jscomp$48$$).split(/\r\n/);
|
|
3853
|
+
$data$jscomp$132_data$jscomp$133_offset$jscomp$48$$ = this.read.substring($data$jscomp$132_data$jscomp$133_offset$jscomp$48$$ + 4);
|
|
3854
3854
|
this.read = "";
|
|
3855
|
-
let $first_line$$ = $
|
|
3855
|
+
let $first_line$$ = $headers_localport_opts$$[0].split(" "), $target$jscomp$93$$;
|
|
3856
3856
|
$target$jscomp$93$$ = /^https?:/.test($first_line$$[1]) ? new URL($first_line$$[1]) : new URL("http://host" + $first_line$$[1]);
|
|
3857
3857
|
"undefined" !== typeof window && "http:" === $target$jscomp$93$$.protocol && "https:" === window.location.protocol && ($target$jscomp$93$$.protocol = "https:");
|
|
3858
3858
|
let $req_headers$$ = new Headers;
|
|
3859
|
-
for (let $i$jscomp$51$$ = 1; $i$jscomp$51$$ < $
|
|
3860
|
-
const $header$jscomp$3$$ = this.net.parse_http_header($
|
|
3859
|
+
for (let $i$jscomp$51$$ = 1; $i$jscomp$51$$ < $headers_localport_opts$$.length; ++$i$jscomp$51$$) {
|
|
3860
|
+
const $header$jscomp$3$$ = this.net.parse_http_header($headers_localport_opts$$[$i$jscomp$51$$]);
|
|
3861
3861
|
if (!$header$jscomp$3$$) {
|
|
3862
|
-
console.warn('The request contains an invalid header: "%s"', $
|
|
3863
|
-
this.
|
|
3862
|
+
console.warn('The request contains an invalid header: "%s"', $headers_localport_opts$$[$i$jscomp$51$$]);
|
|
3863
|
+
this.net.respond_text_and_close(this, 400, "Bad Request", `Invalid header in request: ${$headers_localport_opts$$[$i$jscomp$51$$]}`);
|
|
3864
3864
|
return;
|
|
3865
3865
|
}
|
|
3866
3866
|
"host" === $header$jscomp$3$$.key.toLowerCase() ? $target$jscomp$93$$.host = $header$jscomp$3$$.value : $req_headers$$.append($header$jscomp$3$$.key, $header$jscomp$3$$.value);
|
|
3867
3867
|
}
|
|
3868
|
+
if (!this.net.cors_proxy && /^\d+\.external$/.test($target$jscomp$93$$.hostname)) {
|
|
3869
|
+
if ($dbg_log$$module$src$log$$("Request to localhost: " + $target$jscomp$93$$.href, 16777216), $headers_localport_opts$$ = parseInt($target$jscomp$93$$.hostname.split(".")[0], 10), !isNaN($headers_localport_opts$$) && 0 < $headers_localport_opts$$ && 65536 > $headers_localport_opts$$) {
|
|
3870
|
+
$target$jscomp$93$$.protocol = "http:", $target$jscomp$93$$.hostname = "localhost", $target$jscomp$93$$.port = $headers_localport_opts$$.toString(10);
|
|
3871
|
+
} else {
|
|
3872
|
+
console.warn('Unknown port for localhost: "%s"', $target$jscomp$93$$.href);
|
|
3873
|
+
this.net.respond_text_and_close(this, 400, "Bad Request", `Unknown port for localhost: ${$target$jscomp$93$$.href}`);
|
|
3874
|
+
return;
|
|
3875
|
+
}
|
|
3876
|
+
}
|
|
3868
3877
|
$dbg_log$$module$src$log$$("HTTP Dispatch: " + $target$jscomp$93$$.href, 16777216);
|
|
3869
3878
|
this.name = $target$jscomp$93$$.href;
|
|
3870
|
-
$
|
|
3871
|
-
-1 !== ["put", "post"].indexOf($
|
|
3872
|
-
const $fetch_url$jscomp$1$$ = this.net.cors_proxy ? this.net.cors_proxy + encodeURIComponent($target$jscomp$93$$.href) : $target$jscomp$93$$.href
|
|
3879
|
+
$headers_localport_opts$$ = {method:$first_line$$[0], headers:$req_headers$$, };
|
|
3880
|
+
-1 !== ["put", "post"].indexOf($headers_localport_opts$$.method.toLowerCase()) && ($headers_localport_opts$$.body = $data$jscomp$132_data$jscomp$133_offset$jscomp$48$$);
|
|
3881
|
+
const $fetch_url$jscomp$1$$ = this.net.cors_proxy ? this.net.cors_proxy + encodeURIComponent($target$jscomp$93$$.href) : $target$jscomp$93$$.href;
|
|
3882
|
+
new TextEncoder;
|
|
3873
3883
|
let $response_started$$ = !1;
|
|
3874
|
-
this.net.fetch($fetch_url$jscomp$1$$, $
|
|
3875
|
-
|
|
3876
|
-
|
|
3877
|
-
|
|
3878
|
-
|
|
3879
|
-
|
|
3884
|
+
this.net.fetch($fetch_url$jscomp$1$$, $headers_localport_opts$$).then($resp$jscomp$1$$ => {
|
|
3885
|
+
let $resp_headers$$ = new Headers($resp$jscomp$1$$.headers);
|
|
3886
|
+
$resp_headers$$.delete("content-encoding");
|
|
3887
|
+
$resp_headers$$.delete("keep-alive");
|
|
3888
|
+
$resp_headers$$.delete("content-length");
|
|
3889
|
+
$resp_headers$$.delete("transfer-encoding");
|
|
3890
|
+
$resp_headers$$.set("x-was-fetch-redirected", `${!!$resp$jscomp$1$$.redirected}`);
|
|
3891
|
+
$resp_headers$$.set("x-fetch-resp-url", $resp$jscomp$1$$.url);
|
|
3892
|
+
$resp_headers$$.set("connection", "close");
|
|
3893
|
+
this.write(this.net.form_response_head($resp$jscomp$1$$.status, $resp$jscomp$1$$.statusText, $resp_headers$$));
|
|
3880
3894
|
$response_started$$ = !0;
|
|
3881
3895
|
if ($resp$jscomp$1$$.body && $resp$jscomp$1$$.body.getReader) {
|
|
3882
|
-
const $resp_reader$$ = $resp$jscomp$1$$.body.getReader(), $pump$$ = ({value:$value$jscomp$
|
|
3883
|
-
$value$jscomp$
|
|
3896
|
+
const $resp_reader$$ = $resp$jscomp$1$$.body.getReader(), $pump$$ = ({value:$value$jscomp$136$$, done:$done$jscomp$3$$}) => {
|
|
3897
|
+
$value$jscomp$136$$ && this.write($value$jscomp$136$$);
|
|
3884
3898
|
if ($done$jscomp$3$$) {
|
|
3885
3899
|
this.close();
|
|
3886
3900
|
} else {
|
|
@@ -3894,21 +3908,33 @@ async function $on_data_http$$module$src$browser$fetch_network$$($data$jscomp$13
|
|
|
3894
3908
|
this.close();
|
|
3895
3909
|
});
|
|
3896
3910
|
}
|
|
3897
|
-
}).catch($
|
|
3898
|
-
console.warn("Fetch Failed: " + $fetch_url$jscomp$1$$ + "\n" + $
|
|
3899
|
-
$response_started$$ || (
|
|
3911
|
+
}).catch($e$jscomp$17$$ => {
|
|
3912
|
+
console.warn("Fetch Failed: " + $fetch_url$jscomp$1$$ + "\n" + $e$jscomp$17$$);
|
|
3913
|
+
$response_started$$ || this.net.respond_text_and_close(this, 502, "Fetch Error", `Fetch ${$fetch_url$jscomp$1$$} failed:\n\n${$e$jscomp$17$$.stack || $e$jscomp$17$$.message}`);
|
|
3900
3914
|
this.close();
|
|
3901
3915
|
});
|
|
3902
3916
|
}
|
|
3903
3917
|
}
|
|
3904
|
-
$FetchNetworkAdapter$$module$src$browser$fetch_network$$.prototype.fetch = async function($url$jscomp$25$$, $
|
|
3918
|
+
$FetchNetworkAdapter$$module$src$browser$fetch_network$$.prototype.fetch = async function($url$jscomp$25$$, $options$jscomp$39$$) {
|
|
3905
3919
|
this.cors_proxy && ($url$jscomp$25$$ = this.cors_proxy + encodeURIComponent($url$jscomp$25$$));
|
|
3906
3920
|
try {
|
|
3907
|
-
const $resp$jscomp$2$$ = await fetch($url$jscomp$25$$, $
|
|
3921
|
+
const $resp$jscomp$2$$ = await fetch($url$jscomp$25$$, $options$jscomp$39$$), $ab$jscomp$1$$ = await $resp$jscomp$2$$.arrayBuffer();
|
|
3908
3922
|
return [$resp$jscomp$2$$, $ab$jscomp$1$$];
|
|
3909
3923
|
} catch ($e$jscomp$18$$) {
|
|
3910
|
-
return console.warn("Fetch Failed: " + $url$jscomp$25$$ + "\n" + $e$jscomp$18$$),
|
|
3924
|
+
return console.warn("Fetch Failed: " + $url$jscomp$25$$ + "\n" + $e$jscomp$18$$), [{status:502, statusText:"Fetch Error", headers:new Headers({"Content-Type":"text/plain"}), }, (new TextEncoder).encode(`Fetch ${$url$jscomp$25$$} failed:\n\n${$e$jscomp$18$$.stack}`).buffer];
|
|
3925
|
+
}
|
|
3926
|
+
};
|
|
3927
|
+
$FetchNetworkAdapter$$module$src$browser$fetch_network$$.prototype.form_response_head = function($lines_status_code$$, $status_text$$, $headers$jscomp$1$$) {
|
|
3928
|
+
$lines_status_code$$ = [`HTTP/1.1 ${$lines_status_code$$} ${$status_text$$}`];
|
|
3929
|
+
for (const [$key$jscomp$37$$, $value$jscomp$137$$] of $headers$jscomp$1$$.entries()) {
|
|
3930
|
+
$lines_status_code$$.push(`${$key$jscomp$37$$}: ${$value$jscomp$137$$}`);
|
|
3911
3931
|
}
|
|
3932
|
+
return (new TextEncoder).encode($lines_status_code$$.join("\r\n") + "\r\n\r\n");
|
|
3933
|
+
};
|
|
3934
|
+
$FetchNetworkAdapter$$module$src$browser$fetch_network$$.prototype.respond_text_and_close = function($conn$jscomp$2$$, $status_code$jscomp$1$$, $status_text$jscomp$1$$, $body$jscomp$1$$) {
|
|
3935
|
+
const $headers$jscomp$2$$ = new Headers({"content-type":"text/plain", "content-length":$body$jscomp$1$$.length.toString(10), connection:"close"});
|
|
3936
|
+
$conn$jscomp$2$$.writev([this.form_response_head($status_code$jscomp$1$$, $status_text$jscomp$1$$, $headers$jscomp$2$$), (new TextEncoder).encode($body$jscomp$1$$)]);
|
|
3937
|
+
$conn$jscomp$2$$.close();
|
|
3912
3938
|
};
|
|
3913
3939
|
$FetchNetworkAdapter$$module$src$browser$fetch_network$$.prototype.parse_http_header = function($header$jscomp$4_key$jscomp$38$$) {
|
|
3914
3940
|
var $parts$jscomp$3_value$jscomp$138$$ = $header$jscomp$4_key$jscomp$38$$.match(/^([^:]*):(.*)$/);
|
|
@@ -4056,25 +4082,25 @@ $WispNetworkAdapter$$module$src$browser$wisp_network$$.prototype.destroy = funct
|
|
|
4056
4082
|
this.wispws && (this.wispws.onmessage = null, this.wispws.onclose = null, this.wispws.close(), this.wispws = null);
|
|
4057
4083
|
};
|
|
4058
4084
|
$WispNetworkAdapter$$module$src$browser$wisp_network$$.prototype.on_tcp_connection = function($packet$jscomp$15$$, $tuple$jscomp$3$$) {
|
|
4059
|
-
let $conn$jscomp$
|
|
4060
|
-
$conn$jscomp$
|
|
4061
|
-
$conn$jscomp$
|
|
4062
|
-
$conn$jscomp$
|
|
4063
|
-
$conn$jscomp$
|
|
4064
|
-
this.tcp_conn[$tuple$jscomp$3$$] = $conn$jscomp$
|
|
4065
|
-
$conn$jscomp$
|
|
4066
|
-
0 !== $data$jscomp$138$$.length && this.send_wisp_frame({type:"DATA", stream_id:$conn$jscomp$
|
|
4067
|
-
});
|
|
4068
|
-
$conn$jscomp$
|
|
4069
|
-
this.send_wisp_frame({type:"CLOSE", stream_id:$conn$jscomp$
|
|
4085
|
+
let $conn$jscomp$3$$ = new $TCPConnection$$module$src$browser$fake_network$$;
|
|
4086
|
+
$conn$jscomp$3$$.state = "syn-received";
|
|
4087
|
+
$conn$jscomp$3$$.net = this;
|
|
4088
|
+
$conn$jscomp$3$$.tuple = $tuple$jscomp$3$$;
|
|
4089
|
+
$conn$jscomp$3$$.stream_id = this.last_stream++;
|
|
4090
|
+
this.tcp_conn[$tuple$jscomp$3$$] = $conn$jscomp$3$$;
|
|
4091
|
+
$conn$jscomp$3$$.on("data", $data$jscomp$138$$ => {
|
|
4092
|
+
0 !== $data$jscomp$138$$.length && this.send_wisp_frame({type:"DATA", stream_id:$conn$jscomp$3$$.stream_id, data:$data$jscomp$138$$});
|
|
4093
|
+
});
|
|
4094
|
+
$conn$jscomp$3$$.on_close = () => {
|
|
4095
|
+
this.send_wisp_frame({type:"CLOSE", stream_id:$conn$jscomp$3$$.stream_id, reason:2});
|
|
4070
4096
|
};
|
|
4071
|
-
$conn$jscomp$
|
|
4072
|
-
this.send_wisp_frame({type:"CONNECT", stream_id:$conn$jscomp$
|
|
4073
|
-
$conn$jscomp$
|
|
4097
|
+
$conn$jscomp$3$$.on_shutdown = $conn$jscomp$3$$.on_close;
|
|
4098
|
+
this.send_wisp_frame({type:"CONNECT", stream_id:$conn$jscomp$3$$.stream_id, hostname:$packet$jscomp$15$$.ipv4.dest.join("."), port:$packet$jscomp$15$$.tcp.dport, data_callback:$data$jscomp$139$$ => {
|
|
4099
|
+
$conn$jscomp$3$$.write($data$jscomp$139$$);
|
|
4074
4100
|
}, close_callback:() => {
|
|
4075
|
-
$conn$jscomp$
|
|
4101
|
+
$conn$jscomp$3$$.close();
|
|
4076
4102
|
}});
|
|
4077
|
-
$conn$jscomp$
|
|
4103
|
+
$conn$jscomp$3$$.accept($packet$jscomp$15$$);
|
|
4078
4104
|
return !0;
|
|
4079
4105
|
};
|
|
4080
4106
|
$WispNetworkAdapter$$module$src$browser$wisp_network$$.prototype.send = function($data$jscomp$141$$) {
|
|
@@ -9736,12 +9762,12 @@ $VGAScreen$$module$src$vga$$.prototype.update_vga_size = function() {
|
|
|
9736
9762
|
if ($horizontal_characters_screen_width$$ && $screen_height_vertical_scans$$) {
|
|
9737
9763
|
if (this.graphical_mode) {
|
|
9738
9764
|
$horizontal_characters_screen_width$$ <<= 3;
|
|
9739
|
-
var $height$jscomp$30_virtual_width$jscomp$1$$ = this.offset_register << 4;
|
|
9740
|
-
this.attribute_mode & 64
|
|
9765
|
+
var $height$jscomp$30_virtual_width$jscomp$1$$ = this.offset_register << 4, $bpp$jscomp$1$$ = 4;
|
|
9766
|
+
this.attribute_mode & 64 ? ($horizontal_characters_screen_width$$ >>>= 1, $height$jscomp$30_virtual_width$jscomp$1$$ >>>= 1, $bpp$jscomp$1$$ = 8) : this.attribute_mode & 2 && ($bpp$jscomp$1$$ = 1);
|
|
9741
9767
|
$screen_height_vertical_scans$$ = this.scan_line_to_screen_row($screen_height_vertical_scans$$);
|
|
9742
9768
|
var $available_bytes$$ = $VGA_HOST_MEMORY_SPACE_SIZE$$module$src$vga$$[0];
|
|
9743
9769
|
const $bytes_per_line$jscomp$1$$ = this.vga_bytes_per_line();
|
|
9744
|
-
this.set_size_graphical($horizontal_characters_screen_width$$, $screen_height_vertical_scans$$, $height$jscomp$30_virtual_width$jscomp$1$$, $bytes_per_line$jscomp$1$$ ? Math.ceil($available_bytes$$ / $bytes_per_line$jscomp$1$$) : $screen_height_vertical_scans$$,
|
|
9770
|
+
this.set_size_graphical($horizontal_characters_screen_width$$, $screen_height_vertical_scans$$, $height$jscomp$30_virtual_width$jscomp$1$$, $bytes_per_line$jscomp$1$$ ? Math.ceil($available_bytes$$ / $bytes_per_line$jscomp$1$$) : $screen_height_vertical_scans$$, $bpp$jscomp$1$$);
|
|
9745
9771
|
this.update_vertical_retrace();
|
|
9746
9772
|
this.update_layers();
|
|
9747
9773
|
} else {
|
|
@@ -11474,9 +11500,9 @@ $CPU$$module$src$cpu$$.prototype.debug_init = function() {
|
|
|
11474
11500
|
};
|
|
11475
11501
|
$debug$$.get_regs_short = $get_regs_short$$;
|
|
11476
11502
|
$debug$$.dump_regs = function() {
|
|
11477
|
-
var $lines$$ = $get_regs_short$$();
|
|
11478
|
-
$dbg_log$$module$src$log$$($lines$$[0], 2);
|
|
11479
|
-
$dbg_log$$module$src$log$$($lines$$[1], 2);
|
|
11503
|
+
var $lines$jscomp$1$$ = $get_regs_short$$();
|
|
11504
|
+
$dbg_log$$module$src$log$$($lines$jscomp$1$$[0], 2);
|
|
11505
|
+
$dbg_log$$module$src$log$$($lines$jscomp$1$$[1], 2);
|
|
11480
11506
|
};
|
|
11481
11507
|
$debug$$.get_state = $get_state$$;
|
|
11482
11508
|
$debug$$.dump_state = function($where$jscomp$3$$) {
|