mirror of
https://github.com/MercuryWorkshop/scramjet.git
synced 2025-05-13 14:30:02 -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 {
|
||||
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];
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue