Publish Vulpes Preview 15 sources for desktop, Android and Tundra
Share Gaia assets and adapters, keep private profiles and development documents local, and update both public READMEs.
This commit is contained in:
parent
93e3a48004
commit
b38dea0597
25901 changed files with 9982925 additions and 369 deletions
65
gaia/tools/extensions/desktop-helper/content/data/ffos_runtime.js
Executable file
65
gaia/tools/extensions/desktop-helper/content/data/ffos_runtime.js
Executable file
|
|
@ -0,0 +1,65 @@
|
|||
FFOS_RUNTIME = {
|
||||
|
||||
/**
|
||||
* Emulates a dom request
|
||||
* Returns an object and calls it's onsuccess handler.
|
||||
*/
|
||||
domRequest: function(result, timeout) {
|
||||
timeout = timeout || 1000;
|
||||
|
||||
return function() {
|
||||
var request = { result: result };
|
||||
|
||||
setTimeout(function() {
|
||||
if (request.onsuccess) {
|
||||
request.onsuccess();
|
||||
}
|
||||
}, timeout);
|
||||
|
||||
return request;
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* This is so we have a single entry-point for the APP window
|
||||
* This is needed as the interface to window may be changing soon
|
||||
*/
|
||||
getAppWindow: function(callback) {
|
||||
callback(window);
|
||||
},
|
||||
|
||||
/**
|
||||
* Proxies console.log statements to the app window
|
||||
*/
|
||||
debug: function() {
|
||||
var args = Array.slice(arguments);
|
||||
|
||||
this.getAppWindow(function(win) {
|
||||
win.console.log.apply(win.console, args);
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* Creates a navigator shim on the window
|
||||
* @param {String} property name.
|
||||
* @param {Object} property definition.
|
||||
* @param {Boolean} if true, makes a navigator setter for this object. Useful for testing.
|
||||
*/
|
||||
makeNavigatorShim: function(property, definition, makeSetter) {
|
||||
try {
|
||||
window.navigator.__defineGetter__(property, function() {
|
||||
return definition;
|
||||
});
|
||||
|
||||
if (makeSetter) {
|
||||
window.navigator.__defineSetter__(property, function(prop) {
|
||||
definition = prop;
|
||||
});
|
||||
}
|
||||
|
||||
} catch (e) {
|
||||
alert('Error intializing shim (' + property + '): ' + e);
|
||||
}
|
||||
}
|
||||
};
|
||||
var debug = FFOS_RUNTIME.debug;
|
||||
Loading…
Reference in a new issue