MCPcopy Index your code
hub / github.com/mailvelope/mailvelope / attachExtractFrame

Function attachExtractFrame

src/content-scripts/main.js:297–326  ·  view source on GitHub ↗
(ranges)

Source from the content-addressed store, hash-verified

295}
296
297function attachExtractFrame(ranges) {
298 // check status of PGP ranges
299 const newRanges = ranges.filter(range =>
300 !isAttached(range.commonAncestorContainer)
301 );
302 // create new decrypt frames for new discovered PGP tags
303 for (const range of newRanges) {
304 try {
305 switch (getMessageType(range.endContainer.textContent)) {
306 case PGP_MESSAGE: {
307 const dFrame = new DecryptFrame();
308 dFrame.attachTo(range);
309 break;
310 }
311 case PGP_SIGNATURE: {
312 const vFrame = new VerifyFrame();
313 vFrame.attachTo(range);
314 break;
315 }
316 case PGP_PUBLIC_KEY: {
317 const imFrame = new ImportFrame();
318 imFrame.attachTo(range);
319 break;
320 }
321 }
322 } catch (e) {
323 console.log('attachExtractFrame failed:', e);
324 }
325 }
326}
327
328/**
329 * attach encrypt frame to element

Callers 1

scanDOMFunction · 0.85

Calls 3

isAttachedFunction · 0.85
getMessageTypeFunction · 0.85
attachToMethod · 0.45

Tested by

no test coverage detected