@lvce-editor/main-process 6.37.6 → 6.37.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/mainProcessMain.js +13 -13
- package/package.json +1 -1
package/dist/mainProcessMain.js
CHANGED
|
@@ -6439,12 +6439,12 @@ const resolveWithTimeout = async (fetcher, favicons) => {
|
|
|
6439
6439
|
clearTimeout(timeout);
|
|
6440
6440
|
}
|
|
6441
6441
|
};
|
|
6442
|
-
const resolveFavicon = async (
|
|
6442
|
+
const resolveFavicon = async (webContents, favicons) => {
|
|
6443
6443
|
const dataUrl = favicons.find(favicon => favicon.startsWith('data:'));
|
|
6444
6444
|
if (dataUrl) {
|
|
6445
6445
|
return [dataUrl];
|
|
6446
6446
|
}
|
|
6447
|
-
const sessionFavicon = await resolveWithTimeout((url, options) =>
|
|
6447
|
+
const sessionFavicon = await resolveWithTimeout((url, options) => webContents.session.fetch(url, options), favicons);
|
|
6448
6448
|
if (sessionFavicon) {
|
|
6449
6449
|
return [sessionFavicon];
|
|
6450
6450
|
}
|
|
@@ -6459,14 +6459,14 @@ const resolveNetworkFavicon = async favicons => {
|
|
|
6459
6459
|
const networkFavicon = await resolveWithTimeout((url, options) => fetch(url, options), favicons);
|
|
6460
6460
|
return networkFavicon ? [networkFavicon] : [];
|
|
6461
6461
|
};
|
|
6462
|
-
const handler$5 = async (
|
|
6463
|
-
const pageUrl =
|
|
6462
|
+
const handler$5 = async (_event, favicons, _webContentsId, webContents) => {
|
|
6463
|
+
const pageUrl = webContents.getURL();
|
|
6464
6464
|
if (favicons.length > 0) {
|
|
6465
|
-
set(
|
|
6465
|
+
set(webContents, pageUrl);
|
|
6466
6466
|
}
|
|
6467
|
-
const resolvedFavicons = await resolveFavicon(
|
|
6467
|
+
const resolvedFavicons = await resolveFavicon(webContents, favicons);
|
|
6468
6468
|
return {
|
|
6469
|
-
messages:
|
|
6469
|
+
messages: webContents.getURL() === pageUrl ? [['handlePageFaviconUpdated', resolvedFavicons]] : [],
|
|
6470
6470
|
result: undefined
|
|
6471
6471
|
};
|
|
6472
6472
|
};
|
|
@@ -6487,7 +6487,7 @@ const attach$6 = (webContents, listener) => {
|
|
|
6487
6487
|
const detach$4 = (webContents, listener) => {
|
|
6488
6488
|
webContents.off(DidNavigate, listener);
|
|
6489
6489
|
};
|
|
6490
|
-
const loadDefaultFavicon = async (
|
|
6490
|
+
const loadDefaultFavicon = async (webContents, url) => {
|
|
6491
6491
|
let faviconUrl;
|
|
6492
6492
|
try {
|
|
6493
6493
|
const parsedUrl = new URL(url);
|
|
@@ -6498,17 +6498,17 @@ const loadDefaultFavicon = async (event, url) => {
|
|
|
6498
6498
|
} catch {
|
|
6499
6499
|
return [];
|
|
6500
6500
|
}
|
|
6501
|
-
if (has(
|
|
6501
|
+
if (has(webContents, url)) {
|
|
6502
6502
|
return [];
|
|
6503
6503
|
}
|
|
6504
6504
|
const favicons = await resolveNetworkFavicon([faviconUrl]);
|
|
6505
|
-
if (favicons.length === 0 ||
|
|
6505
|
+
if (favicons.length === 0 || webContents.getURL() !== url) {
|
|
6506
6506
|
return [];
|
|
6507
6507
|
}
|
|
6508
6508
|
return favicons;
|
|
6509
6509
|
};
|
|
6510
|
-
const handler$4 = async (
|
|
6511
|
-
const favicons = await loadDefaultFavicon(
|
|
6510
|
+
const handler$4 = async (_event, url, _httpResponseCode, _httpStatusText, _webContentsId, webContents) => {
|
|
6511
|
+
const favicons = await loadDefaultFavicon(webContents, url);
|
|
6512
6512
|
const messages = favicons.length > 0 ? [['handleDidNavigate', url], ['handlePageFaviconUpdated', favicons]] : [['handleDidNavigate', url]];
|
|
6513
6513
|
return {
|
|
6514
6514
|
messages,
|
|
@@ -6913,7 +6913,7 @@ const attachEventListenersToWebContents = (webContentsId, webContents, browserWi
|
|
|
6913
6913
|
};
|
|
6914
6914
|
const wrappedListener = (...args) => {
|
|
6915
6915
|
// @ts-ignore
|
|
6916
|
-
const handlerResult = value.handler(...args, webContentsId);
|
|
6916
|
+
const handlerResult = value.handler(...args, webContentsId, webContents);
|
|
6917
6917
|
if (handlerResult instanceof Promise) {
|
|
6918
6918
|
return handleAsyncResult(handlerResult);
|
|
6919
6919
|
}
|