Skip to content

Set-VSCodeHtmlContentView not working / not adding any content to the tab body [Deprecated API] #4872

Closed
@strxngewxrld

Description

@strxngewxrld

Prerequisites

  • I have written a descriptive issue title.
  • I have searched all open and closed issues to ensure it has not already been reported.
  • I have read the troubleshooting guide.
  • I am sure this issue is with the extension itself and does not reproduce in a standalone PowerShell instance.
  • I have verified that I am using the latest version of Visual Studio Code and the PowerShell extension.
  • If this is a security issue, I have read the security issue reporting guidance.

Summary

With the vscode-powershell extension comes the PowerShellEditorServices.VSCode module.
These functions were first introduced with extension version 1.4.0.

I have tried to run the snippet that is described in the release notes, but the Set-VSCodeHtmlContentView doesn't add content to the tab body, the Write-VSCodeHtmlContentView cmdlet doesn't work either.

The problem occurs on both Windows and MacOS.

PowerShell Version

Name                           Value
----                           -----
PSVersion                      7.4.0
PSEdition                      Core
GitCommitId                    7.4.0
OS                             Darwin 23.2.0 Darwin Kernel Version 23.2.0: Wed Nov 15 21:53:18 PST 2023; root:xnu-10002.61.3~2/RELEASE_ARM64_T6000
Platform                       Unix
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Name             : Visual Studio Code Host
Version          : 2023.8.0
InstanceId       : 9f942f6f-8367-4a6c-bff7-d2ef1bbb8a49
UI               : System.Management.Automation.Internal.Host.InternalHostUserInterface
CurrentCulture   : en-US
CurrentUICulture : en-US
PrivateData      : Microsoft.PowerShell.ConsoleHost+ConsoleColorProxy
DebuggerEnabled  : True
IsRunspacePushed : False
Runspace         : System.Management.Automation.Runspaces.LocalRunspace

Visual Studio Code Version

Version: 1.85.1 (Universal)

Extension Version

ms-vscode.powershell@v2023.8.0

Steps to Reproduce

Run the snippet described in the release notes:

$view = New-VSCodeHtmlContentView -Title "My Custom View" -ShowInColumn One
Set-VSCodeHtmlContentView -View $view -Content "<h1>Hello world!</h1>"
Write-VSCodeHtmlContentView $view -Content "<b>I'm adding new content!</b><br />"

Visuals

5a2b9c95-a9a2-4b29-8c90-7cbcc9027d0c

Logs

The console log in the vscode developer tools shows the following entries:

webviewElement.ts:513 An iframe which has both allow-scripts and allow-same-origin for its sandbox attribute can escape its sandboxing.
mountTo @ webviewElement.ts:513
M @ overlayWebview.ts:218
claim @ overlayWebview.ts:120
ib @ webviewEditor.ts:178
setInput @ webviewEditor.ts:169
await in setInput (async)
S @ editorPanes.ts:445
L @ editorPanes.ts:270
openEditor @ editorPanes.ts:146
(anonymous) @ editorGroupView.ts:1111
Eb @ editorGroupView.ts:1135
Db @ editorGroupView.ts:1093
openEditor @ editorGroupView.ts:999
openEditor @ editorService.ts:551
openWebview @ webviewWorkbenchService.ts:285
$createWebviewPanel @ mainThreadWebviewPanels.ts:167
S @ rpcProtocol.ts:456
Q @ rpcProtocol.ts:441
M @ rpcProtocol.ts:371
L @ rpcProtocol.ts:297
(anonymous) @ rpcProtocol.ts:161
y @ event.ts:1148
fire @ event.ts:1179
fire @ ipc.net.ts:650
x.onmessage @ localProcessExtensionHost.ts:374
index.html?id=14dfbeda-8d05-4dfe-b50a-7b8119b638b7&origin=ec1b4a75-ad64-403d-b5e6-2c1d782bc3e3&swVersion=4&extensionId=ms-vscode.powershell&platform=electron&vscode-resource-base-authority=vscode-resource.vscode-cdn.net&parentOrigin=vscode-file%3A%2F%2Fvscode-app:273

No service worker controller found. Waiting for controllerchange.

Metadata

Metadata

Assignees

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions