1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-09-03 01:29:39 +02:00

Fix quirks re. diff-updater

This commit is contained in:
Raymond Hill 2023-11-13 09:42:31 -05:00
parent 1f88359964
commit 7b2149e595
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2
3 changed files with 7 additions and 6 deletions

View File

@ -16,7 +16,7 @@
"description": "A warning in the dashboard when navigating away from unsaved changes" "description": "A warning in the dashboard when navigating away from unsaved changes"
}, },
"dashboardUnsavedWarningStay": { "dashboardUnsavedWarningStay": {
"message": "Stay", "message": "Stay here",
"description": "Label for button to prevent navigating away from unsaved changes" "description": "Label for button to prevent navigating away from unsaved changes"
}, },
"dashboardUnsavedWarningIgnore": { "dashboardUnsavedWarningIgnore": {
@ -164,7 +164,7 @@
"description": "Tooltip for the no-cosmetic-filtering per-site switch" "description": "Tooltip for the no-cosmetic-filtering per-site switch"
}, },
"popupTipNoCosmeticFiltering2": { "popupTipNoCosmeticFiltering2": {
"message": "Click to enable cosmetic filtering on this site", "message": "Click to longer disable cosmetic filtering on this site",
"description": "Tooltip for the no-cosmetic-filtering per-site switch" "description": "Tooltip for the no-cosmetic-filtering per-site switch"
}, },
"popupTipNoRemoteFonts": { "popupTipNoRemoteFonts": {

View File

@ -1203,6 +1203,7 @@ const getAssetDiffDetails = assetKey => {
} }
out.diffExpires = getUpdateAfterTime(assetKey, true); out.diffExpires = getUpdateAfterTime(assetKey, true);
out.lastModified = cacheEntry.lastModified; out.lastModified = cacheEntry.lastModified;
out.writeTime = cacheEntry.writeTime;
const assetEntry = assetSourceRegistry[assetKey]; const assetEntry = assetSourceRegistry[assetKey];
if ( assetEntry === undefined ) { return; } if ( assetEntry === undefined ) { return; }
if ( Array.isArray(assetEntry.cdnURLs) === false ) { return; } if ( Array.isArray(assetEntry.cdnURLs) === false ) { return; }
@ -1300,9 +1301,7 @@ async function diffUpdater() {
} else if ( data.status === 'nopatch-yet' || data.status === 'nodiff' ) { } else if ( data.status === 'nopatch-yet' || data.status === 'nodiff' ) {
ubolog(`Diff updater: skip update of ${data.name} using ${data.patchPath}\n\treason: ${data.status}`); ubolog(`Diff updater: skip update of ${data.name} using ${data.patchPath}\n\treason: ${data.status}`);
const assetKey = assetKeyFromDiffName(data.name); const assetKey = assetKeyFromDiffName(data.name);
assetCacheSetDetails(assetKey, { assetCacheSetDetails(assetKey, { writeTime: data.writeTime });
writeTime: data.lastModified || 0
});
vAPI.messaging.broadcast({ vAPI.messaging.broadcast({
what: 'assetUpdated', what: 'assetUpdated',
key: assetKey, key: assetKey,

View File

@ -117,7 +117,9 @@ function applyPatch(text, diff) {
let iAdjust = 0; let iAdjust = 0;
let iDiff = 0, nDiff = diffLines.length; let iDiff = 0, nDiff = diffLines.length;
while ( iDiff < nDiff ) { while ( iDiff < nDiff ) {
const diffParsed = /^([ad])(\d+) (\d+)$/.exec(diffLines[iDiff++]); const diffLine = diffLines[iDiff++];
if ( diffLine === '' ) { break; }
const diffParsed = /^([ad])(\d+) (\d+)$/.exec(diffLine);
if ( diffParsed === null ) { return; } if ( diffParsed === null ) { return; }
const op = diffParsed[1]; const op = diffParsed[1];
const iOp = parseInt(diffParsed[2], 10); const iOp = parseInt(diffParsed[2], 10);