mirror of
https://github.com/gorhill/uBlock.git
synced 2026-03-11 09:04:36 +00:00
Compare commits
5 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bbef7ec1cb | ||
|
|
484edb038a | ||
|
|
22e1f03c92 | ||
|
|
f0419a23c6 | ||
|
|
e8ab556411 |
11 changed files with 64 additions and 59 deletions
2
dist/version
vendored
2
dist/version
vendored
|
|
@ -1 +1 @@
|
||||||
1.57.0
|
1.57.2
|
||||||
|
|
|
||||||
|
|
@ -156,7 +156,7 @@
|
||||||
"description": "Label for a checkbox in the options page"
|
"description": "Label for a checkbox in the options page"
|
||||||
},
|
},
|
||||||
"showBlockedCountLabel": {
|
"showBlockedCountLabel": {
|
||||||
"message": "Show the number of blocked requests on the toolbar icon",
|
"message": "কতগুলো অনুরোধ ব্লক করা হয়েছে তা টুলবার আইকনে দেখাও",
|
||||||
"description": "Label for a checkbox in the options page"
|
"description": "Label for a checkbox in the options page"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -156,7 +156,7 @@
|
||||||
"description": "Label for a checkbox in the options page"
|
"description": "Label for a checkbox in the options page"
|
||||||
},
|
},
|
||||||
"showBlockedCountLabel": {
|
"showBlockedCountLabel": {
|
||||||
"message": "Show the number of blocked requests on the toolbar icon",
|
"message": "Ցուցադրել արգելափակված հայտերի քանակը գործիքների վահանակին",
|
||||||
"description": "Label for a checkbox in the options page"
|
"description": "Label for a checkbox in the options page"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -144,7 +144,7 @@
|
||||||
"description": "This describes the 'complete' filtering mode"
|
"description": "This describes the 'complete' filtering mode"
|
||||||
},
|
},
|
||||||
"noFilteringModeDescription": {
|
"noFilteringModeDescription": {
|
||||||
"message": "List of hostnames for which no filtering will take place.",
|
"message": "Daftar nama host yang tidak akan difilter.",
|
||||||
"description": "A short description for the editable field which lists trusted sites"
|
"description": "A short description for the editable field which lists trusted sites"
|
||||||
},
|
},
|
||||||
"behaviorSectionLabel": {
|
"behaviorSectionLabel": {
|
||||||
|
|
@ -156,7 +156,7 @@
|
||||||
"description": "Label for a checkbox in the options page"
|
"description": "Label for a checkbox in the options page"
|
||||||
},
|
},
|
||||||
"showBlockedCountLabel": {
|
"showBlockedCountLabel": {
|
||||||
"message": "Show the number of blocked requests on the toolbar icon",
|
"message": "Tampilkan jumlah permintaan yang diblokir pada ikon toolbar",
|
||||||
"description": "Label for a checkbox in the options page"
|
"description": "Label for a checkbox in the options page"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -484,7 +484,7 @@
|
||||||
"description": "Filter lists section name"
|
"description": "Filter lists section name"
|
||||||
},
|
},
|
||||||
"3pGroupSocial": {
|
"3pGroupSocial": {
|
||||||
"message": "Social widgets",
|
"message": "أدوات مواقع التواصل الاجتماعية",
|
||||||
"description": "Filter lists section name"
|
"description": "Filter lists section name"
|
||||||
},
|
},
|
||||||
"3pGroupCookies": {
|
"3pGroupCookies": {
|
||||||
|
|
@ -540,7 +540,7 @@
|
||||||
"description": "Warning against copy-pasting filters from random sources"
|
"description": "Warning against copy-pasting filters from random sources"
|
||||||
},
|
},
|
||||||
"1pEnableMyFiltersLabel": {
|
"1pEnableMyFiltersLabel": {
|
||||||
"message": "Enable my custom filters",
|
"message": "تفعيل تصفياتي المخصصة",
|
||||||
"description": "Label for the checkbox use to enable/disable 'My filters' list"
|
"description": "Label for the checkbox use to enable/disable 'My filters' list"
|
||||||
},
|
},
|
||||||
"1pTrustMyFiltersLabel": {
|
"1pTrustMyFiltersLabel": {
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
"description": "extension name."
|
"description": "extension name."
|
||||||
},
|
},
|
||||||
"extShortDesc": {
|
"extShortDesc": {
|
||||||
"message": "অবশেষে, একটি সাশ্রয়ী বিজ্ঞাপন রোধক। সিপিইউ এবং মেমরিতে নমনীয়।",
|
"message": "একটি শক্তিশালী বিজ্ঞাপন প্রতিরোধক, অবশেষে তৈরী হল। যা সিপিইউ এবং মেমরির জন্য সহনীয়।",
|
||||||
"description": "this will be in the Chrome web store: must be 132 characters or less"
|
"description": "this will be in the Chrome web store: must be 132 characters or less"
|
||||||
},
|
},
|
||||||
"dashboardName": {
|
"dashboardName": {
|
||||||
|
|
@ -20,7 +20,7 @@
|
||||||
"description": "Label for button to prevent navigating away from unsaved changes"
|
"description": "Label for button to prevent navigating away from unsaved changes"
|
||||||
},
|
},
|
||||||
"dashboardUnsavedWarningIgnore": {
|
"dashboardUnsavedWarningIgnore": {
|
||||||
"message": "অবজ্ঞা করুন",
|
"message": "বাদ দিন",
|
||||||
"description": "Label for button to ignore unsaved changes"
|
"description": "Label for button to ignore unsaved changes"
|
||||||
},
|
},
|
||||||
"settingsPageName": {
|
"settingsPageName": {
|
||||||
|
|
@ -136,19 +136,19 @@
|
||||||
"description": "Tooltip for the no-popups per-site switch"
|
"description": "Tooltip for the no-popups per-site switch"
|
||||||
},
|
},
|
||||||
"popupTipNoPopups1": {
|
"popupTipNoPopups1": {
|
||||||
"message": "এই সাইটে সব পপআপ অবরুদ্ধ করতে ক্লিক করুন",
|
"message": "এই সাইটে সকল পপআপ বন্ধ করতে ক্লিক করুন",
|
||||||
"description": "Tooltip for the no-popups per-site switch"
|
"description": "Tooltip for the no-popups per-site switch"
|
||||||
},
|
},
|
||||||
"popupTipNoPopups2": {
|
"popupTipNoPopups2": {
|
||||||
"message": "এই সাইটে সব পপআপ আর অবরুদ্ধ না করতে ক্লিক করুন",
|
"message": "এই সাইটে আর কোনো পপআপ ব্লক না করতে ক্লিক করুন",
|
||||||
"description": "Tooltip for the no-popups per-site switch"
|
"description": "Tooltip for the no-popups per-site switch"
|
||||||
},
|
},
|
||||||
"popupTipNoLargeMedia": {
|
"popupTipNoLargeMedia": {
|
||||||
"message": "এই সাইটের জন্য বড় মিডিয়া উপাদান অবরোধ চালু/বন্ধ করুন",
|
"message": "এই সাইটের বড় মিডিয়া উপাদানগুলো অবরোধ ব্লক করার জন্য অদলবদল করুন",
|
||||||
"description": "Tooltip for the no-large-media per-site switch"
|
"description": "Tooltip for the no-large-media per-site switch"
|
||||||
},
|
},
|
||||||
"popupTipNoLargeMedia1": {
|
"popupTipNoLargeMedia1": {
|
||||||
"message": "এই সাইটে বড় মিডিয়া উপাদান অবরুদ্ধ করতে ক্লিক করুন",
|
"message": "এই সাইটে বড় মিডিয়া এলিমেন্ট ব্লক করতে ক্লিক করুন",
|
||||||
"description": "Tooltip for the no-large-media per-site switch"
|
"description": "Tooltip for the no-large-media per-site switch"
|
||||||
},
|
},
|
||||||
"popupTipNoLargeMedia2": {
|
"popupTipNoLargeMedia2": {
|
||||||
|
|
@ -156,27 +156,27 @@
|
||||||
"description": "Tooltip for the no-large-media per-site switch"
|
"description": "Tooltip for the no-large-media per-site switch"
|
||||||
},
|
},
|
||||||
"popupTipNoCosmeticFiltering": {
|
"popupTipNoCosmeticFiltering": {
|
||||||
"message": "এই সাইটের জন্য কসমেটিক ছাঁকন চালু/বন্ধ করুন",
|
"message": "এই সাইটের জন্য সৌন্দর্যবর্ধক ছাঁকন চালু/বন্ধ করুন",
|
||||||
"description": "Tooltip for the no-cosmetic-filtering per-site switch"
|
"description": "Tooltip for the no-cosmetic-filtering per-site switch"
|
||||||
},
|
},
|
||||||
"popupTipNoCosmeticFiltering1": {
|
"popupTipNoCosmeticFiltering1": {
|
||||||
"message": "এই সাইটে কসমেটিক ফিল্টার নিষ্ক্রিয় করতে ক্লিক করুন",
|
"message": "এই সাইটে সৌন্দর্যবর্ধক ছাঁকন প্রক্রিয়া বন্ধ করতে ক্লিক করুন",
|
||||||
"description": "Tooltip for the no-cosmetic-filtering per-site switch"
|
"description": "Tooltip for the no-cosmetic-filtering per-site switch"
|
||||||
},
|
},
|
||||||
"popupTipNoCosmeticFiltering2": {
|
"popupTipNoCosmeticFiltering2": {
|
||||||
"message": "এই সাইটে কসমেটিক ফিল্টার সক্রিয় করতে ক্লিক করুন",
|
"message": "এই সাইটে সৌন্দর্যবর্ধক ছাঁকন প্রক্রিয়া চালু করতে ক্লিক করুন",
|
||||||
"description": "Tooltip for the no-cosmetic-filtering per-site switch"
|
"description": "Tooltip for the no-cosmetic-filtering per-site switch"
|
||||||
},
|
},
|
||||||
"popupTipNoRemoteFonts": {
|
"popupTipNoRemoteFonts": {
|
||||||
"message": "এই সাইটের রিমোট ফন্টের অবরোধ চালু/বন্ধ করুন",
|
"message": "এই সাইটের রিমোট ফন্ট বন্ধের প্রক্রিয়া অদলবদল করুন",
|
||||||
"description": "Tooltip for the no-remote-fonts per-site switch"
|
"description": "Tooltip for the no-remote-fonts per-site switch"
|
||||||
},
|
},
|
||||||
"popupTipNoRemoteFonts1": {
|
"popupTipNoRemoteFonts1": {
|
||||||
"message": "এই সাইটে রিমোট ফন্ট অবরুদ্ধ করতে ক্লিক করুন",
|
"message": "এই সাইটে রিমোট ফন্ট ব্লক করতে ক্লিক করুন",
|
||||||
"description": "Tooltip for the no-remote-fonts per-site switch"
|
"description": "Tooltip for the no-remote-fonts per-site switch"
|
||||||
},
|
},
|
||||||
"popupTipNoRemoteFonts2": {
|
"popupTipNoRemoteFonts2": {
|
||||||
"message": "এই সাইটে রিমোট ফন্ট আর অবরুদ্ধ না করতে ক্লিক করুন",
|
"message": "এই সাইটে রিমোট ফন্ট আর ব্লক না করতে ক্লিক করুন",
|
||||||
"description": "Tooltip for the no-remote-fonts per-site switch"
|
"description": "Tooltip for the no-remote-fonts per-site switch"
|
||||||
},
|
},
|
||||||
"popupTipNoScripting1": {
|
"popupTipNoScripting1": {
|
||||||
|
|
@ -184,7 +184,7 @@
|
||||||
"description": "Tooltip for the no-scripting per-site switch"
|
"description": "Tooltip for the no-scripting per-site switch"
|
||||||
},
|
},
|
||||||
"popupTipNoScripting2": {
|
"popupTipNoScripting2": {
|
||||||
"message": "এই সাইটের জাভাস্ক্রিপ্ট চালু করতে ক্লিক করুণ",
|
"message": "এই সাইটের জাভাস্ক্রিপ্ট চালু করতে ক্লিক করুন",
|
||||||
"description": "Tooltip for the no-scripting per-site switch"
|
"description": "Tooltip for the no-scripting per-site switch"
|
||||||
},
|
},
|
||||||
"popupNoPopups_v2": {
|
"popupNoPopups_v2": {
|
||||||
|
|
@ -192,11 +192,11 @@
|
||||||
"description": "Caption for the no-popups per-site switch"
|
"description": "Caption for the no-popups per-site switch"
|
||||||
},
|
},
|
||||||
"popupNoLargeMedia_v2": {
|
"popupNoLargeMedia_v2": {
|
||||||
"message": "বড় মিডিয়া এলিমেন্টগুলি",
|
"message": "বড় মিডিয়ার এলিমেন্টগুলো",
|
||||||
"description": "Caption for the no-large-media per-site switch"
|
"description": "Caption for the no-large-media per-site switch"
|
||||||
},
|
},
|
||||||
"popupNoCosmeticFiltering_v2": {
|
"popupNoCosmeticFiltering_v2": {
|
||||||
"message": "সৌন্দর্য্যবর্ধক ছাকন",
|
"message": "সৌন্দর্য্যবর্ধক ছাকন প্রক্রিয়া",
|
||||||
"description": "Caption for the no-cosmetic-filtering per-site switch"
|
"description": "Caption for the no-cosmetic-filtering per-site switch"
|
||||||
},
|
},
|
||||||
"popupNoRemoteFonts_v2": {
|
"popupNoRemoteFonts_v2": {
|
||||||
|
|
|
||||||
|
|
@ -484,11 +484,11 @@
|
||||||
"description": "Filter lists section name"
|
"description": "Filter lists section name"
|
||||||
},
|
},
|
||||||
"3pGroupSocial": {
|
"3pGroupSocial": {
|
||||||
"message": "Social widgets",
|
"message": "Սոցիալական վիդջեթներ",
|
||||||
"description": "Filter lists section name"
|
"description": "Filter lists section name"
|
||||||
},
|
},
|
||||||
"3pGroupCookies": {
|
"3pGroupCookies": {
|
||||||
"message": "Cookie notices",
|
"message": "Cookie ծանուցում",
|
||||||
"description": "Filter lists section name"
|
"description": "Filter lists section name"
|
||||||
},
|
},
|
||||||
"3pGroupAnnoyances": {
|
"3pGroupAnnoyances": {
|
||||||
|
|
@ -540,11 +540,11 @@
|
||||||
"description": "Warning against copy-pasting filters from random sources"
|
"description": "Warning against copy-pasting filters from random sources"
|
||||||
},
|
},
|
||||||
"1pEnableMyFiltersLabel": {
|
"1pEnableMyFiltersLabel": {
|
||||||
"message": "Enable my custom filters",
|
"message": "Թուլատրել իմ անհատական ֆիլտրերը",
|
||||||
"description": "Label for the checkbox use to enable/disable 'My filters' list"
|
"description": "Label for the checkbox use to enable/disable 'My filters' list"
|
||||||
},
|
},
|
||||||
"1pTrustMyFiltersLabel": {
|
"1pTrustMyFiltersLabel": {
|
||||||
"message": "Allow custom filters requiring trust",
|
"message": "Թույլատրել վստահություն պահանջող հատուկ զտիչները",
|
||||||
"description": "Label for the checkbox use to trust the content of 'My filters' list"
|
"description": "Label for the checkbox use to trust the content of 'My filters' list"
|
||||||
},
|
},
|
||||||
"1pImport": {
|
"1pImport": {
|
||||||
|
|
@ -1264,7 +1264,7 @@
|
||||||
"description": "Label for keyboard shortcut used to toggle cosmetic filtering"
|
"description": "Label for keyboard shortcut used to toggle cosmetic filtering"
|
||||||
},
|
},
|
||||||
"toggleJavascript": {
|
"toggleJavascript": {
|
||||||
"message": "Toggle JavaScript",
|
"message": "Անջատել JavaScript֊ը",
|
||||||
"description": "Label for keyboard shortcut used to toggle no-scripting switch"
|
"description": "Label for keyboard shortcut used to toggle no-scripting switch"
|
||||||
},
|
},
|
||||||
"relaxBlockingMode": {
|
"relaxBlockingMode": {
|
||||||
|
|
|
||||||
|
|
@ -484,11 +484,11 @@
|
||||||
"description": "Filter lists section name"
|
"description": "Filter lists section name"
|
||||||
},
|
},
|
||||||
"3pGroupSocial": {
|
"3pGroupSocial": {
|
||||||
"message": "Social widgets",
|
"message": "Widget sosial",
|
||||||
"description": "Filter lists section name"
|
"description": "Filter lists section name"
|
||||||
},
|
},
|
||||||
"3pGroupCookies": {
|
"3pGroupCookies": {
|
||||||
"message": "Cookie notices",
|
"message": "Pemberitahuan cookie",
|
||||||
"description": "Filter lists section name"
|
"description": "Filter lists section name"
|
||||||
},
|
},
|
||||||
"3pGroupAnnoyances": {
|
"3pGroupAnnoyances": {
|
||||||
|
|
@ -540,11 +540,11 @@
|
||||||
"description": "Warning against copy-pasting filters from random sources"
|
"description": "Warning against copy-pasting filters from random sources"
|
||||||
},
|
},
|
||||||
"1pEnableMyFiltersLabel": {
|
"1pEnableMyFiltersLabel": {
|
||||||
"message": "Enable my custom filters",
|
"message": "Aktifkan filter kustom saya",
|
||||||
"description": "Label for the checkbox use to enable/disable 'My filters' list"
|
"description": "Label for the checkbox use to enable/disable 'My filters' list"
|
||||||
},
|
},
|
||||||
"1pTrustMyFiltersLabel": {
|
"1pTrustMyFiltersLabel": {
|
||||||
"message": "Allow custom filters requiring trust",
|
"message": "Izinkan filter kustom yang memerlukan kepercayaan",
|
||||||
"description": "Label for the checkbox use to trust the content of 'My filters' list"
|
"description": "Label for the checkbox use to trust the content of 'My filters' list"
|
||||||
},
|
},
|
||||||
"1pImport": {
|
"1pImport": {
|
||||||
|
|
|
||||||
|
|
@ -100,11 +100,11 @@
|
||||||
"description": "English: or"
|
"description": "English: or"
|
||||||
},
|
},
|
||||||
"popupBlockedOnThisPage_v2": {
|
"popupBlockedOnThisPage_v2": {
|
||||||
"message": "Blocked on this page",
|
"message": "ಈ ಪುಟದಲ್ಲಿ ನಿರ್ಬಂಧಿಸಲಾಗಿದೆ",
|
||||||
"description": "For the new mobile-friendly popup design"
|
"description": "For the new mobile-friendly popup design"
|
||||||
},
|
},
|
||||||
"popupBlockedSinceInstall_v2": {
|
"popupBlockedSinceInstall_v2": {
|
||||||
"message": "Blocked since install",
|
"message": "ಸ್ಥಾಪಿಸಿದಾಗಿನಿಂದ ನಿರ್ಬಂಧಿಸಲಾಗಿದೆ",
|
||||||
"description": "For the new mobile-friendly popup design"
|
"description": "For the new mobile-friendly popup design"
|
||||||
},
|
},
|
||||||
"popupDomainsConnected_v2": {
|
"popupDomainsConnected_v2": {
|
||||||
|
|
|
||||||
|
|
@ -488,7 +488,7 @@
|
||||||
"description": "Filter lists section name"
|
"description": "Filter lists section name"
|
||||||
},
|
},
|
||||||
"3pGroupCookies": {
|
"3pGroupCookies": {
|
||||||
"message": "Avisos de cookie",
|
"message": "Avisos de cookies",
|
||||||
"description": "Filter lists section name"
|
"description": "Filter lists section name"
|
||||||
},
|
},
|
||||||
"3pGroupAnnoyances": {
|
"3pGroupAnnoyances": {
|
||||||
|
|
@ -544,7 +544,7 @@
|
||||||
"description": "Label for the checkbox use to enable/disable 'My filters' list"
|
"description": "Label for the checkbox use to enable/disable 'My filters' list"
|
||||||
},
|
},
|
||||||
"1pTrustMyFiltersLabel": {
|
"1pTrustMyFiltersLabel": {
|
||||||
"message": "Permitir filtros personalizados que exijam confiança",
|
"message": "Permitir filtros personalizados que requeiram confiança",
|
||||||
"description": "Label for the checkbox use to trust the content of 'My filters' list"
|
"description": "Label for the checkbox use to trust the content of 'My filters' list"
|
||||||
},
|
},
|
||||||
"1pImport": {
|
"1pImport": {
|
||||||
|
|
|
||||||
|
|
@ -19,17 +19,14 @@
|
||||||
Home: https://github.com/gorhill/uBlock
|
Home: https://github.com/gorhill/uBlock
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* global indexedDB */
|
|
||||||
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
||||||
|
import * as s14e from './s14e-serializer.js';
|
||||||
|
|
||||||
import lz4Codec from './lz4.js';
|
import lz4Codec from './lz4.js';
|
||||||
|
import { ubolog } from './console.js';
|
||||||
import webext from './webext.js';
|
import webext from './webext.js';
|
||||||
import µb from './background.js';
|
import µb from './background.js';
|
||||||
import { ubolog } from './console.js';
|
|
||||||
import * as s14e from './s14e-serializer.js';
|
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
||||||
|
|
@ -47,6 +44,10 @@ const keysFromGetArg = arg => {
|
||||||
|
|
||||||
let fastCache = 'indexedDB';
|
let fastCache = 'indexedDB';
|
||||||
|
|
||||||
|
// https://eslint.org/docs/latest/rules/no-prototype-builtins
|
||||||
|
const hasOwnProperty = (o, p) =>
|
||||||
|
Object.prototype.hasOwnProperty.call(o, p);
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* Extension storage
|
* Extension storage
|
||||||
|
|
@ -65,7 +66,7 @@ const cacheStorage = (( ) => {
|
||||||
if ( found.length === wanted.length ) { return; }
|
if ( found.length === wanted.length ) { return; }
|
||||||
const missing = [];
|
const missing = [];
|
||||||
for ( const key of wanted ) {
|
for ( const key of wanted ) {
|
||||||
if ( outbin.hasOwnProperty(key) ) { continue; }
|
if ( hasOwnProperty(outbin, key) ) { continue; }
|
||||||
missing.push(key);
|
missing.push(key);
|
||||||
}
|
}
|
||||||
return missing;
|
return missing;
|
||||||
|
|
@ -107,7 +108,7 @@ const cacheStorage = (( ) => {
|
||||||
if ( argbin instanceof Object === false ) { return; }
|
if ( argbin instanceof Object === false ) { return; }
|
||||||
if ( Array.isArray(argbin) ) { return; }
|
if ( Array.isArray(argbin) ) { return; }
|
||||||
for ( const key of wanted ) {
|
for ( const key of wanted ) {
|
||||||
if ( argbin.hasOwnProperty(key) === false ) { continue; }
|
if ( hasOwnProperty(argbin, key) === false ) { continue; }
|
||||||
outbin[key] = argbin[key];
|
outbin[key] = argbin[key];
|
||||||
}
|
}
|
||||||
}).then(( ) => {
|
}).then(( ) => {
|
||||||
|
|
@ -165,7 +166,7 @@ const cacheStorage = (( ) => {
|
||||||
},
|
},
|
||||||
|
|
||||||
select(api) {
|
select(api) {
|
||||||
if ( cacheAPIs.hasOwnProperty(api) === false ) { return fastCache; }
|
if ( hasOwnProperty(cacheAPIs, api) === false ) { return fastCache; }
|
||||||
fastCache = api;
|
fastCache = api;
|
||||||
for ( const k of Object.keys(cacheAPIs) ) {
|
for ( const k of Object.keys(cacheAPIs) ) {
|
||||||
if ( k === api ) { continue; }
|
if ( k === api ) { continue; }
|
||||||
|
|
@ -485,16 +486,9 @@ const idbStorage = (( ) => {
|
||||||
|
|
||||||
// Cache API is subject to quota so we will use it only for what is key
|
// Cache API is subject to quota so we will use it only for what is key
|
||||||
// performance-wise
|
// performance-wise
|
||||||
const shouldCache = bin => {
|
const shouldCache = key => {
|
||||||
const out = {};
|
if ( key.startsWith('cache/') === false ) { return true; }
|
||||||
for ( const key of Object.keys(bin) ) {
|
return /^cache\/(compiled|selfie)\//.test(key);
|
||||||
if ( key.startsWith('cache/' ) ) {
|
|
||||||
if ( /^cache\/(compiled|selfie)\//.test(key) === false ) { continue; }
|
|
||||||
}
|
|
||||||
out[key] = bin[key];
|
|
||||||
}
|
|
||||||
if ( Object.keys(out).length === 0 ) { return; }
|
|
||||||
return out;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const fromBlob = data => {
|
const fromBlob = data => {
|
||||||
|
|
@ -591,7 +585,7 @@ const idbStorage = (( ) => {
|
||||||
const transaction = db.transaction(STORAGE_NAME, 'readonly');
|
const transaction = db.transaction(STORAGE_NAME, 'readonly');
|
||||||
transaction.oncomplete =
|
transaction.oncomplete =
|
||||||
transaction.onerror =
|
transaction.onerror =
|
||||||
transaction.onabort = ( ) => {
|
transaction.onabort = ( ) => {
|
||||||
resolve(Promise.all(entries));
|
resolve(Promise.all(entries));
|
||||||
};
|
};
|
||||||
const table = transaction.objectStore(STORAGE_NAME);
|
const table = transaction.objectStore(STORAGE_NAME);
|
||||||
|
|
@ -668,21 +662,32 @@ const idbStorage = (( ) => {
|
||||||
if ( keys.length === 0 ) { return getAll(); }
|
if ( keys.length === 0 ) { return getAll(); }
|
||||||
const entries = await getEntries(keys);
|
const entries = await getEntries(keys);
|
||||||
const outbin = {};
|
const outbin = {};
|
||||||
|
const toRemove = [];
|
||||||
for ( const { key, value } of entries ) {
|
for ( const { key, value } of entries ) {
|
||||||
|
if ( shouldCache(key) === false ) {
|
||||||
|
toRemove.push(key);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
outbin[key] = value;
|
outbin[key] = value;
|
||||||
}
|
}
|
||||||
if ( argbin instanceof Object && Array.isArray(argbin) === false ) {
|
if ( argbin instanceof Object && Array.isArray(argbin) === false ) {
|
||||||
for ( const key of keys ) {
|
for ( const key of keys ) {
|
||||||
if ( outbin.hasOwnProperty(key) ) { continue; }
|
if ( hasOwnProperty(outbin, key) ) { continue; }
|
||||||
outbin[key] = argbin[key];
|
outbin[key] = argbin[key];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if ( toRemove.length !== 0 ) {
|
||||||
|
deleteEntries(toRemove);
|
||||||
|
}
|
||||||
return outbin;
|
return outbin;
|
||||||
},
|
},
|
||||||
|
|
||||||
async set(rawbin) {
|
async set(rawbin) {
|
||||||
const bin = shouldCache(rawbin);
|
const bin = {};
|
||||||
if ( bin === undefined ) { return; }
|
for ( const key of Object.keys(rawbin) ) {
|
||||||
|
if ( shouldCache(key) === false ) { continue; }
|
||||||
|
bin[key] = rawbin[key];
|
||||||
|
}
|
||||||
return setEntries(bin);
|
return setEntries(bin);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -695,7 +700,7 @@ const idbStorage = (( ) => {
|
||||||
},
|
},
|
||||||
|
|
||||||
clear() {
|
clear() {
|
||||||
return getDb().then(db => {
|
return getDb().then(db => {
|
||||||
if ( db === null ) { return; }
|
if ( db === null ) { return; }
|
||||||
db.close();
|
db.close();
|
||||||
indexedDB.deleteDatabase(STORAGE_NAME);
|
indexedDB.deleteDatabase(STORAGE_NAME);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue