The useful result was not “a gadget window appeared.” It was “the gadget received each event while the CGI process was still running.”
The question was about the real host, not a browser substitute
The Deployment Studio needed a small status surface that could display progress as the local deployment command ran. The host machine is Windows 7, and the deployment tooling lives there. A web page in a current desktop browser would not answer whether the actual Sidebar gadget could do the job. The probe therefore runs inside a real installed Windows Sidebar gadget on the same machine that hosts the local lighttpd CGI.
I kept the question narrow. The gadget makes one asynchronous GET request to a loopback fixture. The fixture emits two named probe events about 1.5 seconds apart and then a completion event. It never invokes the deploy command, contacts Cloudflare, or mutates a site. That gives the browser client a real open HTTP response to consume without attaching a risky deployment action to a test button.
Installing a package is not the same as running it
A .gadget file is a renamed ZIP archive containing the manifest, HTML, script and styles. Opening that archive through its Windows shell handler installed the probe into the Gadget Gallery. It did not create a desktop instance on this machine. The distinction was visible: the Gallery gained the package entry, while the desktop still had no running probe and the per-user settings contained no active instance.
That observation corrected my earlier assumption. Package registration gives Windows an installed gadget folder. Starting the gadget is a separate operation. Microsoft's IDesktopGadget::RunGadget API is explicit about this: it adds an already installed gadget to the desktop and takes the absolute path to its installed folder. The documentation also identifies SCHED_E_ALREADY_RUNNING as the result when that gadget is already active. <a href="https://learn.microsoft.com/en-us/windows/win32/api/shobjidl/nf-shobjidl-idesktopgadget-rungadget">Microsoft's RunGadget reference</a> describes the contract.
The installer extracts, then activates, the installed folder
The repeatable command is install-gadget.cmd. It extracts the fresh package into the current user's %LOCALAPPDATA%\Microsoft\Windows Sidebar\Gadgets\p_sidebar_sse_package_install.gadget folder, removes stale page and generated-script files left by earlier attempts, and then invokes a small C# COM caller with that absolute folder path. The probe uses its own package name and folder so the pre-existing p_sidebar_sse gadget is not mistaken for the test instance.
The COM helper validates the folder and gadget.xml before calling RunGadget. It treats the already-running HRESULT as a successful idempotent outcome, so repeating the install command does not turn an already active window into a misleading failure. Other HRESULT failures retain their number and the corresponding system message. This tiny helper exists only at the COM boundary; package creation, extraction and orchestration remain ordinary command and framework operations.
int result = ((IDesktopGadget)instance).RunGadget(gadgetPath);
if (result == GadgetAlreadyRunning)
{
Console.WriteLine("The gadget is already active on the desktop: " + gadgetPath);
return 0;
}
Check the actual MSHTML document mode
The gadget page declares IE=11 with X-UA-Compatible and reports document.documentMode together with document.location.protocol. The successful run displayed “MSHTML IE document mode 11; protocol x-gadget:”. That observation answers two concrete questions from inside the host: this gadget document selected mode 11, and the page is running under Sidebar's x-gadget protocol.
A user-agent string is a different piece of evidence from document.documentMode. A legacy compatibility token in a request header does not override what the loaded document reports about its mode. The probe prints the mode it needs to know rather than inferring it from the host's name or from a browser request header. This confirms the conditions of this run; it does not claim that every IE11 feature or every cross-origin policy is available to a gadget.

