mirror of
https://github.com/moonlight-stream/moonlight-chrome.git
synced 2025-08-17 16:46:31 +00:00
Covered NaCl module loading with logging statements
This commit is contained in:
parent
e0c4c01e44
commit
7e1dd5d30a
3
.gitignore
vendored
3
.gitignore
vendored
@ -42,3 +42,6 @@ dir.stamp
|
|||||||
*.pexe
|
*.pexe
|
||||||
*.nmf
|
*.nmf
|
||||||
*.bc
|
*.bc
|
||||||
|
|
||||||
|
# Jetbrains IDEs
|
||||||
|
*.idea/
|
@ -26,6 +26,7 @@ var common = (function() {
|
|||||||
* the given toolchain.
|
* the given toolchain.
|
||||||
*/
|
*/
|
||||||
function mimeTypeForTool(tool) {
|
function mimeTypeForTool(tool) {
|
||||||
|
console.log('%c[mimeTypeForTool, common.js]', 'color: gray;', 'tool: ' + tool);
|
||||||
// For NaCl modules use application/x-nacl.
|
// For NaCl modules use application/x-nacl.
|
||||||
var mimetype = 'application/x-nacl';
|
var mimetype = 'application/x-nacl';
|
||||||
|
|
||||||
@ -34,6 +35,7 @@ var common = (function() {
|
|||||||
} else if (tool == 'pnacl') {
|
} else if (tool == 'pnacl') {
|
||||||
mimetype = 'application/x-pnacl';
|
mimetype = 'application/x-pnacl';
|
||||||
}
|
}
|
||||||
|
console.log('%c[updateStatus, common.js]', 'color: gray;', 'mimetype: ' + mimetype);
|
||||||
return mimetype;
|
return mimetype;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -51,7 +53,9 @@ var common = (function() {
|
|||||||
if (isHostToolchain(tool)) {
|
if (isHostToolchain(tool)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
console.log('%c[browserSupportsNaCl, common.js]', 'color: gray;', 'is NOT host toolchain for tool: ' + tool);
|
||||||
var mimetype = mimeTypeForTool(tool);
|
var mimetype = mimeTypeForTool(tool);
|
||||||
|
console.log('%c[browserSupportsNaCl, common.js]', 'color: gray;', 'mimetypes: ' + mimetype);
|
||||||
return navigator.mimeTypes[mimetype] !== undefined;
|
return navigator.mimeTypes[mimetype] !== undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -67,6 +71,8 @@ var common = (function() {
|
|||||||
* @param {Object} attrs Dictionary of attributes to set on the module.
|
* @param {Object} attrs Dictionary of attributes to set on the module.
|
||||||
*/
|
*/
|
||||||
function createNaClModule(name, tool, path, width, height, attrs) {
|
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');
|
var moduleEl = document.createElement('embed');
|
||||||
moduleEl.setAttribute('name', 'nacl_module');
|
moduleEl.setAttribute('name', 'nacl_module');
|
||||||
moduleEl.setAttribute('id', 'nacl_module');
|
moduleEl.setAttribute('id', 'nacl_module');
|
||||||
@ -85,6 +91,8 @@ var common = (function() {
|
|||||||
var mimetype = mimeTypeForTool(tool);
|
var mimetype = mimeTypeForTool(tool);
|
||||||
moduleEl.setAttribute('type', mimetype);
|
moduleEl.setAttribute('type', mimetype);
|
||||||
|
|
||||||
|
console.log('%c[createNaClModule, common.js]', 'color: gray;', "moduleEl: " + moduleEl);
|
||||||
|
|
||||||
// The <EMBED> element is wrapped inside a <DIV>, which has both a 'load'
|
// The <EMBED> element is wrapped inside a <DIV>, which has both a 'load'
|
||||||
// and a 'message' event listener attached. This wrapping method is used
|
// and a 'message' event listener attached. This wrapping method is used
|
||||||
// instead of attaching the event listeners directly to the <EMBED> element
|
// instead of attaching the event listeners directly to the <EMBED> element
|
||||||
@ -139,6 +147,7 @@ var common = (function() {
|
|||||||
function handleError(event) {
|
function handleError(event) {
|
||||||
// We can't use common.naclModule yet because the module has not been
|
// We can't use common.naclModule yet because the module has not been
|
||||||
// loaded.
|
// loaded.
|
||||||
|
console.log('%c[handleError, common.js]', 'color: red;', event);
|
||||||
var moduleEl = document.getElementById('nacl_module');
|
var moduleEl = document.getElementById('nacl_module');
|
||||||
updateStatus('ERROR [' + moduleEl.lastError + ']');
|
updateStatus('ERROR [' + moduleEl.lastError + ']');
|
||||||
}
|
}
|
||||||
@ -149,6 +158,7 @@ var common = (function() {
|
|||||||
* This event listener is registered in attachDefaultListeners above.
|
* This event listener is registered in attachDefaultListeners above.
|
||||||
*/
|
*/
|
||||||
function handleCrash(event) {
|
function handleCrash(event) {
|
||||||
|
console.log('%c[handleCrash, common.js]', 'color: red;', event);
|
||||||
if (common.naclModule.exitStatus == -1) {
|
if (common.naclModule.exitStatus == -1) {
|
||||||
updateStatus('CRASHED');
|
updateStatus('CRASHED');
|
||||||
} else {
|
} else {
|
||||||
@ -191,6 +201,7 @@ var common = (function() {
|
|||||||
* Remove the NaCl module from the page.
|
* Remove the NaCl module from the page.
|
||||||
*/
|
*/
|
||||||
function removeModule() {
|
function removeModule() {
|
||||||
|
console.log('%c[removeModule, common.js]', 'color: gray;', "removing module...");
|
||||||
common.naclModule.parentNode.removeChild(common.naclModule);
|
common.naclModule.parentNode.removeChild(common.naclModule);
|
||||||
common.naclModule = null;
|
common.naclModule = null;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user