mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-23 21:01:08 +00:00
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:
parent
243e3e5bb8
commit
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;
|
||||
|
Loading…
Reference in New Issue
Block a user