Skip to content
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

API Review: Frame process info #3675

Open
wants to merge 19 commits into
base: main
Choose a base branch
from
Open

API Review: Frame process info #3675

wants to merge 19 commits into from

Conversation

JosephJin0815
Copy link

This is a review for the new FrameProcessInfo API.

@JosephJin0815 JosephJin0815 added the API Proposal Review WebView2 API Proposal for review. label Jul 31, 2023
if (environment14)
{
//! [GetProcessInfosWithDetails]
CHECK_FAILURE(environment14->GetProcessInfosWithDetails(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need a new method at all? Is the problem that getting the AssociatedFrameInfos is expensive, so we don't want to do the work unless explicitly requested?

(Also, we're taking the name "WithDetails", which means that if we extend ProcessInfo more, we're stuck with a clunky name like "WithMoreDetails" or "NowEvenDetailier".)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, it could be expensive. Considered we want to use the new method to acquire more process information detail.
Current design is to populate data in CoreWebView2Environment.GetProcessInfosWithDetails and extend CoreWebView2ProcessInfo.

Copy link

@Scottj1s Scottj1s Aug 15, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was my first question too - why is GetProcessInfosWithDetails even necessary, given you need to QI for ICoreWebView2ProcessInfo2? Either the QI or the call to get_AssociatedFrameInfos provide ample opportunity for lazy evaluation of the AssociatedFrameInfos.

CHECK_FAILURE(
processInfo->QueryInterface(IID_PPV_ARGS(&processInfo2)));
wil::com_ptr<ICoreWebView2FrameInfoCollection> frameInfoCollection;
CHECK_FAILURE(processInfo2->get_AssociatedFrameInfos(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this return the associated frame infos as of the point of call? Or does it return the frame infos for the frames that were associated at the time GetProcessInfosWithDetails was called?

In other words, is this a snapshot or a live object?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's when GetProcessInfosWithDetails gets called. It's a snapshot.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New names discussed: GetProcessExtendedInfosAsync returns ProcessExtendedInfo.

{
wil::com_ptr<ICoreWebView2FrameInfo> mainFrameInfo;
wil::com_ptr<ICoreWebView2FrameInfo2> frameInfo2;
while (frameInfo)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just checking: A frame that is an immediate child of the top-level document reports no parent frame. In other words, the top-level document does not count as a "frame" for this purpose.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We inherit internal definition and treat top-level document as the MainFrame. For an immediate child of the top-level document, we reports the corresponding MainFrame as its parent frame.

COREWEBVIEW2_FRAME_KIND frameKind = COREWEBVIEW2_FRAME_KIND_OTHER;

CHECK_FAILURE(frameInfo->get_Name(&nameRaw));
std::wstring name = ((std::wstring)(nameRaw.get())).empty() ? L"none" : nameRaw.get();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
std::wstring name = ((std::wstring)(nameRaw.get())).empty() ? L"none" : nameRaw.get();
std::wstring name = nameRaw.get()[0] ? nameRaw.get() : L"none";

No need to create a temporary std::wstring for the sole purpose of checking if the string is empty.

std::wstring ProcessComponent::FrameKindToString(const COREWEBVIEW2_FRAME_KIND kind)
{
switch (kind)
{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think a macro definition is missing

#define KIND_ENTRY(kindValue) case kindValue: return L#kindValue;

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please fix

CHECK_FAILURE(frameInfo2->get_FrameId(&mainFrameId));

wil::com_ptr<ICoreWebView2FrameInfo> firstLevelFrameInfo =
GetAncestorFirstLevelFrameInfo(frameInfo);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

C++ sample forgot to include the code for this function. (But I can infer it from the C# sample.)

Terminology is a little confusing. "First level frame" sounds like the main frame (since the main frame comes first), but I think here "first level frame" is "first level below the main frame." So it's the first subframe.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed. Please update. Main frame's child or don't treat this specially and don't give it a term.

CHECK_FAILURE(frameInfo2->get_FrameId(&firstLevelFrameId));
}

result << L"{frame name:" << name << L" | frame Id:" << std::to_wstring(frameId)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
result << L"{frame name:" << name << L" | frame Id:" << std::to_wstring(frameId)
result << L"{frame name:" << name << L" | frame Id:" << frameId

Don't need to std::to_wstring the uint32. << can accept uint32's already.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please fix

CHECK_FAILURE(
processInfo->QueryInterface(IID_PPV_ARGS(&processInfo2)));
wil::com_ptr<ICoreWebView2FrameInfoCollection> frameInfoCollection;
CHECK_FAILURE(processInfo2->get_AssociatedFrameInfos(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens if you call the old GetProcessInfos (no WithDetails) and then ask for the AssociatedFrameInfos? Do you get an empty list? Do you get nullptr? Do you get an exception?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It will return an empty list,

CoreWebView2ProcessInfo objects obtained via CoreWebView2Environment. GetProcessInfos or for non-renderer processes will always have an empty AssociatedFrameInfos.

Copy link

@kmahone kmahone Aug 14, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a little confusing as there would be no way to guess that just from reading the api.

Would it instead be possible to do something like:

runtimeclass CoreWebView2
{
    Windows.Foundation.IAsyncOperation<IVectorView<WebView2ProcessAndFrameInfo>> GetProcessAndFrameInfosAsync()
}

runtimeclass WebView2ProcessAndFrameInfo
{
    CoreWebView2ProcessInfo ProcessInfo {get; }
    IVectorView<CoreWebView2FrameInfo> FrameInfos { get; };
}

This way you would never end up with an object that included 'dummy' properties.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or CoreWebView2ProcessInfo.GetAssociatedFrameInfos()?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is another reason not to introduce GetProcessInfosWithDetails - it fragments the behavior of GetProcessInfos. Just add ICoreWebView2ProcessInfo2 with lazy evaluation of get_AssociatedFrameInfos.

CHECK_FAILURE(
processInfo->QueryInterface(IID_PPV_ARGS(&processInfo2)));
wil::com_ptr<ICoreWebView2FrameInfoCollection> frameInfoCollection;
CHECK_FAILURE(processInfo2->get_AssociatedFrameInfos(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about top-level documents? This lets me find the process that is hosting a specific frame, but how do I find the process that is hosting my top-level document?

The documentation for ParentFrameInfo suggests that you can get a FrameInfo for the top-level document, since it talks about the value of the ParentFrameInfo property in that case:

This property is also null for the top most document in the WebView2 which has no parent frame.
But how do you get the FrameInfo for the top-level document?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The top-level documents also returning as part of GetProcessInfosWithDetails. CoreWebView2FrameKind.MainFrame is the type for top-level documents.

[v1_enum]
typedef enum COREWEBVIEW2_FRAME_KIND {
/// Indicates that the frame is type of frame we don't differentiate yet.
COREWEBVIEW2_FRAME_KIND_OTHER,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we ever report this for any other kind of frames beyond terminated frames? Could just call this TERMINATED and just use new values for future types of frames?

Calling it OTHER makes it hard to add new types of frames later. Suppose we add "3DFrames" later. Do they show up as COREWEBVIEW2_FRAME_KIND_3DFRAME and confuse old clients? Or do we report them as COREWEBVIEW2_FRAME_KIND_OTHER and confuse new clients?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See above


We provide the `GetProcessInfos` API for host applications to understand which
processes are part of their WebView2s. That API provides enough information for
a host application to understand the overall performance impact(memory, CPU
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
a host application to understand the overall performance impact(memory, CPU
a host application to understand the overall performance impact (memory, CPU

nit, missing space. This occurs all three times parentheticals are used in Background + Description.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Noted!

[v1_enum]
typedef enum COREWEBVIEW2_FRAME_KIND {
/// Indicates that the frame is type of frame we don't differentiate yet.
COREWEBVIEW2_FRAME_KIND_OTHER,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need a reserved Other enum for future expansion here? (vs adding new concrete frame kinds when they becomes defined)
Are there real other types we know about but aren't including?
I'm wondering if including Other increases risk of non-extensible usage. Will developers' apps break if some Frames "change kind" from Other to a new/future enum value? When or why would a developer check for "Other" type today?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably yes - With the speed and experimentation-centric approach of web standards, it's reasonable to expect new kinds of frames that we'll add well after they first appear. For example, Fenced Frames have been a proposal and prototype/experiment for years but are just getting to being a "standard". It's possible for something like this to change names, get dropped entirely, etc. that we wouldn't want to set in stone for our enum until it's actually complete.

Realistically, most use-cases will probably treat "Other" just like "IFrame" and be fine.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Frame type "Other" helps to provide a more complete/accurate frame tree structure while frame kinds updating.
There're other defined frame types like embed frame, object frame that developers might want to differentiate.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have we written down some kind of a philosophy/strategy on API compat for WebView?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please change Other -> Unknown, and update documentation to explain compat situation.

the `FrameId` property. This property represents the unique identifier of
the frame running in this `CoreWebView2` or `CoreWebView2Frame`.

* We propose extending `CoreWebView2FrameInfo` to include `FrameId`,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we're extending CoreWebView2ProcessInfo itself, results from existing GetProcessInfos() calls will start having an empty AssociatedFrameInfos property. GetProcessInfosWithDetails results may have empty results. Is it up the app developer to keep track of when the property is real vs inert?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Potential Option
GetProcessInfo: Light weight data
GetProcessInfoExtended(Async): Heavy data like AssociatedFrameInfos.

wil::com_ptr<ICoreWebView2FrameInfo> frameInfo);
std::wstring FrameKindToString(COREWEBVIEW2_FRAME_KIND kind);

// Display renderer process info with details which includes the list of
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

right now "Details" specifically means AssociatedFrameInfos. If we add more new optional details, will they also be populated by calls to GetProcessInfosWithDetails, or would there be a new method to opt into even more specific information?
(I infer they'd be populated in calls to GetProcessInfosWithDetails, otherwise we'd name this method GetProcessInfosWithFramesInfo to avoid boxing out future method names.)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As a tangible example for when this comment is discussed - We can theoretically have renderer processes for service workers that don't have an active frame.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Considered we may provide more information for the processInfo. We'd like to extend CoreWebView2ProcessInfo to have more Associated...Info instead of adding more CoreWebView2Environment.GetProcessInfosWith...Info .

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Returning the sparsely populated Infos is confusing. Could the associated info be a getter method? As in: CoreWebView2ProcessInfo.GetAssociatedFrameInfos()?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See above

/// Note that `FrameId` may not be valid if `CoreWebView` has not done
/// any navigation. It's safe to get this value during or after the first
/// `ContentLoading` event. Otherwise, it could return the invalid frame Id 0.
[propget] HRESULT FrameId([out, retval] UINT32* id);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will developers want the Frame instead of FrameId value? How often will developers want to use this id to lookup a CoreWebView2Frame, or is the common case to log this for diagnostics?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For memory monitoring cases, we expect developers not only want to acquire resource consumption for the frame tree, but also have chance to take further operations for the corresponding CoreWebView2/CoreWebView2Frame. Not sure how often it is, but it's a requirement for our existing customers.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No change: We will want to do this in the future but its complicated and not required for this spec now.


# Description
* We propose extending `CoreWebView2Environment` to include the
`GetProcessInfosWithDetails` API. This asynchronous call returns a
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confirming, getting these frame details needs to be async? Is it expensive on the level of network or large-file access because of the multi-process model behind WV2?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It can be expensive on the level of network when navigating across pages with child frames.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In those cases, there could be a lot frame created/deleted message.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Discussion: yes, it's async because it can be slow


# Description
* We propose extending `CoreWebView2Environment` to include the
`GetProcessInfosWithDetails` API. This asynchronous call returns a
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inconsistent naming GetProcessInfosWithDetails here and GetProcessInfosWithDetailsAsync further down.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Discussion: the IDL projection has the "Async" suffix, the COM doesn't, which is pattern

/// `CoreWebView2FrameInfo` objects obtained via `CoreWebView2.ProcessFailed` will
/// always have a `null` `ParentFrameInfo`. This property is also `null` for the
/// top most document in the WebView2 which has no parent frame.
/// Note that this `ParentFrameInfo` could be out of date as it's a snapshot.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How are developers expected to check if this frame info is out of date? Track whether the ICoreWebView2Frame with same ID was destroyed?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Developers can check if the frame info is up-to-date by ID, but it's only limited on CoreWebView2 and first sub layer Iframe CoreWebViewFrame. Developers will make their own strategies to call this API. For example, I've heard a customer will check it periodically.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please document: does the snapshot correspond to when the call is made or when the call completes? And note you can use frame created/destroyed to know if the snapshot will correspond to the live data on CoreWebView2(Frame)

`GetProcessInfosWithDetails` API. This asynchronous call returns a
snapshot collection of `ProcessInfo`s corresponding to all currently
running processes associated with this `ICoreWebView2Environment`
except for crashpad process. This provide the same list of `ProcessInfo`s
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is "except for crashpad process" true for current GetProcessInfos? Not mentioned in the doc page

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider: update public doc

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JosephJin0815 Can you open a DevEco bug to update the GetProcessInfos docs to include this note?

return L#kindValue;

KIND_ENTRY(COREWEBVIEW2_FRAME_KIND_MAIN_FRAME);
KIND_ENTRY(COREWEBVIEW2_FRAME_KIND_IFRAME);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Naming: I thought we'd decided at some point to consistently use "frame" rather than "iframe" because no one remembers framesets anyway.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No change. This is intentional. We have different kinds of frames one of which is an iframe.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Discussion: This is "iframe" to distinguish it from other kinds of frames like main frame (which isn't an iframe) and future such as fenced frame

wil::com_ptr<ICoreWebView2FrameInfo> frameInfo);
std::wstring FrameKindToString(COREWEBVIEW2_FRAME_KIND kind);

// Display renderer process info with details which includes the list of
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Returning the sparsely populated Infos is confusing. Could the associated info be a getter method? As in: CoreWebView2ProcessInfo.GetAssociatedFrameInfos()?

CHECK_FAILURE(
processInfo->QueryInterface(IID_PPV_ARGS(&processInfo2)));
wil::com_ptr<ICoreWebView2FrameInfoCollection> frameInfoCollection;
CHECK_FAILURE(processInfo2->get_AssociatedFrameInfos(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or CoreWebView2ProcessInfo.GetAssociatedFrameInfos()?

[v1_enum]
typedef enum COREWEBVIEW2_FRAME_KIND {
/// Indicates that the frame is type of frame we don't differentiate yet.
COREWEBVIEW2_FRAME_KIND_OTHER,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have we written down some kind of a philosophy/strategy on API compat for WebView?

/// A continuation of the ICoreWebView2FrameInfo interface.
[uuid(a7a7e150-e2ca-11ed-b5ea-0242ac120002), object, pointer_default(unique)]
interface ICoreWebView2FrameInfo2 : ICoreWebView2FrameInfo {
/// This frame's parent frame's `FrameInfo`. `ParentFrameInfo` will only be
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/// This frame's parent frame's `FrameInfo`. `ParentFrameInfo` will only be
/// This parent frame's `FrameInfo`. `ParentFrameInfo` will only be

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please fix

[propget] HRESULT ParentFrameInfo([out, retval] ICoreWebView2FrameInfo** frameInfo);
/// The unique identifier of the frame associated with the current `FrameInfo`.
/// It's the same kind of ID as with the `FrameId` in `CoreWebView2` and via
/// `CoreWebView2Frame`. `FrameId` will only be populated when obtained
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/// `CoreWebView2Frame`. `FrameId` will only be populated when obtained
/// `CoreWebView2Frame`. `FrameId` will only be populated (non-zero) when obtained

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please fix.

/// A continuation of the ICoreWebView2_17 interface.
[uuid(ad712504-a66d-11ed-afa1-0242ac120002), object, pointer_default(unique)]
interface ICoreWebView2_18 : ICoreWebView2_17 {
/// The unique identifier of the current frame. It's the same kind of ID as with
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does "current frame" mean?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please fix: say "main frame" instead.

also can be used to build the frame tree represented by `FrameInfo`s.

# Examples
C++

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason the sample isn't C++/WinRT?

CHECK_FAILURE(frameInfo2->get_FrameId(&firstLevelFrameId));
}

result << L"{frame name:" << name << L" | frame Id:" << std::to_wstring(frameId)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please fix

std::wstring ProcessComponent::FrameKindToString(const COREWEBVIEW2_FRAME_KIND kind)
{
switch (kind)
{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please fix

return L#kindValue;

KIND_ENTRY(COREWEBVIEW2_FRAME_KIND_MAIN_FRAME);
KIND_ENTRY(COREWEBVIEW2_FRAME_KIND_IFRAME);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No change. This is intentional. We have different kinds of frames one of which is an iframe.

[v1_enum]
typedef enum COREWEBVIEW2_FRAME_KIND {
/// Indicates that the frame is type of frame we don't differentiate yet.
COREWEBVIEW2_FRAME_KIND_OTHER,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please change Other -> Unknown, and update documentation to explain compat situation.

[v1_enum]
typedef enum COREWEBVIEW2_FRAME_KIND {
/// Indicates that the frame is type of frame we don't differentiate yet.
COREWEBVIEW2_FRAME_KIND_OTHER,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See above

/// A continuation of the ICoreWebView2FrameInfo interface.
[uuid(a7a7e150-e2ca-11ed-b5ea-0242ac120002), object, pointer_default(unique)]
interface ICoreWebView2FrameInfo2 : ICoreWebView2FrameInfo {
/// This frame's parent frame's `FrameInfo`. `ParentFrameInfo` will only be
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please fix

/// `CoreWebView2FrameInfo` objects obtained via `CoreWebView2.ProcessFailed` will
/// always have a `null` `ParentFrameInfo`. This property is also `null` for the
/// top most document in the WebView2 which has no parent frame.
/// Note that this `ParentFrameInfo` could be out of date as it's a snapshot.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please document: does the snapshot correspond to when the call is made or when the call completes? And note you can use frame created/destroyed to know if the snapshot will correspond to the live data on CoreWebView2(Frame)

[propget] HRESULT ParentFrameInfo([out, retval] ICoreWebView2FrameInfo** frameInfo);
/// The unique identifier of the frame associated with the current `FrameInfo`.
/// It's the same kind of ID as with the `FrameId` in `CoreWebView2` and via
/// `CoreWebView2Frame`. `FrameId` will only be populated when obtained
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please fix.

/// A continuation of the ICoreWebView2_17 interface.
[uuid(ad712504-a66d-11ed-afa1-0242ac120002), object, pointer_default(unique)]
interface ICoreWebView2_18 : ICoreWebView2_17 {
/// The unique identifier of the current frame. It's the same kind of ID as with
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please fix: say "main frame" instead.

/// Note that `FrameId` may not be valid if `CoreWebView` has not done
/// any navigation. It's safe to get this value during or after the first
/// `ContentLoading` event. Otherwise, it could return the invalid frame Id 0.
[propget] HRESULT FrameId([out, retval] UINT32* id);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No change: We will want to do this in the future but its complicated and not required for this spec now.

@JosephJin0815 JosephJin0815 added the review completed WebView2 API Proposal that's been reviewed and now needs final update and push label Sep 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API Proposal Review WebView2 API Proposal for review. review completed WebView2 API Proposal that's been reviewed and now needs final update and push
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

9 participants