|
|
@@ -154,6 +154,8 @@ this.singlefile.lib.core = this.singlefile.lib.core || (() => {
|
|
|
this.root = root;
|
|
|
this.options = options;
|
|
|
this.options.url = this.options.url || (rootDocDefined && this.options.doc.location.href);
|
|
|
+ const matchResourceReferrer = this.options.url.match(/^.*\//);
|
|
|
+ this.options.resourceReferrer = this.options.passReferrerOnError && matchResourceReferrer && matchResourceReferrer[0];
|
|
|
this.options.baseURI = rootDocDefined && this.options.doc.baseURI;
|
|
|
this.options.rootDocument = root;
|
|
|
this.options.updatedResources = this.options.updatedResources || {};
|
|
|
@@ -349,7 +351,8 @@ this.singlefile.lib.core = this.singlefile.lib.core || (() => {
|
|
|
expectedType,
|
|
|
maxResourceSize: options.maxResourceSize,
|
|
|
maxResourceSizeEnabled: options.maxResourceSizeEnabled,
|
|
|
- frameId: options.windowId
|
|
|
+ frameId: options.windowId,
|
|
|
+ resourceReferrer: options.resourceReferrer
|
|
|
});
|
|
|
onloadListener({ url: resourceURL });
|
|
|
if (!this.cancelled) {
|
|
|
@@ -427,7 +430,8 @@ this.singlefile.lib.core = this.singlefile.lib.core || (() => {
|
|
|
maxResourceSize: this.options.maxResourceSize,
|
|
|
maxResourceSizeEnabled: this.options.maxResourceSizeEnabled,
|
|
|
charset,
|
|
|
- frameId: this.options.windowId
|
|
|
+ frameId: this.options.windowId,
|
|
|
+ resourceReferrer: this.options.resourceReferrer
|
|
|
});
|
|
|
pageContent = content.data;
|
|
|
}
|
|
|
@@ -903,7 +907,8 @@ this.singlefile.lib.core = this.singlefile.lib.core || (() => {
|
|
|
compressCSS: this.options.compressCSS,
|
|
|
updatedResources: this.options.updatedResources,
|
|
|
rootDocument: this.options.rootDocument,
|
|
|
- frameId: this.options.windowId
|
|
|
+ frameId: this.options.windowId,
|
|
|
+ resourceReferrer: this.options.resourceReferrer
|
|
|
};
|
|
|
await Promise.all(Array.from(this.doc.querySelectorAll("style, link[rel*=stylesheet]"))
|
|
|
.map(async element => {
|
|
|
@@ -1199,7 +1204,8 @@ this.singlefile.lib.core = this.singlefile.lib.core || (() => {
|
|
|
charset: this.charset != UTF8_CHARSET && this.charset,
|
|
|
maxResourceSize: this.options.maxResourceSize,
|
|
|
maxResourceSizeEnabled: this.options.maxResourceSizeEnabled,
|
|
|
- frameId: this.options.windowId
|
|
|
+ frameId: this.options.windowId,
|
|
|
+ resourceReferrer: this.options.resourceReferrer
|
|
|
});
|
|
|
content.data = getUpdatedResourceContent(resourceURL, content, this.options);
|
|
|
if (element.tagName == "SCRIPT") {
|
|
|
@@ -1565,7 +1571,8 @@ this.singlefile.lib.core = this.singlefile.lib.core || (() => {
|
|
|
maxResourceSize: options.maxResourceSize,
|
|
|
maxResourceSizeEnabled: options.maxResourceSizeEnabled,
|
|
|
validateTextContentType: true,
|
|
|
- frameId: options.frameId
|
|
|
+ frameId: options.frameId,
|
|
|
+ resourceReferrer: options.resourceReferrer
|
|
|
});
|
|
|
resourceURL = content.resourceURL;
|
|
|
content.data = getUpdatedResourceContent(resourceURL, content, options);
|
|
|
@@ -1640,6 +1647,7 @@ this.singlefile.lib.core = this.singlefile.lib.core || (() => {
|
|
|
maxResourceSizeEnabled: options.maxResourceSizeEnabled,
|
|
|
charset: options.charset,
|
|
|
frameId: options.frameId,
|
|
|
+ resourceReferrer: options.resourceReferrer,
|
|
|
validateTextContentType: true
|
|
|
});
|
|
|
resourceURL = content.resourceURL;
|
|
|
@@ -1790,7 +1798,8 @@ this.singlefile.lib.core = this.singlefile.lib.core || (() => {
|
|
|
expectedType: "image",
|
|
|
maxResourceSize: options.maxResourceSize,
|
|
|
maxResourceSizeEnabled: options.maxResourceSizeEnabled,
|
|
|
- frameId: options.windowId
|
|
|
+ frameId: options.windowId,
|
|
|
+ resourceReferrer: options.resourceReferrer
|
|
|
})).data;
|
|
|
} catch (error) {
|
|
|
// ignored
|