Skip to content

Commit 93d2678

Browse files
committed
Add COM, .NET/WinRT API definition
1 parent 0af352e commit 93d2678

1 file changed

Lines changed: 312 additions & 0 deletions

File tree

specs/ExtendedProcessFailed.md

Lines changed: 312 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -368,8 +368,320 @@ See [API Details](#api-details) section below for API reference.
368368
# API Details
369369
## COM
370370
```cpp
371+
library WebView2
372+
{
373+
// ...
374+
375+
/// Specifies the process failure type used in the
376+
/// `ICoreWebView2ProcessFailedEventHandler` interface. The values in this enum
377+
/// make reference to the process kinds in the Chromium architecture. For more
378+
/// information about what these processes are and what they do, see
379+
/// [Browser Architecture - Inside look at modern web browser](https://developers.google.com/web/updates/2018/09/inside-browser-part1)
380+
[v1_enum]
381+
typedef enum COREWEBVIEW2_PROCESS_FAILED_KIND {
382+
// Existing stable values.
383+
COREWEBVIEW2_PROCESS_FAILED_KIND_BROWSER_PROCESS_EXITED,
384+
385+
/// Indicates that the main frame's render process ended unexpectedly. A new
386+
/// render process is created automatically and navigated to an error page.
387+
/// The app runs `Reload()` to try to recover from the failure.
388+
COREWEBVIEW2_PROCESS_FAILED_KIND_RENDER_PROCESS_EXITED,
389+
COREWEBVIEW2_PROCESS_FAILED_KIND_RENDER_PROCESS_UNRESPONSIVE,
390+
391+
// New values.
392+
393+
/// Indicates that a frame-only render process ended unexpectedly. The process
394+
/// exit does not impact the top-level document, only a subset of the
395+
/// subframes within it. The content in these frames is replaced with a "sad
396+
/// face" layer.
397+
COREWEBVIEW2_PROCESS_FAILED_KIND_FRAME_RENDER_PROCESS_EXITED,
398+
399+
/// Indicates that a utility process ended unexpectedly.
400+
COREWEBVIEW2_PROCESS_FAILED_KIND_UTILITY_PROCESS_EXITED,
401+
402+
/// Indicates that a sandbox helper process ended unexpectedly.
403+
COREWEBVIEW2_PROCESS_FAILED_KIND_SANDBOX_HELPER_PROCESS_EXITED,
404+
405+
/// Indicates that the GPU process ended unexpectedly.
406+
COREWEBVIEW2_PROCESS_FAILED_KIND_GPU_PROCESS_EXITED,
407+
408+
/// Indicates that a PPAPI plugin process ended unexpectedly.
409+
COREWEBVIEW2_PROCESS_FAILED_KIND_PPAPI_PLUGIN_PROCESS_EXITED,
410+
411+
/// Indicates that a PPAPI plugin broker process ended unexpectedly.
412+
COREWEBVIEW2_PROCESS_FAILED_KIND_PPAPI_BROKER_PROCESS_EXITED,
413+
414+
/// Indicates that a process of unspecified kind ended unexpectedly.
415+
COREWEBVIEW2_PROCESS_FAILED_KIND_UNKNOWN_PROCESS_EXITED,
416+
} COREWEBVIEW2_PROCESS_FAILED_KIND;
417+
418+
419+
/// Specifies the process failure reason used in the
420+
/// `ICoreWebView2ProcessFailedEventHandler` interface.
421+
[v1_enum]
422+
typedef enum COREWEBVIEW2_PROCESS_FAILED_REASON {
423+
/// An unexpected process failure occurred.
424+
COREWEBVIEW2_PROCESS_FAILED_REASON_UNEXPECTED,
425+
426+
/// The process became unresponsive.
427+
/// This only applies to the main frame's render process.
428+
COREWEBVIEW2_PROCESS_FAILED_REASON_UNRESPONSIVE,
429+
430+
/// The process was killed. E.g., from Task Manager.
431+
COREWEBVIEW2_PROCESS_FAILED_REASON_KILLED,
432+
433+
/// The process crashed.
434+
COREWEBVIEW2_PROCESS_FAILED_REASON_CRASHED,
435+
436+
/// The process failed to launch.
437+
COREWEBVIEW2_PROCESS_FAILED_REASON_LAUNCH_FAILED,
438+
439+
/// The process died due to running out of memory.
440+
COREWEBVIEW2_PROCESS_FAILED_REASON_OUT_OF_MEMORY,
441+
} COREWEBVIEW2_PROCESS_FAILED_REASON;
442+
443+
/// A continuation of `ICoreWebView2ProcessFailedEventArgs` interface.
444+
[uuid(c62f5687-2f09-481b-b6e4-2c0620bc95a2), object, pointer_default(unique)]
445+
interface ICoreWebView2ProcessFailedEventArgs2 : IUnknown {
446+
// The ProcessFailedKind property below is already in
447+
// ICoreWebView2ProcessFailedEventArgs. The changes to this interface extend
448+
// its return enum so it can now specify additional process kinds: gpu process
449+
// exited, utility process exited, etc. The property is included here to show
450+
// the updated docs.
451+
452+
/// The kind of process failure that has occurred. `processFailedKind` is
453+
/// `COREWEBVIEW2_PROCESS_FAILED_KIND_RENDER_PROCESS_EXITED` if the
454+
/// failed process is the main frame's renderer, even if there were subframes
455+
/// rendered by such process; all frames are gone when this happens.
456+
// [propget] HRESULT ProcessFailedKind(
457+
// [out, retval] COREWEBVIEW2_PROCESS_FAILED_KIND* processFailedKind);
458+
459+
/// The reason for the process failure. The reason is always
460+
/// `COREWEBVIEW2_PROCESS_FAILED_REASON_UNEXPECTED` when `ProcessFailedKind`
461+
/// is `COREWEBVIEW2_PROCESS_FAILED_KIND_BROWSER_PROCESS_EXITED`, and
462+
/// `COREWEBVIEW2_PROCESS_FAILED_REASON_UNRESPONSIVE` when `ProcessFailedKind`
463+
/// is `COREWEBVIEW2_PROCESS_FAILED_KIND_RENDER_PROCESS_UNRESPONSIVE`.
464+
/// For other process failure kinds, the reason may be any of the reason
465+
/// values.
466+
[propget] HRESULT Reason(
467+
[out, retval] COREWEBVIEW2_PROCESS_FAILED_REASON* reason);
468+
469+
/// The exit code of the failing process. The exit code is always `1` when
470+
/// `ProcessFailedKind` is
471+
/// `COREWEBVIEW2_PROCESS_FAILED_KIND_BROWSER_PROCESS_EXITED`, and
472+
/// `STILL_ACTIVE` (`259`) when `ProcessFailedKind` is
473+
/// `COREWEBVIEW2_PROCESS_FAILED_KIND_RENDER_PROCESS_UNRESPONSIVE`.
474+
[propget] HRESULT ExitCode(
475+
[out, retval] int* exitCode);
476+
477+
/// Description of the process assigned by the WebView2 Runtime. This is a
478+
/// technical English term appropriate for logging or development purposes,
479+
/// and not localized for the end user. It applies to utility processes (e.g.,
480+
/// "Audio Service", "Video Capture") and plugin processes (e.g., "Flash").
481+
/// The returned `processDescription` is `null` if the WebView2 Runtime did
482+
/// not assign a description to the process.
483+
[propget] HRESULT ProcessDescription(
484+
[out, retval] LPWSTR* processDescription);
485+
486+
/// The list of frames in the `CoreWebView2` that were being rendered by the
487+
/// failed process. The content in these frames is replaced with a "sad face"
488+
/// layer.
489+
/// This is only available when `ProcessFailedKind` is
490+
/// `COREWEBVIEW2_PROCESS_FAILED_KIND_FRAME_RENDER_PROCESS_EXITED`;
491+
/// `frames` is `null` for all other process failure kinds, including the case
492+
/// in which the failed process was the renderer for the main frame and
493+
/// subframes within it, for which the failure kind is
494+
/// `COREWEBVIEW2_PROCESS_FAILED_KIND_RENDER_PROCESS_EXITED`.
495+
[propget] HRESULT ImpactedFramesInfo(
496+
[out, retval] ICoreWebView2FrameInfoCollection** frames);
497+
}
498+
499+
/// Collection of frame details (name and source). Used to list the impacted
500+
/// frames' info when a frame-only render process failure occurs in the
501+
/// `ICoreWebView2`.
502+
[uuid(4bedeef8-3de7-4a3a-aadc-e9437bfb3e92), object, pointer_default(unique)]
503+
interface ICoreWebView2FrameInfoCollection : IUnknown {
504+
/// Gets an iterator over the collection of frames' info.
505+
HRESULT GetIterator(
506+
[out, retval] ICoreWebView2FrameInfoCollection** iterator);
507+
}
508+
509+
/// Iterator for a collection of frames' info. For more info, see
510+
/// `ICoreWebView2ProcessFailedEventArgs2` and
511+
/// `ICoreWebView2FrameInfoCollection`.
512+
[uuid(0e2367b9-c725-4696-bb8a-75b97af32330), object, pointer_default(unique)]
513+
interface ICoreWebView2FrameInfoCollectionIterator : IUnknown {
514+
/// Get the current `ICoreWebView2FrameInfo` of the iterator.
515+
HRESULT GetCurrentFrameInfo([out, retval] ICoreWebView2FrameInfo** frameInfo);
516+
517+
/// `TRUE` when the iterator has not run out of frames' info. If the
518+
/// collection over which the iterator is iterating is empty or if the
519+
/// iterator has gone past the end of the collection, then this is `FALSE`.
520+
HRESULT HasCurrentFrameInfo([out, retval] BOOL* hasCurrent);
521+
522+
/// Move the iterator to the next frame's info in the collection.
523+
HRESULT MoveNext([out, retval] BOOL* hasNext);
524+
}
525+
526+
/// Provides a set of properties for a frame in the `ICoreWebView2`.
527+
[uuid(b41e743b-ab1a-4054-bafa-d3347ddc4ddc), object, pointer_default(unique)]
528+
interface ICoreWebView2FrameInfo : IUnknown {
529+
/// The name attribute of the frame, as in `<iframe name="frame-name" ...>`.
530+
/// This is `null` when the frame has no name attribute.
531+
[propget] HRESULT Name([out, retval] LPWSTR* name);
532+
/// The URI of the document in the frame.
533+
[propget] HRESULT Source([out, retval] LPWSTR* source);
534+
}
535+
536+
}
537+
371538
```
372539

373540
## .NET and WinRT
374541
```c#
542+
namespace Microsoft.Web.WebView2.Core
543+
{
544+
// ...
545+
546+
/// Specifies the process failure type used in the
547+
/// `CoreWebView2ProcessFailedEventArgs`.
548+
/// The values in this enum make reference to the process kinds in the
549+
/// Chromium architecture. For more information about what these processes
550+
/// are and what they do, see [Browser Architecture - Inside look at modern web browser](https://developers.google.com/web/updates/2018/09/inside-browser-part1)
551+
enum CoreWebView2ProcessFailedKind
552+
{
553+
// Existing stable values
554+
BrowserProcessExited,
555+
/// Indicates that the main frame's render process ended unexpectedly. A new
556+
/// render process is created automatically and navigated to an error page.
557+
/// The app runs `Reload()` to try to recover from the failure.
558+
RenderProcessExited,
559+
RenderProcessUnresponsive,
560+
561+
// New values.
562+
563+
/// Indicates that a frame-only render process ended unexpectedly. The process
564+
/// exit does not impact the top-level document, only a subset of the
565+
/// subframes within it. The content in these frames is replaced with a "sad
566+
/// face" layer.
567+
FrameRenderProcessExited,
568+
/// Indicates that a utility process ended unexpectedly.
569+
UtilityProcessExited,
570+
/// Indicates that a sandbox helper process ended unexpectedly.
571+
SandboxHelperProcessExited,
572+
/// Indicates that the GPU process ended unexpectedly.
573+
GpuProcessExited,
574+
/// Indicates that a PPAPI plugin process ended unexpectedly.
575+
PpapiPluginProcessExited,
576+
/// Indicates that a PPAPI plugin broker process ended unexpectedly.
577+
PpapiBrokerProcessExited,
578+
/// Indicates that a process of unspecified kind ended unexpectedly.
579+
UnknownProcessExited,
580+
};
581+
582+
/// Specifies the process failure reason used in the
583+
/// `CoreWebView2ProcessFailedEventArgs`.
584+
enum CoreWebView2ProcessFailedReason
585+
{
586+
/// An unexpected process failure occurred.
587+
Unexpected,
588+
/// The process became unresponsive.
589+
/// This only applies to the main frame's render process.
590+
Unresponsive,
591+
/// The process was killed. E.g., from Task Manager.
592+
Killed,
593+
/// The process crashed.
594+
Crashed,
595+
/// The process failed to launch.
596+
LaunchFailed,
597+
/// The process died due to running out of memory.
598+
OutOfMemory,
599+
};
600+
601+
runtimeclass CoreWebView2ProcessFailedEventArgs
602+
{
603+
// The property below is already in the event args and included here
604+
// just to show the updated docs.
605+
606+
/// The kind of process failure that has occurred. Returns
607+
/// `CoreWebView2ProcessFailedKind.RenderProcessExited` if the
608+
/// failed process is the main frame's renderer, even if there were subframes
609+
/// rendered by such process; all frames are gone when this happens.
610+
// CoreWebView2ProcessFailedKind ProcessFailedKind { get; };
611+
612+
613+
/// The reason for the process failure. The reason is always
614+
/// `CoreWebView2ProcessFailedReason..Unexpected` when `ProcessFailedKind`
615+
/// is `CoreWebView2ProcessFailedKind.BrowserProcessExited`, and
616+
/// `CoreWebView2ProcessFailedReason..Unresponsive` when `ProcessFailedKind`
617+
/// is `CoreWebView2ProcessFailedKind.RenderProcessUnresponsive`.
618+
/// For other process failure kinds, the reason may be any of the reason
619+
/// values.
620+
CoreWebView2ProcessFailedReason Reason { get; };
621+
622+
/// The exit code of the failing process. The exit code is always `1` when
623+
/// `ProcessFailedKind` is
624+
/// `CoreWebView2ProcessFailedKind.BrowserProcessExited`, and
625+
/// `STILL_ACTIVE` (`259`) when `ProcessFailedKind` is
626+
/// `CoreWebView2ProcessFailedKind.RenderProcessUnresponsive`.
627+
Int32 ExitCode { get; };
628+
629+
/// Description of the process assigned by the WebView2 Runtime. This is a
630+
/// technical English term appropriate for logging or development purposes,
631+
/// and not localized for the end user. It applies to utility processes (e.g.,
632+
/// "Audio Service", "Video Capture") and plugin processes (e.g., "Flash").
633+
/// The returned string is `null` if the WebView2 Runtime did
634+
/// not assign a description to the process.
635+
String ProcessDescription { get; };
636+
637+
/// The list of frames in the `CoreWebView2` that were being rendered by the
638+
/// failed process. The content in these frames is replaced with a "sad face"
639+
/// layer.
640+
/// This is only available when `ProcessFailedKind` is
641+
/// `CoreWebView2ProcessFailedKind.FrameRenderProcessExited`;
642+
/// it is `null` for all other process failure kinds, including the case
643+
/// in which the failed process was the renderer for the main frame and
644+
/// subframes within it, for which the failure kind is
645+
/// `CoreWebView2ProcessFailedKind.RenderProcessExited`.
646+
CoreWebView2FrameInfoCollection ImpactedFramesInfo { get; };
647+
}
648+
649+
/// Collection of frame details (name and source). Used to list the impacted
650+
/// frames' info when a frame-only render process failure occurs in the
651+
/// `CoreWebView2`.
652+
runtimeclass CoreWebView2FrameInfoCollection
653+
{
654+
/// Gets an iterator over the collection of frames' info.
655+
CoreWebView2FrameInfoCollection GetIterator();
656+
}
657+
658+
/// Iterator for a collection of frames' info. For more info, see
659+
/// `CoreWebView2ProcessFailedEventArgs` and
660+
/// ICoreWebView2FrameInfoCollection`.
661+
runtimeclass CoreWebView2FrameInfoCollectionIterator
662+
{
663+
/// Get the current `CoreWebView2FrameInfo` of the iterator.
664+
CoreWebView2FrameInfo GetCurrentFrameInfo();
665+
666+
/// `true` when the iterator has not run out of frames' info. If the
667+
/// collection over which the iterator is iterating is empty or if the
668+
/// iterator has gone past the end of the collection, then this is `false`.
669+
Int32 HasCurrentFrameInfo();
670+
671+
/// Move the iterator to the next frame's info in the collection.
672+
Boolean MoveNext();
673+
}
674+
675+
/// Provides a set of properties for a frame in the `CoreWebView2`.
676+
runtimeclass CoreWebView2FrameInfo
677+
{
678+
/// The name attribute of the frame, as in `<iframe name="frame-name" ...>`.
679+
/// This is `null` when the frame has no name attribute.
680+
String Name { get; };
681+
682+
/// The URI of the document in the frame.
683+
String Source { get; };
684+
}
685+
}
686+
375687
```

0 commit comments

Comments
 (0)