Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
Promise.prototype._complete = function(list, status, data, name) {
// Complain if we've already been completed
if (this._status != PENDING) {
console.group('Promise already closed');
console.error('Attempted ' + name + '() with ', data);
console.error('Previous status = ', this._status,
', previous value = ', this._value);
console.trace();
if (this._completeTrace) {
console.error('Trace of previous completion:');
this._completeTrace.log(5);
}
console.groupEnd();
return this;
}
if (_traceCompletion) {
this._completeTrace = new Trace(new Error());
}
this._status = status;
this._value = data;
// Call all the handlers, and then delete them
list.forEach(function(handler) {
handler.call(null, this._value);
Promise.prototype._complete = function(list, status, data, name) {
// Complain if we've already been completed
if (this._status != PENDING) {
console.group('Promise already closed');
console.error('Attempted ' + name + '() with ', data);
console.error('Previous status = ', this._status,
', previous value = ', this._value);
console.trace();
if (this._completeTrace) {
console.error('Trace of previous completion:');
this._completeTrace.log(5);
}
console.groupEnd();
return this;
}
if (_traceCompletion) {
this._completeTrace = new Trace(new Error());
}
this._status = status;
/**
* Executes the command and ensures request.done is called on the request in
* case it's not marked to be done already or async.
*/
function execute() {
command.exec(env, request.args, request);
// If the request isn't asnync and isn't done, then make it done.
if (!request.isAsync && !request.isDone) {
request.done();
}
}
if (request.getStatus() == Status.INVALID) {
console.error("Canon.exec: Invalid parameter(s) passed to " +
command.name);
return false;
}
// If the request isn't complete yet, try to complete it.
else if (request.getStatus() == Status.INCOMPLETE) {
// Check if the sender has a ArgsProvider, otherwise use the default
// build in one.
var argsProvider;
var senderObj = env[sender];
if (!senderObj || !senderObj.getArgsProvider ||
!(argsProvider = senderObj.getArgsProvider()))
{
argsProvider = defaultArgsProvider;
}
// Ask the paramProvider to complete the request.
function imageUrl(path) {
var dataUrl = require('text!cockpit/ui/' + path);
if (dataUrl) {
return dataUrl;
}
var filename = module.id.split('/').pop() + '.js';
var imagePath;
if (module.uri.substr(-filename.length) !== filename) {
console.error('Can\'t work out path from module.uri/module.id');
return path;
}
if (module.uri) {
var end = module.uri.length - filename.length - 1;
return module.uri.substr(0, end) + path;
}
return filename + path;
}
function imageUrl(path) {
var dataUrl;
try {
dataUrl = require('text!cockpit/ui/' + path);
} catch (e) { }
if (dataUrl) {
return dataUrl;
}
var filename = module.id.split('/').pop() + '.js';
var imagePath;
if (module.uri.substr(-filename.length) !== filename) {
console.error('Can\'t work out path from module.uri/module.id');
return path;
}
if (module.uri) {
var end = module.uri.length - filename.length - 1;
return module.uri.substr(0, end) + "/" + path;
}
return filename + path;
}
function imageUrl(path) {
var dataUrl;
try {
dataUrl = require('text!cockpit/ui/' + path);
} catch (e) { }
if (dataUrl) {
return dataUrl;
}
var filename = module.id.split('/').pop() + '.js';
var imagePath;
if (module.uri.substr(-filename.length) !== filename) {
console.error('Can\'t work out path from module.uri/module.id');
return path;
}
if (module.uri) {
var end = module.uri.length - filename.length - 1;
return module.uri.substr(0, end) + "/" + path;
}
return filename + path;
}
function imageUrl(path) {
var dataUrl = require('text!cockpit/ui/' + path);
if (dataUrl) {
return dataUrl;
}
var filename = module.id.split('/').pop() + '.js';
var imagePath;
if (module.uri.substr(-filename.length) !== filename) {
console.error('Can\'t work out path from module.uri/module.id');
return path;
}
if (module.uri) {
var end = module.uri.length - filename.length - 1;
return module.uri.substr(0, end) + path;
}
return filename + path;
}
persistValue: function(settings, key, value) {
try {
var stringData = JSON.stringify(settings._saveToObject());
cookie.set('settings', stringData);
} catch (ex) {
console.error('Unable to JSONify the settings! ' + ex);
return;
}
}
};
persistValue: function(settings, key, value) {
try {
var stringData = JSON.stringify(settings._saveToObject());
cookie.set('settings', stringData);
} catch (ex) {
console.error('Unable to JSONify the settings! ' + ex);
return;
}
}
};
persistValue: function(settings, key, value) {
try {
var stringData = JSON.stringify(settings._saveToObject());
cookie.set('settings', stringData);
} catch (ex) {
console.error('Unable to JSONify the settings! ' + ex);
return;
}
}
};