forked from cory/tildefriends
Don't mess with websockets when we're returning a document from an app's handler.js.
git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4307 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
parent
7d9b627f37
commit
1ccb9183b4
16
core/core.js
16
core/core.js
@ -192,7 +192,9 @@ async function getProcessBlob(blobId, key, options) {
|
||||
process.credentials = options.credentials || {};
|
||||
process.task = new Task();
|
||||
process.eventHandlers = {};
|
||||
process.app = new app.App();
|
||||
if (!options?.script || options?.script === 'app.js') {
|
||||
process.app = new app.App();
|
||||
}
|
||||
process.lastActive = Date.now();
|
||||
process.lastPing = null;
|
||||
process.timeout = options.timeout;
|
||||
@ -276,7 +278,7 @@ async function getProcessBlob(blobId, key, options) {
|
||||
throw Error(`Permission denied: ${permission}.`);
|
||||
}
|
||||
|
||||
} else {
|
||||
} else if (process.app) {
|
||||
return process.app.makeFunction(['requestPermission'])(permission).then(function(value) {
|
||||
if (value == 'allow') {
|
||||
storePermission(user, options.packageOwner, options.packageName, permission, true);
|
||||
@ -293,6 +295,8 @@ async function getProcessBlob(blobId, key, options) {
|
||||
}
|
||||
throw Error(`Permission denied: ${permission}.`);
|
||||
});
|
||||
} else {
|
||||
throw Error(`Permission denied: ${permission}.`);
|
||||
}
|
||||
},
|
||||
}
|
||||
@ -353,8 +357,12 @@ async function getProcessBlob(blobId, key, options) {
|
||||
};
|
||||
process.task.onError = function(error) {
|
||||
try {
|
||||
process.app.makeFunction(['error'])(error);
|
||||
} catch(e) {
|
||||
if (process.app) {
|
||||
process.app.makeFunction(['error'])(error);
|
||||
} else {
|
||||
print(error);
|
||||
}
|
||||
} catch (e) {
|
||||
print(e);
|
||||
}
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user