@@ -58,6 +58,8 @@ function __uvHook(window) {
5858 const methodPrefix = '__uv$' ;
5959 const __uv = new Ultraviolet ( __uv$config ) ;
6060
61+ const OldWebSocket = WebSocket ;
62+
6163 /*if (typeof config.construct === 'function') {
6264 config.construct(__uv, worker ? 'worker' : 'window');
6365 }*/
@@ -109,7 +111,7 @@ function __uvHook(window) {
109111 __uv . sessionStorageObj = { } ;
110112
111113 // websockets
112- const bareClient = new Ultraviolet . BareClient ( __uv$bareURL , __uv$bareData ) ;
114+ const bareClient = new Ultraviolet . BareClient ( ) ;
113115
114116 __uv . bareClient = bareClient ;
115117
@@ -480,19 +482,19 @@ function __uvHook(window) {
480482 event . respondWith (
481483 worker
482484 ? call (
483- event . target ,
484- [ event . data . message , event . data . transfer ] ,
485- event . that
486- )
485+ event . target ,
486+ [ event . data . message , event . data . transfer ] ,
487+ event . that
488+ )
487489 : call (
488- event . target ,
489- [
490- event . data . message ,
491- event . data . origin ,
492- event . data . transfer ,
493- ] ,
494- event . that
495- )
490+ event . target ,
491+ [
492+ event . data . message ,
493+ event . data . origin ,
494+ event . data . transfer ,
495+ ] ,
496+ event . that
497+ )
496498 ) ;
497499 } ) ;
498500
@@ -1073,10 +1075,9 @@ function __uvHook(window) {
10731075
10741076 this . #socket = await bareClient . createWebSocket (
10751077 url ,
1076- requestHeaders ,
10771078 protocol ,
1078- __uv$config . proxyIp ,
1079- __uv$config . proxyPort
1079+ OldWebSocket ,
1080+ requestHeaders
10801081 ) ;
10811082
10821083 this . #socket. binaryType = this . #binaryType;
@@ -1097,18 +1098,16 @@ function __uvHook(window) {
10971098 this . dispatchEvent ( new Event ( 'close' , event ) ) ;
10981099 } ) ;
10991100
1100- const meta = await this . #socket. meta ;
1101-
1102- if ( meta . headers . has ( 'sec-websocket-protocol' ) )
1103- this . #protocol = meta . headers . get ( 'sec-websocket-protocol' ) ;
1104-
1105- if ( meta . headers . has ( 'sec-websocket-extensions' ) )
1106- this . #extensions = meta . headers . get ( 'sec-websocket-extensions' ) ;
1107-
1108- let setCookie = meta . rawHeaders [ 'set-cookie' ] || [ ] ;
1109- if ( ! Array . isArray ( setCookie ) ) setCookie = [ ] ;
1110- // trip the hook
1111- for ( const cookie of setCookie ) document . cookie = cookie ;
1101+ // const meta = await this.#socket.meta;
1102+ //
1103+ // if (meta && meta.headers['sec-websocket-protocol'])
1104+ // this.#protocol = meta.headers['sec-websocket-protocol'];
1105+ //
1106+ //
1107+ // let setCookie = meta.rawHeaders['set-cookie'] || [];
1108+ // if (!Array.isArray(setCookie)) setCookie = [];
1109+ // // trip the hook
1110+ // for (const cookie of setCookie) document.cookie = cookie;
11121111 }
11131112 get url ( ) {
11141113 return this . #url;
@@ -1142,10 +1141,10 @@ function __uvHook(window) {
11421141 this . #ready = this . #open( parsed , protocol ) ;
11431142 }
11441143 get protocol ( ) {
1145- return this . #protocol;
1144+ return this . #socket . protocol ;
11461145 }
11471146 get extensions ( ) {
1148- return this . #extensions;
1147+ return this . #socket . extensions ;
11491148 }
11501149 get readyState ( ) {
11511150 if ( this . #socket) {
@@ -1465,13 +1464,13 @@ function __uvHook(window) {
14651464 return target . call ( that , url ) ;
14661465 } ) ;
14671466
1468- __uv . $wrap = function ( name ) {
1467+ __uv . $wrap = function ( name ) {
14691468 if ( name === 'location' ) return __uv . methods . location ;
14701469 if ( name === 'eval' ) return __uv . methods . eval ;
14711470 return name ;
14721471 } ;
14731472
1474- __uv . $get = function ( that ) {
1473+ __uv . $get = function ( that ) {
14751474 if ( that === window . location ) return __uv . location ;
14761475 if ( that === window . eval ) return __uv . eval ;
14771476 if ( that === window . parent ) {
@@ -1492,11 +1491,11 @@ function __uvHook(window) {
14921491 return target . call ( that , script ) ;
14931492 } ) ;
14941493
1495- __uv . call = function ( target , args , that ) {
1494+ __uv . call = function ( target , args , that ) {
14961495 return that ? target . apply ( that , args ) : target ( ...args ) ;
14971496 } ;
14981497
1499- __uv . call$ = function ( obj , prop , args = [ ] ) {
1498+ __uv . call$ = function ( obj , prop , args = [ ] ) {
15001499 return obj [ prop ] . apply ( obj , args ) ;
15011500 } ;
15021501
@@ -1511,7 +1510,7 @@ function __uvHook(window) {
15111510 window . Object . prototype ,
15121511 __uv . methods . setSource ,
15131512 {
1514- value : function ( source ) {
1513+ value : function ( source ) {
15151514 if ( ! client . nativeMethods . isExtensible ( this ) ) return this ;
15161515
15171516 client . nativeMethods . defineProperty ( this , __uv . methods . source , {
0 commit comments