Reuse the browser's XMLHttpRequest through the framework SSE client
The gadget does not implement a second event parser. Its LiveScript module imports net.html.browser.SSE and calls try-create-event-stream with the local fixture URL. That shared client creates XMLHttpRequest, opens an asynchronous GET, sets Accept: text/event-stream and Cache-Control: no-cache, and observes ready-state changes. As the response reaches the interactive state, it reads only the new suffix of responseText and feeds that text to the same incremental parser used by the rest of the framework.
The parser buffers incomplete lines across response updates. It recognizes event and data fields, combines repeated data lines, and dispatches an event only after the blank line that terminates it. It handles CR, LF and CRLF line endings. When the XHR reaches its final state, the parser is finished once more so a final unterminated line is not silently lost. This is why the UI can append each event as it arrives instead of waiting for the CGI process to close.
result = try-create-event-stream endpoint!, {
on-open: (response) ->
set-status "Connected (HTTP #{response.status}); waiting for events"
on-event: (event) ->
append-output "#{event.name}: #{event.data}"
set-status 'Fixture stream completed' if event.name is 'complete'
on-error: (error) ->
set-status 'SSE connection failed'
append-output error.to-string!
}
The fixture writes events while its CGI process is alive
The endpoint is a loopback-only lighttpd CGI route. The fixture checks REMOTE_ADDR against 127.0.0.1, ::1 and the IPv4-mapped loopback address before it writes anything. It asks net.http.cgi.SSE to send a text/event-stream response with a no-cache header. Each try-write-event call writes a complete event record; WScript.Sleep separates the records while the CGI keeps the response open.
The CGI adapter runs the compiled fixture through the framework's ForwardUtf8Stream PowerShell bridge. That bridge preserves UTF-8 output as it crosses the WSH process boundary. PowerShell is the established transport bridge here, not the gadget runtime: the browser logic is compiled from LiveScript and runs in MSHTML, while the fixture's server behavior runs in the WSH CGI process.
sse = required (try-create-sse-response stdio.stdout-stream), 'Unable to open fixture event stream'
required (sse.try-write-event {name: 'probe', data: 'first event'}), 'Unable to write first event'
WScript.Sleep 1500
required (sse.try-write-event {name: 'probe', data: 'second event'}), 'Unable to write second event'
WScript.Sleep 1500
required (sse.try-write-event {name: 'complete', data: '{"status":"success"}'}), 'Unable to write completion event'
What the timing proves, and what it does not
In the completed screenshot, the client logged the first event at 749 ms, the second at 2228 ms and the completion event at 3740 ms. The intervals between the visible records are 1479 ms and 1512 ms, consistent with the two 1500 ms waits in the fixture. Most importantly, the gadget rendered the first record before the later records had been sent. The client was receiving an open response incrementally; it was not displaying a completed buffer after process exit.
These are functional observations from one run, not a throughput or latency benchmark. Browser startup, process scheduling and request setup affect the first timestamp. The useful check is the ordered sequence and the roughly 1.5-second separation. The test also proves only this route, this gadget package and this Windows 7/MSHTML host configuration. It does not establish behavior for a remote endpoint, another security zone, every gadget permission, or every SSE feature.
The sizing fix was part of making the result inspectable
The first desktop activation exposed a presentation problem: the gadget showed only its heading because the document did not reserve the intended size. I set explicit width and height on the page body, used border-box sizing, and kept the event panel short with its own scrolling region. The final 360 by 420 CSS-pixel content area fits the status, event log and expected result together, with overflow available for smaller host windows.
That is not cosmetic to the probe. If the gadget clips the event log, a successful network request can look like a failed test. Keeping the status, elapsed times and completion message visible makes the transport behavior inspectable on the actual desktop surface.
body {
width: 360px;
height: 420px;
box-sizing: border-box;
overflow: auto;
}
pre {
max-height: 90px;
overflow: auto;
white-space: pre-wrap;
}
Repeating the probe safely
On the Windows 7 host, build-probe.cmd compiles the LiveScript modules, packages the regular Gallery version and the uniquely named install probe, and builds the small COM runner. enable-route.cmd adds the fixture route only once, validates the lighttpd configuration, then restarts the service. install-gadget.cmd extracts the fresh install package and calls RunGadget. If the gadget is already active, the runner reports that state and exits successfully; close the instance before rebuilding if you need to load changed page assets.
The endpoint remains deliberately separate from the deployment CGI. The real deployment route accepts a POST that can publish changes. Reusing it for a streaming experiment would mix a transport test with an external side effect. Here the fixture is isolated, loopback-only and deterministic enough to distinguish buffered output from true incremental delivery.
A useful legacy-host result, with a clear limit
The probe gives the Deployment Studio a verified path for a lightweight progress window: the Sidebar host can run the compiled client, make a same-machine XMLHttpRequest, and display named SSE events before the response ends. The work also exposed the lifecycle detail that matters when automating the gadget: install its package first, then call RunGadget with the installed folder.
Windows Sidebar is a legacy platform with a broad local security model. Microsoft's security documentation notes that gadgets are trusted local applications with access tied to the user's account, and the platform was later removed from Windows. This article records a controlled Windows 7 compatibility experiment, not a recommendation to enable downloaded gadgets on a general-purpose machine. See <a href="https://learn.microsoft.com/en-us/previous-versions/windows/desktop/sidebar/-sidebar-gadget-security">Microsoft's Sidebar gadget security overview</a> and <a href="https://learn.microsoft.com/en-us/windows/win32/w8cookbook/desktop-gadgets-removed">the Windows 8 documentation on desktop gadgets being removed</a>.
