Skip to content

Commit 4bc6ed6

Browse files
authored
fix isDataURI, it must be used in the HTML as well as JS (#5963)
1 parent ec2571b commit 4bc6ed6

File tree

3 files changed

+13
-12
lines changed

3 files changed

+13
-12
lines changed

emcc.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2609,8 +2609,8 @@ def generate_html(target, options, js_target, target_basename,
26092609

26102610
# when script.inline isn't empty, add required helper functions such as tryParseAsDataURI
26112611
if script.inline:
2612-
for file in ['src/arrayUtils.js', 'src/base64Utils.js']:
2613-
f = open(shared.path_from_root(file), 'r')
2612+
for file in ['arrayUtils.js', 'base64Utils.js', 'URIUtils.js']:
2613+
f = open(shared.path_from_root('src', file), 'r')
26142614
script.inline = f.read() + script.inline
26152615
f.close()
26162616

src/URIUtils.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// Prefix of data URIs emitted by SINGLE_FILE and related options.
2+
var dataURIPrefix = 'data:application/octet-stream;base64,';
3+
4+
// Indicates whether filename is a base64 data URI.
5+
function isDataURI(filename) {
6+
return String.prototype.startsWith ?
7+
filename.startsWith(dataURIPrefix) :
8+
filename.indexOf(dataURIPrefix) === 0;
9+
}
10+

src/preamble.js

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1987,16 +1987,7 @@ Module['FS_createPreloadedFile'] = FS.createPreloadedFile;
19871987
var cyberDWARFFile = '{{{ BUNDLED_CD_DEBUG_FILE }}}';
19881988
#endif
19891989

1990-
// Prefix of data URIs emitted by SINGLE_FILE and related options.
1991-
var dataURIPrefix = 'data:application/octet-stream;base64,';
1992-
1993-
// Indicates whether filename is a base64 data URI.
1994-
function isDataURI(filename) {
1995-
return String.prototype.startsWith ?
1996-
filename.startsWith(dataURIPrefix) :
1997-
filename.indexOf(dataURIPrefix) === 0
1998-
;
1999-
}
1990+
#include "URIUtils.js"
20001991

20011992
#if BINARYEN
20021993
function integrateWasmJS() {

0 commit comments

Comments
 (0)