mirror of
https://github.com/MercuryWorkshop/scramjet.git
synced 2025-05-15 23:30:00 -04:00
fix: websocket prototype
This commit is contained in:
parent
51f1a773a4
commit
58fed66f78
5 changed files with 221 additions and 222 deletions
|
@ -6,11 +6,8 @@ export const enabled = (client: ScramjetClient) =>
|
|||
export function argdbg(arg, recurse = []) {
|
||||
switch (typeof arg) {
|
||||
case "string":
|
||||
if (arg.includes("localhost:1337/scramjet/") && arg.includes("m3u8"))
|
||||
debugger;
|
||||
break;
|
||||
case "object":
|
||||
// if (arg instanceof Location) debugger;
|
||||
if (
|
||||
arg &&
|
||||
arg[Symbol.iterator] &&
|
||||
|
|
|
@ -21,7 +21,7 @@ export default function (client: ScramjetClient, self: typeof globalThis) {
|
|||
client.Proxy("WebSocket", {
|
||||
construct(ctx) {
|
||||
const fakeWebSocket = new EventTarget() as WebSocket;
|
||||
Object.setPrototypeOf(fakeWebSocket, self.WebSocket.prototype);
|
||||
Object.setPrototypeOf(fakeWebSocket, ctx.fn.prototype);
|
||||
fakeWebSocket.constructor = ctx.fn;
|
||||
|
||||
const trustEvent = (ev: Event) =>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue