зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1696452: Handle attempts to construct JS-implemented interfaces in non-Window globals. r=peterv
We don't want to support this, but we also shouldn't crash if someone attempts it. Differential Revision: https://phabricator.services.mozilla.com/D108093
This commit is contained in:
Родитель
243e3e5bb8
Коммит
a045dbb379
|
@ -2559,6 +2559,10 @@ void ConstructJSImplementation(const char* aContractId,
|
|||
AutoNoJSAPI nojsapi;
|
||||
|
||||
nsCOMPtr<nsPIDOMWindowInner> window = do_QueryInterface(aGlobal);
|
||||
if (!window) {
|
||||
aRv.ThrowInvalidStateError("Global is not a Window");
|
||||
return;
|
||||
}
|
||||
if (!window->IsCurrentInnerWindow()) {
|
||||
aRv.ThrowInvalidStateError("Window no longer active");
|
||||
return;
|
||||
|
|
Загрузка…
Ссылка в новой задаче