@@ -41,7 +41,7 @@ mergeInto(LibraryManager.library, {
4141
4242 fs_export_file : function ( filename , buf , buf_len )
4343 {
44- var _filename = Pointer_stringify ( filename ) ;
44+ var _filename = UTF8ToString ( filename ) ;
4545// console.log("exporting " + _filename);
4646 var data = HEAPU8 . subarray ( buf , buf + buf_len ) ;
4747 var file = new Blob ( [ data ] , { type : "application/octet-stream" } ) ;
@@ -58,20 +58,21 @@ mergeInto(LibraryManager.library, {
5858 } , 50 ) ;
5959 } ,
6060
61+ emscripten_async_wget3_data__deps : [ "$wget" , "$Browser" ] ,
6162 emscripten_async_wget3_data : function ( url , request , user , password , post_data , post_data_len , arg , free , onload , onerror , onprogress ) {
62- var _url = Pointer_stringify ( url ) ;
63- var _request = Pointer_stringify ( request ) ;
63+ var _url = UTF8ToString ( url ) ;
64+ var _request = UTF8ToString ( request ) ;
6465 var _user ;
6566 var _password ;
6667
6768 var http = new XMLHttpRequest ( ) ;
6869
6970 if ( user )
70- _user = Pointer_stringify ( user ) ;
71+ _user = UTF8ToString ( user ) ;
7172 else
7273 _user = null ;
7374 if ( password )
74- _password = Pointer_stringify ( password ) ;
75+ _password = UTF8ToString ( password ) ;
7576 else
7677 _password = null ;
7778
@@ -81,38 +82,38 @@ mergeInto(LibraryManager.library, {
8182 http . setRequestHeader ( "Authorization" , "Basic " + btoa ( _user + ':' + _password ) ) ;
8283 }
8384
84- var handle = Browser . getNextWgetRequestHandle ( ) ;
85+ var handle = wget . getNextWgetRequestHandle ( ) ;
8586
8687 // LOAD
8788 http . onload = function http_onload ( e ) {
8889 if ( http . status == 200 || _url . substr ( 0 , 4 ) . toLowerCase ( ) != "http" ) {
8990 var byteArray = new Uint8Array ( http . response ) ;
9091 var buffer = _malloc ( byteArray . length ) ;
9192 HEAPU8 . set ( byteArray , buffer ) ;
92- if ( onload ) Runtime . dynCall ( 'viiii' , onload , [ handle , arg , buffer , byteArray . length ] ) ;
93+ if ( onload ) dynCall ( 'viiii' , onload , [ handle , arg , buffer , byteArray . length ] ) ;
9394 if ( free ) _free ( buffer ) ;
9495 } else {
95- if ( onerror ) Runtime . dynCall ( 'viiii' , onerror , [ handle , arg , http . status , http . statusText ] ) ;
96+ if ( onerror ) dynCall ( 'viiii' , onerror , [ handle , arg , http . status , http . statusText ] ) ;
9697 }
97- delete Browser . wgetRequests [ handle ] ;
98+ delete wget . wgetRequests [ handle ] ;
9899 } ;
99100
100101 // ERROR
101102 http . onerror = function http_onerror ( e ) {
102103 if ( onerror ) {
103- Runtime . dynCall ( 'viiii' , onerror , [ handle , arg , http . status , http . statusText ] ) ;
104+ dynCall ( 'viiii' , onerror , [ handle , arg , http . status , http . statusText ] ) ;
104105 }
105- delete Browser . wgetRequests [ handle ] ;
106+ delete wget . wgetRequests [ handle ] ;
106107 } ;
107108
108109 // PROGRESS
109110 http . onprogress = function http_onprogress ( e ) {
110- if ( onprogress ) Runtime . dynCall ( 'viiii' , onprogress , [ handle , arg , e . loaded , e . lengthComputable || e . lengthComputable === undefined ? e . total : 0 ] ) ;
111+ if ( onprogress ) dynCall ( 'viiii' , onprogress , [ handle , arg , e . loaded , e . lengthComputable || e . lengthComputable === undefined ? e . total : 0 ] ) ;
111112 } ;
112113
113114 // ABORT
114115 http . onabort = function http_onabort ( e ) {
115- delete Browser . wgetRequests [ handle ] ;
116+ delete wget . wgetRequests [ handle ] ;
116117 } ;
117118
118119 // Useful because the browser can limit the number of redirection
@@ -132,7 +133,7 @@ mergeInto(LibraryManager.library, {
132133 http . send ( null ) ;
133134 }
134135
135- Browser . wgetRequests [ handle ] = http ;
136+ wget . wgetRequests [ handle ] = http ;
136137
137138 return handle ;
138139 } ,
0 commit comments