Skip to content

Commit 14018a6

Browse files
committed
Remove fetch polyfill
This change removes the fetch polyfill be bumping the minimum support version of browsers.
1 parent d5c419f commit 14018a6

File tree

6 files changed

+8
-173
lines changed

6 files changed

+8
-173
lines changed

ChangeLog.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,10 @@ See docs/process.md for more on how version tagging works.
2222
-----------------------
2323
- The file system was updated to independently track atime, mtime and ctime
2424
instead of using the same time for all three. (#22998)
25-
- The minimum supported chrome version was bumped from 32 to 33. (#23077)
25+
- The minimum supported versions of browser engines that we support were updated
26+
to versions that support Promise and Fetch APIs, and the polyfills for these
27+
were removed. Chrome 32 -> 42, Firefox 34 -> 40, Safari 9.0 -> 10.1. These
28+
browser engines version are all over 8 years old now. (#23077, #23118)
2629

2730
3.1.73 - 11/28/24
2831
-----------------

src/polyfill/fetch.js

-80
This file was deleted.

src/shell.js

-5
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,6 @@ var Module = typeof {{{ EXPORT_NAME }}} != 'undefined' ? {{{ EXPORT_NAME }}} : {
4343
// See https://caniuse.com/mdn-javascript_builtins_bigint64array
4444
#include "polyfill/bigint64array.js"
4545
#endif
46-
47-
#if MIN_CHROME_VERSION < 40 || MIN_FIREFOX_VERSION < 39 || MIN_SAFARI_VERSION < 103000
48-
// See https://caniuse.com/fetch
49-
#include "polyfill/fetch.js"
50-
#endif
5146
#endif // POLYFILL
5247

5348
#if MODULARIZE

test/browser_reporting.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@ function reportResultToServer(result) {
1111
if ((typeof ENVIRONMENT_IS_NODE !== 'undefined' && ENVIRONMENT_IS_NODE) || (typeof ENVIRONMENT_IS_AUDIO_WORKLET !== 'undefined' && ENVIRONMENT_IS_AUDIO_WORKLET)) {
1212
out(`RESULT: ${result}`);
1313
} else {
14-
let doFetch = typeof origFetch != 'undefined' ? origFetch : fetch;
15-
doFetch(`${reportingURL}/report_result?${encodeURIComponent(result)}`).then(() => {
14+
fetch(`${reportingURL}/report_result?${encodeURIComponent(result)}`).then(() => {
1615
if (typeof window === 'object' && window && hasModule && !Module['pageThrewException']) {
1716
/* for easy debugging, don't close window on failure */
1817
window.close();

test/test_browser.py

-82
Original file line numberDiff line numberDiff line change
@@ -5445,88 +5445,6 @@ def test_webpack(self, es6):
54455445
shutil.copy('webpack/src/hello.wasm', 'webpack/dist/')
54465446
self.run_browser('webpack/dist/index.html', '/report_result?exit:0')
54475447

5448-
def test_fetch_polyfill_preload(self):
5449-
create_file('hello.txt', 'hello, world!')
5450-
create_file('main.c', r'''
5451-
#include <stdio.h>
5452-
#include <string.h>
5453-
#include <emscripten.h>
5454-
int main() {
5455-
FILE *f = fopen("hello.txt", "r");
5456-
char buf[100];
5457-
fread(buf, 1, 20, f);
5458-
buf[20] = 0;
5459-
fclose(f);
5460-
printf("%s\n", buf);
5461-
return 0;
5462-
}''')
5463-
5464-
create_file('on_window_error_shell.html', r'''
5465-
<html>
5466-
<center><canvas id='canvas' width='256' height='256'></canvas></center>
5467-
<hr><div id='output'></div><hr>
5468-
<script type='text/javascript'>
5469-
window.addEventListener('error', event => {
5470-
const error = String(event.message);
5471-
window.disableErrorReporting = true;
5472-
window.onerror = null;
5473-
var xhr = new XMLHttpRequest();
5474-
xhr.open('GET', 'http://localhost:8888/report_result?exception:' + error.substr(-23), true);
5475-
xhr.send();
5476-
setTimeout(function() { window.close() }, 1000);
5477-
});
5478-
</script>
5479-
{{{ SCRIPT }}}
5480-
</body>
5481-
</html>''')
5482-
5483-
def test(args, expect_fail):
5484-
self.compile_btest('main.c', ['-sEXIT_RUNTIME', '--preload-file', 'hello.txt', '--shell-file', 'on_window_error_shell.html', '-o', 'a.out.html'] + args)
5485-
if expect_fail:
5486-
js = read_file('a.out.js')
5487-
create_file('a.out.js', 'let origFetch = fetch; fetch = undefined;\n' + js)
5488-
return self.run_browser('a.out.html', '/report_result?exception:fetch is not a function')
5489-
else:
5490-
return self.run_browser('a.out.html', '/report_result?exit:0')
5491-
5492-
test([], expect_fail=False)
5493-
test([], expect_fail=True)
5494-
test(['-sLEGACY_VM_SUPPORT'], expect_fail=False)
5495-
test(['-sLEGACY_VM_SUPPORT', '-sNO_POLYFILL'], expect_fail=True)
5496-
5497-
@no_wasm64('https://github.com/llvm/llvm-project/issues/98778')
5498-
def test_fetch_polyfill_shared_lib(self):
5499-
create_file('library.c', r'''
5500-
int library_func() {
5501-
return 42;
5502-
}
5503-
''')
5504-
create_file('main.c', r'''
5505-
#include <dlfcn.h>
5506-
#include <stdio.h>
5507-
int main() {
5508-
void *lib_handle = dlopen("/library.so", RTLD_NOW);
5509-
typedef int (*voidfunc)();
5510-
voidfunc x = (voidfunc)dlsym(lib_handle, "library_func");
5511-
return x();
5512-
}
5513-
''')
5514-
5515-
self.emcc('library.c', ['-sSIDE_MODULE', '-O2', '-o', 'library.so'])
5516-
5517-
def test(args, expect_fail):
5518-
self.compile_btest('main.c', ['-fPIC', 'library.so', '-sMAIN_MODULE=2', '-sEXIT_RUNTIME', '-o', 'a.out.html'] + args)
5519-
if expect_fail:
5520-
js = read_file('a.out.js')
5521-
create_file('a.out.js', 'let origFetch = fetch; fetch = undefined;\n' + js)
5522-
return self.run_browser('a.out.html', '/report_result?exception:fetch is not a function')
5523-
else:
5524-
return self.run_browser('a.out.html', '/report_result?exit:42')
5525-
5526-
test([], expect_fail=True)
5527-
test(['-sLEGACY_VM_SUPPORT'], expect_fail=False)
5528-
test(['-sLEGACY_VM_SUPPORT', '-sNO_POLYFILL'], expect_fail=True)
5529-
55305448

55315449
class emrun(RunnerCore):
55325450
def test_emrun_info(self):

tools/feature_matrix.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@
1818
# Oldest support browser versions. These have been set somewhat
1919
# arbitrarily for now.
2020
# TODO(sbc): Design a of policy for managing these values.
21-
OLDEST_SUPPORTED_CHROME = 33
22-
OLDEST_SUPPORTED_FIREFOX = 34
23-
OLDEST_SUPPORTED_SAFARI = 90000
21+
OLDEST_SUPPORTED_CHROME = 42 # April 14, 2015
22+
OLDEST_SUPPORTED_FIREFOX = 40 # August 11, 2015
23+
OLDEST_SUPPORTED_SAFARI = 101000 # September 20, 2016
2424
# 10.19.0 is the oldest version of node that we do any testing with.
2525
# Keep this in sync with the test-node-compat in .circleci/config.yml.
2626
OLDEST_SUPPORTED_NODE = 101900

0 commit comments

Comments
 (0)