Bug 1542782 - Expose currentRemoteType on CanonicalBrowsingContext, r=farre

Differential Revision: https://phabricator.services.mozilla.com/D26550

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Nika Layzell 2019-04-08 16:29:08 +00:00
Родитель 91f0500959
Коммит c5ed431446
3 изменённых файлов: 25 добавлений и 0 удалений

Просмотреть файл

@ -65,6 +65,23 @@ ContentParent* CanonicalBrowsingContext::GetContentParent() const {
return cpm->GetContentProcessById(ContentParentId(mProcessId)); return cpm->GetContentProcessById(ContentParentId(mProcessId));
} }
void CanonicalBrowsingContext::GetCurrentRemoteType(nsAString& aRemoteType,
ErrorResult& aRv) const {
// If we're in the parent process, dump out the void string.
if (mProcessId == 0) {
aRemoteType.Assign(VoidString());
return;
}
ContentParent* cp = GetContentParent();
if (!cp) {
aRv.Throw(NS_ERROR_UNEXPECTED);
return;
}
aRemoteType.Assign(cp->GetRemoteType());
}
void CanonicalBrowsingContext::GetWindowGlobals( void CanonicalBrowsingContext::GetWindowGlobals(
nsTArray<RefPtr<WindowGlobalParent>>& aWindows) { nsTArray<RefPtr<WindowGlobalParent>>& aWindows) {
aWindows.SetCapacity(mWindowGlobals.Count()); aWindows.SetCapacity(mWindowGlobals.Count());

Просмотреть файл

@ -36,6 +36,8 @@ class CanonicalBrowsingContext final : public BrowsingContext {
uint64_t OwnerProcessId() const { return mProcessId; } uint64_t OwnerProcessId() const { return mProcessId; }
ContentParent* GetContentParent() const; ContentParent* GetContentParent() const;
void GetCurrentRemoteType(nsAString& aRemoteType, ErrorResult& aRv) const;
void SetOwnerProcessId(uint64_t aProcessId) { mProcessId = aProcessId; } void SetOwnerProcessId(uint64_t aProcessId) { mProcessId = aProcessId; }
void GetWindowGlobals(nsTArray<RefPtr<WindowGlobalParent>>& aWindows); void GetWindowGlobals(nsTArray<RefPtr<WindowGlobalParent>>& aWindows);

Просмотреть файл

@ -33,6 +33,12 @@ interface CanonicalBrowsingContext : BrowsingContext {
readonly attribute WindowGlobalParent? currentWindowGlobal; readonly attribute WindowGlobalParent? currentWindowGlobal;
// XXX(nika): This feels kinda hacky, but will do for now while we don't
// synchronously create WindowGlobalParent. It can throw if somehow the
// content process has died.
[Throws]
readonly attribute DOMString? currentRemoteType;
void notifyStartDelayedAutoplayMedia(); void notifyStartDelayedAutoplayMedia();
}; };