-
Notifications
You must be signed in to change notification settings - Fork 4
Compatibility
We test CloudBrowser using node.js 0.10.33. This version is strongly recommended. Version 0.10.* of node.js should work as well.
0.12.* is not compatible with CloudBrowser, it is not sure it is caused by compatible issue of coffeescript or some other third-party libraries.
Error: Module did not self-register.
at Error (native)
at Module.load (/Users/pan/git/cloudbrowser2/node_modules/coffee-script/lib/coffee-script/register.js:45:36)
at Function.Module._load (module.js:310:12)
at Module.require (module.js:365:17)
at require (module.js:384:17)
at bindings (/Users/pan/git/cloudbrowser2/node_modules/ofe/node_modules/bindings/bindings.js:76:44)
at Object.<anonymous> (/Users/pan/git/cloudbrowser2/node_modules/ofe/ofe.js:1:97)
at Module._compile (module.js:460:26)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (/Users/pan/git/cloudbrowser2/node_modules/coffee-script/lib/coffee-script/register.js:45:36)
at Function.Module._load (module.js:310:12)
at Module.require (module.js:365:17)
at require (module.js:384:17)
at Object.<anonymous> (/Users/pan/git/cloudbrowser2/src/master/master_main.coffee:11:1)
at Object.<anonymous> (/Users/pan/git/cloudbrowser2/src/master/master_main.coffee:1:1)
at Module._compile (module.js:460:26)
Other people also encountered problems about 0.12.* http://stackoverflow.com/questions/28486891/uncaught-error-module-did-not-self-register
We only tested 2.0.1, it is not compatible with CloudBrowser. It has the same error as node.js 0.12.*
Angular has a mechanism to simulate 'input' event if it sniffs 'input' event is not supported by the browser. Angular will rely on a browser feature that the keypress takes effect after 'keydown' event, i.e. the input box's value will not be updated before the 'keydown' event, so in the 'keydown' event handler, js code would get an old value.
This workaround is not supported by CloudBrowser, because we cannot make sure the deferred function to be invoked right after we set a new value to the input box.
We modified our code to support 'input' event, so angular would not use this walk around in CloudBrowser now.
For similar reasons, code like this would not work.
var deferListener = function(ev, input, origValue) {
if (!timeout) {
timeout = $browser.defer(function() {
timeout = null;
if (!input || input.value !== origValue) {
listener(ev);
}
});
}
};
element.on('keydown', function(event) {
var key = event.keyCode;
// ignore
// command modifiers arrows
if (key === 91 || (15 < key && key < 19) || (37 <= key && key <= 40)) return;
deferListener(event, this, this.value);
});
Angular has security checking for resource loading, typically anything that is not from the same domain are blocked by default.
https://docs.angularjs.org/error/$sce/insecurl https://docs.angularjs.org/api/ng/provider/$sceDelegateProvider
In CloudBrowser, we have to load templates from file system. To get away with this checking, we need to add 'file://' to the whitelist of $sceDelegateProvider when initialize our angular app. Also, do not forget to add 'file://' prefix to the template path.
var app = angular.module("myApp", [])
.config(function($sceDelegateProvider) {
return $sceDelegateProvider.resourceUrlWhitelist(['self', "file://**"]);
});