mirror of
https://github.com/MercuryWorkshop/scramjet.git
synced 2025-05-13 22:40:01 -04:00
fix client.frame
This commit is contained in:
parent
18117e360a
commit
c9c98bc70e
2 changed files with 10 additions and 1 deletions
|
@ -139,7 +139,9 @@ export class ScramjetClient {
|
||||||
|
|
||||||
get frame(): ScramjetFrame | null {
|
get frame(): ScramjetFrame | null {
|
||||||
if (!iswindow) return null;
|
if (!iswindow) return null;
|
||||||
const frame = this.global.window.frameElement;
|
const frame = this.descriptors["window.frameElement"]
|
||||||
|
? this.descriptors["window.frameElement"].get.call(this.global)
|
||||||
|
: this.global.window.frameElement;
|
||||||
|
|
||||||
if (!frame) return null; // we're top level
|
if (!frame) return null; // we're top level
|
||||||
const sframe = frame[SCRAMJETFRAME];
|
const sframe = frame[SCRAMJETFRAME];
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
import { ScramjetClient } from "./client";
|
import { ScramjetClient } from "./client";
|
||||||
import { nativeGetOwnPropertyDescriptor } from "./natives";
|
import { nativeGetOwnPropertyDescriptor } from "./natives";
|
||||||
import { unrewriteUrl, rewriteUrl } from "../shared";
|
import { unrewriteUrl, rewriteUrl } from "../shared";
|
||||||
|
import { UrlChangeEvent } from "./events";
|
||||||
import { iswindow } from ".";
|
import { iswindow } from ".";
|
||||||
|
|
||||||
export function createLocationProxy(
|
export function createLocationProxy(
|
||||||
|
@ -51,7 +52,13 @@ export function createLocationProxy(
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (prop === "hash") {
|
||||||
|
self.location.hash = args[0];
|
||||||
|
const ev = new UrlChangeEvent(client.url.href);
|
||||||
|
if (client.frame) client.frame.dispatchEvent(ev);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
const url = new URL(client.url.href);
|
const url = new URL(client.url.href);
|
||||||
url[prop] = args[0];
|
url[prop] = args[0];
|
||||||
client.url = url;
|
client.url = url;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue