fix: ensure the sandboxed preloads globals do not leak (#17712)
This commit is contained in:
parent
b3d8db6996
commit
be6fb7cb12
6 changed files with 157 additions and 6 deletions
19
build/js_wrap.py
Normal file
19
build/js_wrap.py
Normal file
|
@ -0,0 +1,19 @@
|
|||
import sys
|
||||
|
||||
in_start = sys.argv.index("--in") + 1
|
||||
out_start = sys.argv.index("--out") + 1
|
||||
|
||||
in_bundles = sys.argv[in_start:out_start - 1]
|
||||
out_bundles = sys.argv[out_start:]
|
||||
|
||||
if len(in_bundles) is not len(out_bundles):
|
||||
print("--out and --in must provide the same number of arguments")
|
||||
sys.exit(1)
|
||||
|
||||
for i in range(len(in_bundles)):
|
||||
in_bundle = in_bundles[i]
|
||||
out_path = out_bundles[i]
|
||||
with open(in_bundle, 'r') as f:
|
||||
lines = ["(function(){var exports={},module={exports};"] + f.readlines() + ["})();"]
|
||||
with open(out_path, 'w') as out_f:
|
||||
out_f.writelines(lines)
|
Loading…
Add table
Add a link
Reference in a new issue