-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug 1616353 - Part 7.1: Introduce a new nsOpenWindowInfo type, r=Gijs…
…,kmag This type replaces the individual properties, like nextRemoteTabId and presetOpenerWindow, which were passed around by frontend code for window opening requests performed by Gecko. This new type is intentionally native-only to make it easier to pass more information down to newly created windows in the future. Differential Revision: https://phabricator.services.mozilla.com/D67050
- Loading branch information
Showing
4 changed files
with
124 additions
and
4 deletions.
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
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,46 @@ | ||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- | ||
* | ||
* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
||
#include "nsISupports.idl" | ||
|
||
webidl BrowsingContext; | ||
|
||
%{ C++ | ||
namespace mozilla { | ||
class OriginAttributes; | ||
} // namespace mozilla | ||
%} | ||
[ref] native const_OriginAttributes(const mozilla::OriginAttributes); | ||
|
||
/** | ||
* nsIOpenWindowInfo is a helper type which contains details used when opening | ||
* new content windows. This object is used to correctly create new initial | ||
* content documents when creating a new window. | ||
*/ | ||
[scriptable, builtinclass, uuid(30359edb-126c-4f65-ae80-07fb158697f9)] | ||
interface nsIOpenWindowInfo : nsISupports { | ||
/** BrowsingContext which requested the creation of this new window */ | ||
[infallible] | ||
readonly attribute BrowsingContext parent; | ||
|
||
/** If `true`, the content document should be created initially-remote */ | ||
[infallible] | ||
readonly attribute boolean isRemote; | ||
|
||
/** Should |opener| be set on the newly-created content window? */ | ||
[infallible] | ||
readonly attribute boolean forceNoOpener; | ||
|
||
[infallible] | ||
readonly attribute unsigned long long nextRemoteBrowserId; | ||
|
||
/** Origin Attributes for the to-be-created toplevel BrowsingContext */ | ||
[implicit_jscontext, binaryname(ScriptableOriginAttributes)] | ||
readonly attribute jsval originAttributes; | ||
|
||
[notxpcom, nostdcall, binaryname(GetOriginAttributes)] | ||
const_OriginAttributes binaryGetOriginAttributes(); | ||
}; |
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,44 @@ | ||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ | ||
/* vim: set ts=8 sts=2 et sw=2 tw=80: */ | ||
/* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
||
#include "nsOpenWindowInfo.h" | ||
#include "mozilla/OriginAttributes.h" | ||
#include "mozilla/dom/ToJSValue.h" | ||
|
||
NS_IMPL_ISUPPORTS(nsOpenWindowInfo, nsIOpenWindowInfo) | ||
|
||
NS_IMETHODIMP nsOpenWindowInfo::GetParent( | ||
mozilla::dom::BrowsingContext** aParent) { | ||
*aParent = do_AddRef(mParent).take(); | ||
return NS_OK; | ||
} | ||
|
||
NS_IMETHODIMP nsOpenWindowInfo::GetIsRemote(bool* aIsRemote) { | ||
*aIsRemote = mIsRemote; | ||
return NS_OK; | ||
} | ||
|
||
NS_IMETHODIMP nsOpenWindowInfo::GetForceNoOpener(bool* aForceNoOpener) { | ||
*aForceNoOpener = mForceNoOpener; | ||
return NS_OK; | ||
} | ||
|
||
NS_IMETHODIMP nsOpenWindowInfo::GetScriptableOriginAttributes( | ||
JSContext* aCx, JS::MutableHandle<JS::Value> aAttrs) { | ||
bool ok = ToJSValue(aCx, mOriginAttributes, aAttrs); | ||
NS_ENSURE_TRUE(ok, NS_ERROR_FAILURE); | ||
return NS_OK; | ||
} | ||
|
||
const OriginAttributes& nsOpenWindowInfo::GetOriginAttributes() { | ||
return mOriginAttributes; | ||
} | ||
|
||
NS_IMETHODIMP nsOpenWindowInfo::GetNextRemoteBrowserId( | ||
uint64_t* aNextRemoteBrowserId) { | ||
*aNextRemoteBrowserId = mNextRemoteBrowserId; | ||
return NS_OK; | ||
} |
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,30 @@ | ||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ | ||
/* vim: set ts=8 sts=2 et sw=2 tw=80: */ | ||
/* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
||
#ifndef nsOpenWindowInfo_h | ||
#define nsOpenWindowInfo_h | ||
|
||
#include "nsIOpenWindowInfo.h" | ||
#include "nsISupportsImpl.h" | ||
#include "mozilla/OriginAttributes.h" | ||
#include "mozilla/RefPtr.h" | ||
|
||
class nsOpenWindowInfo : public nsIOpenWindowInfo { | ||
public: | ||
NS_DECL_ISUPPORTS | ||
NS_DECL_NSIOPENWINDOWINFO | ||
|
||
bool mForceNoOpener = false; | ||
bool mIsRemote = false; | ||
uint64_t mNextRemoteBrowserId = 0; | ||
OriginAttributes mOriginAttributes; | ||
RefPtr<BrowsingContext> mParent; | ||
|
||
private: | ||
virtual ~nsOpenWindowInfo() = default; | ||
}; | ||
|
||
#endif // nsOpenWindowInfo_h |