dsh-unlag 1.9.39 → 1.9.41
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/client.js +6 -1
- package/index.js +18 -14
- package/package.json +1 -1
package/client.js
CHANGED
|
@@ -559,7 +559,12 @@ window.__ModuleLoader__.load({
|
|
|
559
559
|
function stillHeldBack() {
|
|
560
560
|
const probe = new Event('beforeunload', { cancelable: true }); // ui-copy-ignore
|
|
561
561
|
window.dispatchEvent(probe);
|
|
562
|
-
|
|
562
|
+
// A handler says no in three ways: cancelling the event, setting `returnValue` to false, or
|
|
563
|
+
// returning a message through `window.onbeforeunload` (the browser copies that message into
|
|
564
|
+
// `returnValue`). Missing the last one let a press start a navigation the page would then
|
|
565
|
+
// ask about over the page's own head.
|
|
566
|
+
const message = probe.returnValue;
|
|
567
|
+
return probe.defaultPrevented === true || message === false || (typeof message === 'string' && message !== '');
|
|
563
568
|
}
|
|
564
569
|
|
|
565
570
|
/**
|
package/index.js
CHANGED
|
@@ -92,13 +92,18 @@ const MAX_DEFERRALS = 40
|
|
|
92
92
|
const MAX_STARTUP_ROWS = 64
|
|
93
93
|
const MAX_STARTUP_ROW_CHARS = 4096
|
|
94
94
|
/**
|
|
95
|
-
* The largest one startup script may be before a check refuses it.
|
|
96
|
-
*
|
|
97
|
-
*
|
|
95
|
+
* The largest one startup script may be before a check refuses it. The app serves a whole profile as
|
|
96
|
+
* a few bundles, and those grow with every installed plugin: one profile's largest bundle measured
|
|
97
|
+
* 8.7 MB, which a smaller bound refused as if it were an attack and left the page unrebuildable.
|
|
98
|
+
* A body past this bound is a mistake or an attempt to make a check read (and compile) an unbounded
|
|
99
|
+
* amount of text inside the process that owns every running turn.
|
|
98
100
|
*/
|
|
99
|
-
const MAX_SCRIPT_BYTES =
|
|
100
|
-
/**
|
|
101
|
-
|
|
101
|
+
const MAX_SCRIPT_BYTES = 64 * 1024 * 1024
|
|
102
|
+
/**
|
|
103
|
+
* The same bound for one whole startup list, so a list of large bodies cannot add up either. Only
|
|
104
|
+
* the compile happens under it: what a check keeps per body is the ids it names, never its text.
|
|
105
|
+
*/
|
|
106
|
+
const MAX_TOTAL_SCRIPT_BYTES = 128 * 1024 * 1024
|
|
102
107
|
|
|
103
108
|
/**
|
|
104
109
|
* The most plugin ids one bundle address may name. A real startup list is far below this; a made-up
|
|
@@ -1534,12 +1539,11 @@ export async function verifyStartupRows(graph, fetchBody, rows, budgetMs = MAX_V
|
|
|
1534
1539
|
if (required.length > 0 && missing.length > 0) {
|
|
1535
1540
|
return { status: 'blocked', reason: 'register', detail: `${item.url} does not register ${missing.join(', ')}` }
|
|
1536
1541
|
}
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
})
|
|
1542
|
+
// Only what the cross-checks below need from this body is kept; the text itself is let go here,
|
|
1543
|
+
// so a list of large scripts costs one script of memory rather than the whole list.
|
|
1544
|
+
const record = { url: item.url, ids: item.ids, registered, required: requiredIds(text) }
|
|
1545
|
+
record.digest = createHash('sha256').update(bytes).digest('hex').slice(0, 16)
|
|
1546
|
+
bodies.push(record)
|
|
1543
1547
|
}
|
|
1544
1548
|
/**
|
|
1545
1549
|
* A body can read a plugin its own document does not list: the set changed after that document was
|
|
@@ -1548,10 +1552,10 @@ export async function verifyStartupRows(graph, fetchBody, rows, budgetMs = MAX_V
|
|
|
1548
1552
|
* itself is that case, so the press is held rather than booting a page that dies half way.
|
|
1549
1553
|
*/
|
|
1550
1554
|
const available = new Set(listed)
|
|
1551
|
-
for (const body of bodies) for (const id of
|
|
1555
|
+
for (const body of bodies) for (const id of body.registered) available.add(id)
|
|
1552
1556
|
const absent = new Set()
|
|
1553
1557
|
for (const body of bodies) {
|
|
1554
|
-
for (const id of
|
|
1558
|
+
for (const id of body.required) {
|
|
1555
1559
|
if (available.has(id) || !entries.has(id)) continue
|
|
1556
1560
|
absent.add(id)
|
|
1557
1561
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-unlag",
|
|
3
|
-
"version": "1.9.
|
|
3
|
+
"version": "1.9.41",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A press applies plugin edits right away and brings a laggy interface back; automatic reloading stays off unless you turn it on, so the press is the only trigger, and nothing restarts.",
|
|
6
6
|
"license": "MIT",
|