-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[v2, windows] Handle webview2 process crashes and add DisableWebViewRendererCodeIntegrity flag #2627
Merged
+220
−0
Merged
[v2, windows] Handle webview2 process crashes and add DisableWebViewRendererCodeIntegrity flag #2627
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
...nternal/frontend/desktop/windows/go-webview2/pkg/edge/COREWEBVIEW2_PROCESS_FAILED_KIND.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
//go:build windows | ||
|
||
package edge | ||
|
||
type COREWEBVIEW2_PROCESS_FAILED_KIND uint32 | ||
|
||
const ( | ||
// Indicates that the browser process ended unexpectedly. The WebView | ||
// automatically moves to the Closed state. The app has to recreate a new | ||
// WebView to recover from this failure. | ||
COREWEBVIEW2_PROCESS_FAILED_KIND_BROWSER_PROCESS_EXITED = 0 | ||
|
||
// Indicates that the main frame's render process ended unexpectedly. A new | ||
// render process is created automatically and navigated to an error page. | ||
// You can use the `Reload` method to try to reload the page that failed. | ||
COREWEBVIEW2_PROCESS_FAILED_KIND_RENDER_PROCESS_EXITED = 1 | ||
|
||
// Indicates that the main frame's render process is unresponsive. | ||
// | ||
// Note that this does not seem to work right now. | ||
// Does not fire for simple long running script case, the only related test | ||
// SitePerProcessBrowserTest::NoCommitTimeoutForInvisibleWebContents is | ||
// disabled. | ||
COREWEBVIEW2_PROCESS_FAILED_KIND_RENDER_PROCESS_UNRESPONSIVE = 2 | ||
|
||
// Indicates that a frame-only render process ended unexpectedly. The process | ||
// exit does not affect the top-level document, only a subset of the | ||
// subframes within it. The content in these frames is replaced with an error | ||
// page in the frame. | ||
COREWEBVIEW2_PROCESS_FAILED_KIND_FRAME_RENDER_PROCESS_EXITED = 3 | ||
|
||
// Indicates that a utility process ended unexpectedly. | ||
COREWEBVIEW2_PROCESS_FAILED_KIND_UTILITY_PROCESS_EXITED = 4 | ||
|
||
// Indicates that a sandbox helper process ended unexpectedly. | ||
COREWEBVIEW2_PROCESS_FAILED_KIND_SANDBOX_HELPER_PROCESS_EXITED = 5 | ||
|
||
// Indicates that the GPU process ended unexpectedly. | ||
COREWEBVIEW2_PROCESS_FAILED_KIND_GPU_PROCESS_EXITED = 6 | ||
|
||
// Indicates that a PPAPI plugin process ended unexpectedly. | ||
COREWEBVIEW2_PROCESS_FAILED_KIND_PPAPI_PLUGIN_PROCESS_EXITED = 7 | ||
|
||
// Indicates that a PPAPI plugin broker process ended unexpectedly. | ||
COREWEBVIEW2_PROCESS_FAILED_KIND_PPAPI_BROKER_PROCESS_EXITED = 8 | ||
|
||
// Indicates that a process of unspecified kind ended unexpectedly. | ||
COREWEBVIEW2_PROCESS_FAILED_KIND_UNKNOWN_PROCESS_EXITED = 9 | ||
) |
41 changes: 41 additions & 0 deletions
41
...rnal/frontend/desktop/windows/go-webview2/pkg/edge/ICoreWebView2ProcessFailedEventArgs.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
//go:build windows | ||
|
||
package edge | ||
|
||
import ( | ||
"fmt" | ||
"syscall" | ||
"unsafe" | ||
|
||
"golang.org/x/sys/windows" | ||
) | ||
|
||
type _ICoreWebView2ProcessFailedEventArgsVtbl struct { | ||
_IUnknownVtbl | ||
GetProcessFailedKind ComProc | ||
} | ||
|
||
type ICoreWebView2ProcessFailedEventArgs struct { | ||
vtbl *_ICoreWebView2ProcessFailedEventArgsVtbl | ||
} | ||
|
||
func (i *ICoreWebView2ProcessFailedEventArgs) GetProcessFailedKind() (COREWEBVIEW2_PROCESS_FAILED_KIND, error) { | ||
kind := COREWEBVIEW2_PROCESS_FAILED_KIND(0xffffffff) | ||
hr, _, err := i.vtbl.GetProcessFailedKind.Call( | ||
uintptr(unsafe.Pointer(i)), | ||
uintptr(unsafe.Pointer(&kind)), | ||
) | ||
|
||
if windows.Handle(hr) != windows.S_OK { | ||
return 0, syscall.Errno(hr) | ||
} | ||
|
||
if kind == 0xffffffff { | ||
if err == nil { | ||
err = fmt.Errorf("unknown error") | ||
} | ||
return 0, err | ||
} | ||
|
||
return kind, nil | ||
} |
53 changes: 53 additions & 0 deletions
53
...l/frontend/desktop/windows/go-webview2/pkg/edge/ICoreWebView2ProcessFailedEventHandler.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
//go:build windows | ||
|
||
package edge | ||
|
||
type _ICoreWebView2ProcessFailedEventHandlerVtbl struct { | ||
_IUnknownVtbl | ||
Invoke ComProc | ||
} | ||
|
||
type ICoreWebView2ProcessFailedEventHandler struct { | ||
vtbl *_ICoreWebView2ProcessFailedEventHandlerVtbl | ||
impl _ICoreWebView2ProcessFailedEventHandlerImpl | ||
} | ||
|
||
func (i *ICoreWebView2ProcessFailedEventHandler) AddRef() uintptr { | ||
return i.AddRef() | ||
} | ||
func _ICoreWebView2ProcessFailedEventHandlerIUnknownQueryInterface(this *ICoreWebView2ProcessFailedEventHandler, refiid, object uintptr) uintptr { | ||
return this.impl.QueryInterface(refiid, object) | ||
} | ||
|
||
func _ICoreWebView2ProcessFailedEventHandlerIUnknownAddRef(this *ICoreWebView2ProcessFailedEventHandler) uintptr { | ||
return this.impl.AddRef() | ||
} | ||
|
||
func _ICoreWebView2ProcessFailedEventHandlerIUnknownRelease(this *ICoreWebView2ProcessFailedEventHandler) uintptr { | ||
return this.impl.Release() | ||
} | ||
|
||
func _ICoreWebView2ProcessFailedEventHandlerInvoke(this *ICoreWebView2ProcessFailedEventHandler, sender *ICoreWebView2, args *ICoreWebView2ProcessFailedEventArgs) uintptr { | ||
return this.impl.ProcessFailed(sender, args) | ||
} | ||
|
||
type _ICoreWebView2ProcessFailedEventHandlerImpl interface { | ||
_IUnknownImpl | ||
ProcessFailed(sender *ICoreWebView2, args *ICoreWebView2ProcessFailedEventArgs) uintptr | ||
} | ||
|
||
var _ICoreWebView2ProcessFailedEventHandlerFn = _ICoreWebView2ProcessFailedEventHandlerVtbl{ | ||
_IUnknownVtbl{ | ||
NewComProc(_ICoreWebView2ProcessFailedEventHandlerIUnknownQueryInterface), | ||
NewComProc(_ICoreWebView2ProcessFailedEventHandlerIUnknownAddRef), | ||
NewComProc(_ICoreWebView2ProcessFailedEventHandlerIUnknownRelease), | ||
}, | ||
NewComProc(_ICoreWebView2ProcessFailedEventHandlerInvoke), | ||
} | ||
|
||
func newICoreWebView2ProcessFailedEventHandler(impl _ICoreWebView2ProcessFailedEventHandlerImpl) *ICoreWebView2ProcessFailedEventHandler { | ||
return &ICoreWebView2ProcessFailedEventHandler{ | ||
vtbl: &_ICoreWebView2ProcessFailedEventHandlerFn, | ||
impl: impl, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just wondering if this would fail on 32bit (not that we support it! 😅)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just tried it, works fine 😄