зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1658214: Only construct JS-implemented objects if inner window is current. r=bholley
Differential Revision: https://phabricator.services.mozilla.com/D86614
This commit is contained in:
Родитель
0920dd26fe
Коммит
9bbcae0e83
|
@ -2547,6 +2547,12 @@ void ConstructJSImplementation(const char* aContractId,
|
|||
{
|
||||
AutoNoJSAPI nojsapi;
|
||||
|
||||
nsCOMPtr<nsPIDOMWindowInner> window = do_QueryInterface(aGlobal);
|
||||
if (!window->IsCurrentInnerWindow()) {
|
||||
aRv.ThrowInvalidStateError("Window no longer active");
|
||||
return;
|
||||
}
|
||||
|
||||
// Get the XPCOM component containing the JS implementation.
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsISupports> implISupports = do_CreateInstance(aContractId, &rv);
|
||||
|
@ -2561,7 +2567,6 @@ void ConstructJSImplementation(const char* aContractId,
|
|||
// and our global is a window.
|
||||
nsCOMPtr<nsIDOMGlobalPropertyInitializer> gpi =
|
||||
do_QueryInterface(implISupports);
|
||||
nsCOMPtr<nsPIDOMWindowInner> window = do_QueryInterface(aGlobal);
|
||||
if (gpi) {
|
||||
JS::Rooted<JS::Value> initReturn(RootingCx());
|
||||
rv = gpi->Init(window, &initReturn);
|
||||
|
|
Загрузка…
Ссылка в новой задаче