()
| 426 | } |
| 427 | |
| 428 | private getHtmlForWebview(): string { |
| 429 | const webview = this.webviewView?.webview; |
| 430 | if (!webview) { |
| 431 | return ''; |
| 432 | } |
| 433 | if (!this.parent.enabled) { |
| 434 | return /*html*/` |
| 435 | <!DOCTYPE html> |
| 436 | <html lang="en"> |
| 437 | <head> |
| 438 | <meta charset="UTF-8"> |
| 439 | <title>RTOS Threads</title> |
| 440 | </head> |
| 441 | <body> |
| 442 | <p>Currently disabled. Enable setting "cortex-debug.showRTOS" or use Command "Cortex Debug: Toggle RTOS Panel" to see any RTOS info</p> |
| 443 | </body> |
| 444 | </html>`; |
| 445 | } |
| 446 | const toolkitUri = getUri(webview, this.extensionUri, [ |
| 447 | 'node_modules', |
| 448 | '@vscode', |
| 449 | 'webview-ui-toolkit', |
| 450 | 'dist', |
| 451 | 'toolkit.js' |
| 452 | ]); |
| 453 | // Get the local path to main script run in the webview, then convert it to a uri we can use in the webview. |
| 454 | const scriptUri = webview.asWebviewUri(vscode.Uri.joinPath(this.extensionUri, 'resources', 'rtos.js')); |
| 455 | const rtosStyle = webview.asWebviewUri(vscode.Uri.joinPath(this.extensionUri, 'resources', 'rtos.css')); |
| 456 | |
| 457 | const htmlInfo = this.parent.getHtml(); |
| 458 | // Use a nonce to only allow a specific script to be run. |
| 459 | const nonce = getNonce(); |
| 460 | const ret = /*html*/` |
| 461 | <!DOCTYPE html> |
| 462 | <html lang="en"> |
| 463 | <head> |
| 464 | <meta charset="UTF-8"> |
| 465 | <!-- |
| 466 | Use a content security policy to only allow loading images from https or from our extension directory, |
| 467 | and only allow scripts that have a specific nonce. |
| 468 | --> |
| 469 | <meta http-equiv="Content-Security-Policy" content="default-src 'none'; |
| 470 | style-src 'nonce-${nonce}' ${webview.cspSource}; script-src 'nonce-${nonce}';"> |
| 471 | <meta name="viewport" content="width=device-width, initial-scale=1.0"> |
| 472 | <link href="${rtosStyle}" rel="stylesheet"> |
| 473 | <style nonce="${nonce}"> |
| 474 | ${htmlInfo.css} |
| 475 | </style> |
| 476 | <title>RTOS Threads</title> |
| 477 | </head> |
| 478 | <body> |
| 479 | ${htmlInfo.html} |
| 480 | <script type="module" nonce="${nonce}" src="${toolkitUri}"></script> |
| 481 | <script type="module" nonce="${nonce}" src="${scriptUri}"></script> |
| 482 | </body> |
| 483 | </html>`; |
| 484 | writeHtmlToTmpDir(ret); |
| 485 | return ret; |
no test coverage detected