mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 13:21:05 +00:00
Bug 1634703 - Add a parent-process-only method to nsIDOMWindowUtils to get the native window ID from a window. r=mstange
Differential Revision: https://phabricator.services.mozilla.com/D73481
This commit is contained in:
parent
66a6e86753
commit
8d34859a49
@ -4342,3 +4342,26 @@ nsDOMWindowUtils::GetPaintCount(uint64_t* aPaintCount) {
|
||||
*aPaintCount = presShell ? presShell->GetPaintCount() : 0;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMWindowUtils::GetWebrtcRawDeviceId(nsAString& aRawDeviceId) {
|
||||
if (!XRE_IsParentProcess()) {
|
||||
MOZ_CRASH(
|
||||
"GetWebrtcRawDeviceId is only available in the parent "
|
||||
"process");
|
||||
}
|
||||
|
||||
nsIWidget* widget = GetWidget();
|
||||
if (!widget) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
int64_t rawDeviceId =
|
||||
(int64_t)(widget->GetNativeData(NS_NATIVE_WINDOW_WEBRTC_DEVICE_ID));
|
||||
if (!rawDeviceId) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
aRawDeviceId.AppendInt(rawDeviceId);
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -2054,6 +2054,15 @@ interface nsIDOMWindowUtils : nsISupports {
|
||||
|
||||
// Returns true if we are using overlay scrollbars.
|
||||
readonly attribute bool usesOverlayScrollbars;
|
||||
|
||||
// Returns the ID for the underlying window widget, which can
|
||||
// be compared against the rawId from a nsIMediaDevice to determine
|
||||
// if the window is being shared.
|
||||
//
|
||||
// Using this only makes sense in the parent process, and the function
|
||||
// will intentionally crash any non-parent process that tries to access
|
||||
// it.
|
||||
readonly attribute AString webrtcRawDeviceId;
|
||||
};
|
||||
|
||||
[scriptable, uuid(c694e359-7227-4392-a138-33c0cc1f15a6)]
|
||||
|
@ -131,6 +131,7 @@ typedef void* nsNativeWidget;
|
||||
// IME context. Note that the result is only valid in the process. So,
|
||||
// XP code should use nsIWidget::GetNativeIMEContext() instead of using this.
|
||||
#define NS_RAW_NATIVE_IME_CONTEXT 14
|
||||
#define NS_NATIVE_WINDOW_WEBRTC_DEVICE_ID 15
|
||||
#ifdef XP_MACOSX
|
||||
# define NS_NATIVE_PLUGIN_PORT_QD 100
|
||||
# define NS_NATIVE_PLUGIN_PORT_CG 101
|
||||
|
Loading…
Reference in New Issue
Block a user