From c9c98bc70e73c2f40b9899703a942ee1cc706a0e Mon Sep 17 00:00:00 2001 From: Percs <83934299+Percslol@users.noreply.github.com> Date: Tue, 5 Nov 2024 18:05:59 -0600 Subject: [PATCH] fix client.frame --- src/client/client.ts | 4 +++- src/client/location.ts | 7 +++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/client/client.ts b/src/client/client.ts index c755802..dab6435 100644 --- a/src/client/client.ts +++ b/src/client/client.ts @@ -139,7 +139,9 @@ export class ScramjetClient { get frame(): ScramjetFrame | 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 const sframe = frame[SCRAMJETFRAME]; diff --git a/src/client/location.ts b/src/client/location.ts index bf912db..385c438 100644 --- a/src/client/location.ts +++ b/src/client/location.ts @@ -2,6 +2,7 @@ import { ScramjetClient } from "./client"; import { nativeGetOwnPropertyDescriptor } from "./natives"; import { unrewriteUrl, rewriteUrl } from "../shared"; +import { UrlChangeEvent } from "./events"; import { iswindow } from "."; export function createLocationProxy( @@ -51,7 +52,13 @@ export function createLocationProxy( 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); url[prop] = args[0]; client.url = url;