From 7e1dd5d30a7bc0e4fcefe8eb0b2779615bfb256f Mon Sep 17 00:00:00 2001 From: "R. Aidan Campbell" Date: Sat, 7 Oct 2017 14:00:14 -0700 Subject: [PATCH 1/3] Covered NaCl module loading with logging statements --- .gitignore | 5 ++++- static/js/common.js | 11 +++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index cfc2110..050624e 100644 --- a/.gitignore +++ b/.gitignore @@ -41,4 +41,7 @@ dir.stamp *.nexe *.pexe *.nmf -*.bc \ No newline at end of file +*.bc + +# Jetbrains IDEs +*.idea/ \ No newline at end of file diff --git a/static/js/common.js b/static/js/common.js index db28a2a..16c4f64 100644 --- a/static/js/common.js +++ b/static/js/common.js @@ -26,6 +26,7 @@ var common = (function() { * the given toolchain. */ function mimeTypeForTool(tool) { + console.log('%c[mimeTypeForTool, common.js]', 'color: gray;', 'tool: ' + tool); // For NaCl modules use application/x-nacl. var mimetype = 'application/x-nacl'; @@ -34,6 +35,7 @@ var common = (function() { } else if (tool == 'pnacl') { mimetype = 'application/x-pnacl'; } + console.log('%c[updateStatus, common.js]', 'color: gray;', 'mimetype: ' + mimetype); return mimetype; } @@ -51,7 +53,9 @@ var common = (function() { if (isHostToolchain(tool)) { return true; } + console.log('%c[browserSupportsNaCl, common.js]', 'color: gray;', 'is NOT host toolchain for tool: ' + tool); var mimetype = mimeTypeForTool(tool); + console.log('%c[browserSupportsNaCl, common.js]', 'color: gray;', 'mimetypes: ' + mimetype); return navigator.mimeTypes[mimetype] !== undefined; } @@ -67,6 +71,8 @@ var common = (function() { * @param {Object} attrs Dictionary of attributes to set on the module. */ function createNaClModule(name, tool, path, width, height, attrs) { + console.log('%c[createNaClModule, common.js]', 'color: gray;', "name: " + name, "tool: " + tool, "path: " + path,"width: " + width, + "height: " + height, "attrs: " + attrs); var moduleEl = document.createElement('embed'); moduleEl.setAttribute('name', 'nacl_module'); moduleEl.setAttribute('id', 'nacl_module'); @@ -85,6 +91,8 @@ var common = (function() { var mimetype = mimeTypeForTool(tool); moduleEl.setAttribute('type', mimetype); + console.log('%c[createNaClModule, common.js]', 'color: gray;', "moduleEl: " + moduleEl); + // The element is wrapped inside a
, which has both a 'load' // and a 'message' event listener attached. This wrapping method is used // instead of attaching the event listeners directly to the element @@ -139,6 +147,7 @@ var common = (function() { function handleError(event) { // We can't use common.naclModule yet because the module has not been // loaded. + console.log('%c[handleError, common.js]', 'color: red;', event); var moduleEl = document.getElementById('nacl_module'); updateStatus('ERROR [' + moduleEl.lastError + ']'); } @@ -149,6 +158,7 @@ var common = (function() { * This event listener is registered in attachDefaultListeners above. */ function handleCrash(event) { + console.log('%c[handleCrash, common.js]', 'color: red;', event); if (common.naclModule.exitStatus == -1) { updateStatus('CRASHED'); } else { @@ -191,6 +201,7 @@ var common = (function() { * Remove the NaCl module from the page. */ function removeModule() { + console.log('%c[removeModule, common.js]', 'color: gray;', "removing module..."); common.naclModule.parentNode.removeChild(common.naclModule); common.naclModule = null; } From 7a6ed6da5765486f159408d1f9c2f6249d794f67 Mon Sep 17 00:00:00 2001 From: "R. Aidan Campbell" Date: Sat, 7 Oct 2017 14:14:37 -0700 Subject: [PATCH 2/3] minor bugfixes in logging --- static/js/common.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/static/js/common.js b/static/js/common.js index 16c4f64..6b5a5c0 100644 --- a/static/js/common.js +++ b/static/js/common.js @@ -71,8 +71,8 @@ var common = (function() { * @param {Object} attrs Dictionary of attributes to set on the module. */ function createNaClModule(name, tool, path, width, height, attrs) { - console.log('%c[createNaClModule, common.js]', 'color: gray;', "name: " + name, "tool: " + tool, "path: " + path,"width: " + width, - "height: " + height, "attrs: " + attrs); + console.log('%c[createNaClModule, common.js]', 'color: gray;', "name: " + name + ", tool: " + tool + ", path: " + path + ", width: " + width + + ", height: " + height + ", attrs: " + JSON.stringify(attrs)); var moduleEl = document.createElement('embed'); moduleEl.setAttribute('name', 'nacl_module'); moduleEl.setAttribute('id', 'nacl_module'); @@ -91,7 +91,7 @@ var common = (function() { var mimetype = mimeTypeForTool(tool); moduleEl.setAttribute('type', mimetype); - console.log('%c[createNaClModule, common.js]', 'color: gray;', "moduleEl: " + moduleEl); + console.log('%c[createNaClModule, common.js]', 'color: gray;', "moduleEl: " + JSON.stringify(moduleEl)); // The element is wrapped inside a
, which has both a 'load' // and a 'message' event listener attached. This wrapping method is used From 5328f2a9e9e07c25d20a91bd9085f511b6c86322 Mon Sep 17 00:00:00 2001 From: "R. Aidan Campbell" Date: Sun, 22 Oct 2017 13:05:05 -0700 Subject: [PATCH 3/3] ignoring visual studio generated directories --- .gitignore | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 050624e..df8f529 100644 --- a/.gitignore +++ b/.gitignore @@ -44,4 +44,7 @@ dir.stamp *.bc # Jetbrains IDEs -*.idea/ \ No newline at end of file +*.idea/ + +# Visual Studio +*.vs/