mirror of
https://github.com/MercuryWorkshop/scramjet.git
synced 2025-05-17 08:00:02 -04:00
handle propagation in client.frame
This commit is contained in:
parent
44f5fc0c05
commit
35bca53824
1 changed files with 14 additions and 4 deletions
|
@ -108,7 +108,7 @@ export class ScramjetClient {
|
||||||
resolve(data.port);
|
resolve(data.port);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
})
|
}),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -145,7 +145,17 @@ export class ScramjetClient {
|
||||||
if (!frame) return null; // we're top level
|
if (!frame) return null; // we're top level
|
||||||
const sframe = frame[SCRAMJETFRAME];
|
const sframe = frame[SCRAMJETFRAME];
|
||||||
|
|
||||||
if (!sframe) return null; // we're a subframe. TODO handle propagation but not now
|
if (!sframe) {
|
||||||
|
// we're in a subframe, recurse upward until we find one
|
||||||
|
let currentwin = this.global.window;
|
||||||
|
while (currentwin.parent != currentwin) {
|
||||||
|
if (!currentwin.frameElement) return null; // ??
|
||||||
|
if (currentwin.frameElement && currentwin.frameElement[SCRAMJETFRAME]) {
|
||||||
|
return currentwin.frameElement[SCRAMJETFRAME];
|
||||||
|
}
|
||||||
|
currentwin = currentwin.parent.window;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return sframe;
|
return sframe;
|
||||||
}
|
}
|
||||||
|
@ -239,7 +249,7 @@ export class ScramjetClient {
|
||||||
h.construct = function (
|
h.construct = function (
|
||||||
constructor: any,
|
constructor: any,
|
||||||
argArray: any[],
|
argArray: any[],
|
||||||
newTarget: AnyFunction
|
newTarget: AnyFunction,
|
||||||
) {
|
) {
|
||||||
let returnValue: any = undefined;
|
let returnValue: any = undefined;
|
||||||
let earlyreturn = false;
|
let earlyreturn = false;
|
||||||
|
@ -354,7 +364,7 @@ export class ScramjetClient {
|
||||||
RawTrap<T>(
|
RawTrap<T>(
|
||||||
target: any,
|
target: any,
|
||||||
prop: string,
|
prop: string,
|
||||||
descriptor: Trap<T>
|
descriptor: Trap<T>,
|
||||||
): PropertyDescriptor {
|
): PropertyDescriptor {
|
||||||
if (!target) return;
|
if (!target) return;
|
||||||
if (!prop) return;
|
if (!prop) return;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue