strict check if popup depth has been set
This commit is contained in:
parent
e2bf22831a
commit
2ca88b9b9f
@ -47,7 +47,7 @@ class PopupProxyHost {
|
|||||||
]));
|
]));
|
||||||
}
|
}
|
||||||
|
|
||||||
getOrCreatePopup(id=null, parentId=null, depth=0) {
|
getOrCreatePopup(id=null, parentId=null, depth=null) {
|
||||||
// Find by existing id
|
// Find by existing id
|
||||||
if (id !== null) {
|
if (id !== null) {
|
||||||
const popup = this._popups.get(id);
|
const popup = this._popups.get(id);
|
||||||
@ -77,10 +77,12 @@ class PopupProxyHost {
|
|||||||
|
|
||||||
// Create new popup
|
// Create new popup
|
||||||
if (parent !== null) {
|
if (parent !== null) {
|
||||||
if (depth !== 0) {
|
if (depth !== null) {
|
||||||
throw new Error('Depth cannot be set when parent exists');
|
throw new Error('Depth cannot be set when parent exists');
|
||||||
}
|
}
|
||||||
depth = parent.depth + 1;
|
depth = parent.depth + 1;
|
||||||
|
} else if (depth === null) {
|
||||||
|
depth = 0;
|
||||||
}
|
}
|
||||||
const popup = new Popup(id, depth, this._frameIdPromise);
|
const popup = new Popup(id, depth, this._frameIdPromise);
|
||||||
if (parent !== null) {
|
if (parent !== null) {
|
||||||
|
Loading…
Reference in New Issue
Block a user