mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-30 20:37:31 +09:00
[DOM] Only construct JS-implemented objects if inner window is current.
This commit is contained in:
parent
209eb0a245
commit
f0f7b56d77
1 changed files with 6 additions and 1 deletions
|
|
@ -2516,6 +2516,12 @@ ConstructJSImplementation(const char* aContractId,
|
||||||
{
|
{
|
||||||
AutoNoJSAPI nojsapi;
|
AutoNoJSAPI nojsapi;
|
||||||
|
|
||||||
|
nsCOMPtr<nsPIDOMWindowInner> window = do_QueryInterface(aGlobal);
|
||||||
|
if (!window->IsCurrentInnerWindow()) {
|
||||||
|
aRv.Throw(NS_ERROR_FAILURE);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Get the XPCOM component containing the JS implementation.
|
// Get the XPCOM component containing the JS implementation.
|
||||||
nsresult rv;
|
nsresult rv;
|
||||||
nsCOMPtr<nsISupports> implISupports = do_CreateInstance(aContractId, &rv);
|
nsCOMPtr<nsISupports> implISupports = do_CreateInstance(aContractId, &rv);
|
||||||
|
|
@ -2530,7 +2536,6 @@ ConstructJSImplementation(const char* aContractId,
|
||||||
// and our global is a window.
|
// and our global is a window.
|
||||||
nsCOMPtr<nsIDOMGlobalPropertyInitializer> gpi =
|
nsCOMPtr<nsIDOMGlobalPropertyInitializer> gpi =
|
||||||
do_QueryInterface(implISupports);
|
do_QueryInterface(implISupports);
|
||||||
nsCOMPtr<nsPIDOMWindowInner> window = do_QueryInterface(aGlobal);
|
|
||||||
if (gpi) {
|
if (gpi) {
|
||||||
JS::Rooted<JS::Value> initReturn(RootingCx());
|
JS::Rooted<JS::Value> initReturn(RootingCx());
|
||||||
rv = gpi->Init(window, &initReturn);
|
rv = gpi->Init(window, &initReturn);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue