Release Vulpes OS 2.7-preview.24
This commit is contained in:
parent
49572b6b45
commit
97ef99f827
135 changed files with 7717 additions and 2524 deletions
|
|
@ -2,6 +2,28 @@
|
|||
// real top-level browser, never by removing CSP or frame-ancestors protection.
|
||||
export const Views = {
|
||||
entries: new Map(),
|
||||
async captureSystem(actor) {
|
||||
const context = actor.browsingContext;
|
||||
const uri = context?.currentWindowGlobal?.documentURI;
|
||||
if (!context || context.parent || uri?.scheme !== 'http' || uri?.host !== 'system.localhost' ||
|
||||
uri?.filePath !== '/index.html') {
|
||||
throw new Error('SCREENSHOT_NOT_AVAILABLE');
|
||||
}
|
||||
const image = await context.currentWindowGlobal.drawSnapshot(null, 1, 'white');
|
||||
const doc = context.top.embedderElement?.ownerDocument;
|
||||
if (!doc) {
|
||||
image.close();
|
||||
throw new Error('SCREENSHOT_NOT_AVAILABLE');
|
||||
}
|
||||
const canvas = doc.createElementNS('http://www.w3.org/1999/xhtml', 'canvas');
|
||||
canvas.width = image.width;
|
||||
canvas.height = image.height;
|
||||
canvas.getContext('2d').drawImage(image, 0, 0);
|
||||
image.close();
|
||||
return new Promise((resolve, reject) => {
|
||||
canvas.toBlob(blob => blob ? resolve(blob) : reject(new Error('SCREENSHOT_FAILED')), 'image/png');
|
||||
});
|
||||
},
|
||||
syncContext(entry) {
|
||||
const context=entry.browser.browsingContext;
|
||||
if (!context || context.id===entry.topContextId) return;
|
||||
|
|
|
|||
Loading…
Reference in a new issue