Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 5 additions & 9 deletions test/browser/test_html5_fullscreen.html
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@
print: (function() {
var element = document.getElementById('output');
if (element) element.value = ''; // clear browser cache
return function(text) {
if (arguments.length > 1) text = Array.prototype.slice.call(arguments).join(' ');
return (...args) => {
var text = args.join(' ');
// These replacements are necessary if you render to raw HTML
//text = text.replace(/&/g, "&");
//text = text.replace(/</g, "&lt;");
Expand All @@ -91,13 +91,9 @@
}
};
})(),
printErr: function(text) {
if (arguments.length > 1) text = Array.prototype.slice.call(arguments).join(' ');
if (0) { // XXX disabled for safety typeof dump == 'function') {
dump(text + '\n'); // fast, straight to the real console
} else {
console.error(text);
}
printErr(..args) {
var text = args.join(' ');
console.error(text);
},
canvas: (function() {
var canvas = document.getElementById('canvas');
Expand Down
14 changes: 5 additions & 9 deletions test/browser/test_manual_download_data.html
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@
print: (() => {
var element = document.getElementById('output');
if (element) element.value = ''; // clear browser cache
return function(text) {
if (arguments.length > 1) text = Array.prototype.slice.call(arguments).join(' ');
return (...args) => {
var text = args.join(' ');
// These replacements are necessary if you render to raw HTML
//text = text.replace(/&/g, "&amp;");
//text = text.replace(/</g, "&lt;");
Expand All @@ -91,13 +91,9 @@
}
};
})(),
printErr: (text) => {
if (arguments.length > 1) text = Array.prototype.slice.call(arguments).join(' ');
if (0) { // XXX disabled for safety typeof dump == 'function') {
dump(text + '\n'); // fast, straight to the real console
} else {
console.error(text);
}
printErr(..args) {
var text = args.join(' ');
console.error(text);
},
canvas: (() => {
var canvas = document.getElementById('canvas');
Expand Down
14 changes: 5 additions & 9 deletions test/browser/test_preallocated_heap_shell.html
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@
print: (function() {
var element = document.getElementById('output');
if (element) element.value = ''; // clear browser cache
return function(text) {
if (arguments.length > 1) text = Array.prototype.slice.call(arguments).join(' ');
return (...args) => {
var text = args.join(' ');
// These replacements are necessary if you render to raw HTML
//text = text.replace(/&/g, "&amp;");
//text = text.replace(/</g, "&lt;");
Expand All @@ -93,13 +93,9 @@
}
};
})(),
printErr: function(text) {
if (arguments.length > 1) text = Array.prototype.slice.call(arguments).join(' ');
if (0) { // XXX disabled for safety typeof dump == 'function') {
dump(text + '\n'); // fast, straight to the real console
} else {
console.error(text);
}
printErr(..args) {
var text = args.join(' ');
console.error(text);
},
canvas: (function() {
var canvas = document.getElementById('canvas');
Expand Down
14 changes: 5 additions & 9 deletions test/browser/test_preinitialized_webgl_context.html
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@
print: (function() {
var element = document.getElementById('output');
if (element) element.value = ''; // clear browser cache
return function(text) {
if (arguments.length > 1) text = Array.prototype.slice.call(arguments).join(' ');
return (...args) => {
var text = args.join(' ');
// These replacements are necessary if you render to raw HTML
//text = text.replace(/&/g, "&amp;");
//text = text.replace(/</g, "&lt;");
Expand All @@ -91,13 +91,9 @@
}
};
})(),
printErr: function(text) {
if (arguments.length > 1) text = Array.prototype.slice.call(arguments).join(' ');
if (0) { // XXX disabled for safety typeof dump == 'function') {
dump(text + '\n'); // fast, straight to the real console
} else {
console.error(text);
}
printErr(..args) {
var text = args.join(' ');
console.error(text);
},
canvas: (function() {
var canvas = document.getElementById('canvas');
Expand Down
14 changes: 5 additions & 9 deletions test/browser/test_sdl_canvas_size.html
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@
print: (function() {
var element = document.getElementById('output');
element.value = ''; // clear browser cache
return function(text) {
if (arguments.length > 1) text = Array.prototype.slice.call(arguments).join(' ');
return (...args) => {
var text = args.join(' ');
// These replacements are necessary if you render to raw HTML
//text = text.replace(/&/g, "&amp;");
//text = text.replace(/</g, "&lt;");
Expand All @@ -52,13 +52,9 @@
element.scrollTop = element.scrollHeight; // focus on bottom
};
})(),
printErr: function(text) {
if (arguments.length > 1) text = Array.prototype.slice.call(arguments).join(' ');
if (0) { // XXX disabled for safety typeof dump == 'function') {
dump(text + '\n'); // fast, straight to the real console
} else {
console.log(text);
}
printErr(..args) {
var text = args.join(' ');
console.error(text);
},
canvas: document.getElementById('canvas'),
setStatus: function(text) {
Expand Down
14 changes: 5 additions & 9 deletions test/browser/webgl_destroy_context_shell.html
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@
print: (function() {
var element = document.getElementById('output');
if (element) element.value = ''; // clear browser cache
return function(text) {
if (arguments.length > 1) text = Array.prototype.slice.call(arguments).join(' ');
return (...args) => {
var text = args.join(' ');
// These replacements are necessary if you render to raw HTML
//text = text.replace(/&/g, "&amp;");
//text = text.replace(/</g, "&lt;");
Expand All @@ -91,13 +91,9 @@
}
};
})(),
printErr: function(text) {
if (arguments.length > 1) text = Array.prototype.slice.call(arguments).join(' ');
if (0) { // XXX disabled for safety typeof dump == 'function') {
dump(text + '\n'); // fast, straight to the real console
} else {
console.error(text);
}
printErr(..args) {
var text = args.join(' ');
console.error(text);
},
canvas: (function() {
var canvas = document.getElementById('canvas');
Expand Down
31 changes: 6 additions & 25 deletions test/canvas_animate_resize_shell.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,41 +12,22 @@
<textarea class="emscripten" id="output" rows="8" style='width:80%'></textarea>
<script type='text/javascript'>
var Module = {
print: (function() {
print: (() => {
var element = document.getElementById('output');
if (element) element.value = ''; // clear browser cache
return function(text) {
if (arguments.length > 1) text = Array.prototype.slice.call(arguments).join(' ');
// These replacements are necessary if you render to raw HTML
//text = text.replace(/&/g, "&amp;");
//text = text.replace(/</g, "&lt;");
//text = text.replace(/>/g, "&gt;");
//text = text.replace('\n', '<br>', 'g');
return (...args) => {
var text = args.join(' ');
console.log(text);
if (element) {
element.value += text + "\n";
element.scrollTop = element.scrollHeight; // focus on bottom
}
};
})(),
printErr: function(text) {
if (arguments.length > 1) text = Array.prototype.slice.call(arguments).join(' ');
if (0) { // XXX disabled for safety typeof dump == 'function') {
dump(text + '\n'); // fast, straight to the real console
} else {
console.error(text);
}
printErr(..args) {
var text = args.join(' ');
console.error(text);
},
canvas: (function() {
var canvas = document.getElementById('canvas');

// As a default initial behavior, pop up an alert when webgl context is lost. To make your
// application robust, you may want to override this behavior before shipping!
// See http://www.khronos.org/registry/webgl/specs/latest/1.0/#5.15.2
canvas.addEventListener("webglcontextlost", function(e) { alert('WebGL context lost. You will need to reload the page.'); e.preventDefault(); }, false);

return canvas;
})(),
};
</script>
{{{ SCRIPT }}}
Expand Down
14 changes: 5 additions & 9 deletions test/embind/shell.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@
print: (function() {
var element = document.getElementById('output');
element.value = ''; // clear browser cache
return function(text) {
if (arguments.length > 1) text = Array.prototype.slice.call(arguments).join(' ');
return (...args) => {
var text = args.join(' ');
// These replacements are necessary if you render to raw HTML
//text = text.replace(/&/g, "&amp;");
//text = text.replace(/</g, "&lt;");
Expand All @@ -49,13 +49,9 @@
element.scrollTop = element.scrollHeight; // focus on bottom
};
})(),
printErr: function(text) {
if (arguments.length > 1) text = Array.prototype.slice.call(arguments).join(' ');
if (0) { // XXX disabled for safety typeof dump == 'function') {
dump(text + '\n'); // fast, straight to the real console
} else {
console.log(text);
}
printErr(..args) {
var text = args.join(' ');
console.error(text);
},
canvas: document.getElementById('canvas'),
setStatus: function(text) {
Expand Down
14 changes: 5 additions & 9 deletions test/pthread/main_js_with_loader.html
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@
print: (function() {
var element = document.getElementById('output');
if (element) element.value = ''; // clear browser cache
return function(text) {
if (arguments.length > 1) text = Array.prototype.slice.call(arguments).join(' ');
return (...args) => {
var text = args.join(' ');
// These replacements are necessary if you render to raw HTML
//text = text.replace(/&/g, "&amp;");
//text = text.replace(/</g, "&lt;");
Expand All @@ -91,13 +91,9 @@
}
};
})(),
printErr: function(text) {
if (arguments.length > 1) text = Array.prototype.slice.call(arguments).join(' ');
if (0) { // XXX disabled for safety typeof dump == 'function') {
dump(text + '\n'); // fast, straight to the real console
} else {
console.error(text);
}
printErr(..args) {
var text = args.join(' ');
console.error(text);
},
canvas: (function() {
var canvas = document.getElementById('canvas');
Expand Down
14 changes: 5 additions & 9 deletions test/pthread/test_pthread_mandelbrot_shell.html
Original file line number Diff line number Diff line change
Expand Up @@ -1227,8 +1227,8 @@
print: (function() {
var element = document.getElementById('output');
if (element) element.value = ''; // clear browser cache
return function(text) {
if (arguments.length > 1) text = Array.prototype.slice.call(arguments).join(' ');
return (...args) => {
var text = args.join(' ');
// These replacements are necessary if you render to raw HTML
//text = text.replace(/&/g, "&amp;");
//text = text.replace(/</g, "&lt;");
Expand All @@ -1241,13 +1241,9 @@
}
};
})(),
printErr: function(text) {
if (arguments.length > 1) text = Array.prototype.slice.call(arguments).join(' ');
if (0) { // XXX disabled for safety typeof dump == 'function') {
dump(text + '\n'); // fast, straight to the real console
} else {
console.error(text);
}
printErr(..args) {
var text = args.join(' ');
console.error(text);
},
canvas: (function() {
var canvas = document.getElementById('canvas');
Expand Down
58 changes: 8 additions & 50 deletions test/test_fflush.html
Original file line number Diff line number Diff line change
Expand Up @@ -78,20 +78,15 @@
gotStderr: false,
gotStdCerr: false,

reportSuccess: function() {
reportSuccess() {
fetch('/report_result?0').then(() => window.close());
},

print: (function() {
print: (() => {
var element = document.getElementById('output');
if (element) element.value = ''; // clear browser cache
return function(text) {
if (arguments.length > 1) text = Array.prototype.slice.call(arguments).join(' ');
// These replacements are necessary if you render to raw HTML
//text = text.replace(/&/g, "&amp;");
//text = text.replace(/</g, "&lt;");
//text = text.replace(/>/g, "&gt;");
//text = text.replace('\n', '<br>', 'g');
return (...args) {
var text = args.join(' ');
console.log(text);
if (text == 'hello!') { Module.gotStdout = true; if (Module.gotStderr && Module.gotStdCerr) Module.reportSuccess(); }
if (element) {
Expand All @@ -100,17 +95,13 @@
}
};
})(),
printErr: function(text) {
if (arguments.length > 1) text = Array.prototype.slice.call(arguments).join(' ');
printErr(...args) {
var text = args.join(' ');
if (text == 'hello from stderr too!') { Module.gotStderr = true; if (Module.gotStdout && Module.gotStdCerr) Module.reportSuccess(); }
if (text == 'std::cerr in two parts.') { Module.gotStdCerr = true; if (Module.gotStdout && Module.gotStderr) Module.reportSuccess(); }
if (0) { // XXX disabled for safety typeof dump == 'function') {
dump(text + '\n'); // fast, straight to the real console
} else {
console.error(text);
}
console.error(text);
},
canvas: (function() {
canvas() {
var canvas = document.getElementById('canvas');

// As a default initial behavior, pop up an alert when webgl context is lost. To make your
Expand All @@ -119,40 +110,7 @@
canvas.addEventListener("webglcontextlost", function(e) { alert('WebGL context lost. You will need to reload the page.'); e.preventDefault(); }, false);

return canvas;
})(),
setStatus: function(text) {
if (!Module.setStatus.last) Module.setStatus.last = { time: Date.now(), text: '' };
if (text === Module.setStatus.text) return;
var m = text.match(/([^(]+)\((\d+(\.\d+)?)\/(\d+)\)/);
var now = Date.now();
if (m && now - Date.now() < 30) return; // if this is a progress update, skip it if too soon
if (m) {
text = m[1];
progressElement.value = parseInt(m[2])*100;
progressElement.max = parseInt(m[4])*100;
progressElement.hidden = false;
spinnerElement.hidden = false;
} else {
progressElement.value = null;
progressElement.max = null;
progressElement.hidden = true;
if (!text) spinnerElement.hidden = true;
}
statusElement.innerHTML = text;
},
totalDependencies: 0,
monitorRunDependencies: function(left) {
this.totalDependencies = Math.max(this.totalDependencies, left);
Module.setStatus(left ? 'Preparing... (' + (this.totalDependencies-left) + '/' + this.totalDependencies + ')' : 'All downloads complete.');
}
};
Module.setStatus('Downloading...');
window.onerror = function() {
Module.setStatus('Exception thrown, see JavaScript console');
spinnerElement.style.display = 'none';
Module.setStatus = function(text) {
if (text) Module.printErr('[post-exception status] ' + text);
};
};
</script>
{{{ SCRIPT }}}
Expand Down
Loading