Possibly fix UI crashing because tabid was not set for some request
This commit is contained in:
parent
1032097e2a
commit
399b5eca9d
|
@ -59,9 +59,17 @@ export default class ExtendedRequest {
|
||||||
if (this.data.tabId && this.data.tabId >= 0) {
|
if (this.data.tabId && this.data.tabId >= 0) {
|
||||||
const tab = await browser.tabs.get(this.data.tabId);
|
const tab = await browser.tabs.get(this.data.tabId);
|
||||||
url = tab.url;
|
url = tab.url;
|
||||||
|
} else if ((this.data as any)?.frameAncestors) {
|
||||||
|
url = (this.data as any).frameAncestors[0].url || "";
|
||||||
} else {
|
} else {
|
||||||
url = (this.data as any).frameAncestors?.[0].url || "";
|
const headers = Object.fromEntries(
|
||||||
|
this.data.requestHeaders.map(({ name, value }) => [name, value])
|
||||||
|
);
|
||||||
|
if (headers.Referer) {
|
||||||
|
url = headers.Referer;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.originalURL = url;
|
this.originalURL = url;
|
||||||
this.origin = new URL(url).origin;
|
this.origin = new URL(url).origin;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user