single-file-core 1.5.65 → 1.5.67

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "single-file-core",
3
- "version": "1.5.65",
3
+ "version": "1.5.67",
4
4
  "description": "SingleFile Core",
5
5
  "author": "Gildas Lormeau",
6
6
  "license": "AGPL-3.0-or-later",
@@ -31,7 +31,8 @@ import {
31
31
  preProcessDoc,
32
32
  serialize,
33
33
  postProcessDoc,
34
- getShadowRoot
34
+ getShadowRoot,
35
+ initUserScriptHandler
35
36
  } from "./../../../core/helper.js";
36
37
 
37
38
  const helper = {
@@ -87,6 +88,7 @@ if (TOP_WINDOW) {
87
88
  }
88
89
  }
89
90
  init();
91
+ initUserScriptHandler();
90
92
  new MutationObserver(init).observe(document, { childList: true });
91
93
 
92
94
  export {
@@ -169,40 +171,26 @@ function getNewSessionId() {
169
171
 
170
172
  function initRequestSync(message) {
171
173
  const sessionId = message.sessionId;
172
- const waitForUserScript = globalThis[helper.WAIT_FOR_USERSCRIPT_PROPERTY_NAME];
173
174
  delete globalThis._singleFile_cleaningUp;
174
175
  if (!TOP_WINDOW) {
175
176
  windowId = globalThis.frameId = message.windowId;
176
177
  }
177
178
  processFrames(document, message.options, windowId, sessionId);
178
179
  if (!TOP_WINDOW) {
179
- if (message.options.userScriptEnabled && waitForUserScript) {
180
- waitForUserScript(helper.ON_BEFORE_CAPTURE_EVENT_NAME, message.options);
181
- }
182
180
  sendInitResponse({ frames: [getFrameData(document, globalThis, windowId, message.options, message.scrolling)], sessionId, requestedFrameId: document.documentElement.dataset.requestedFrameId && windowId });
183
- if (message.options.userScriptEnabled && waitForUserScript) {
184
- waitForUserScript(helper.ON_AFTER_CAPTURE_EVENT_NAME, message.options);
185
- }
186
181
  delete document.documentElement.dataset.requestedFrameId;
187
182
  }
188
183
  }
189
184
 
190
185
  async function initRequestAsync(message) {
191
186
  const sessionId = message.sessionId;
192
- const waitForUserScript = globalThis[helper.WAIT_FOR_USERSCRIPT_PROPERTY_NAME];
193
187
  delete globalThis._singleFile_cleaningUp;
194
188
  if (!TOP_WINDOW) {
195
189
  windowId = globalThis.frameId = message.windowId;
196
190
  }
197
191
  processFrames(document, message.options, windowId, sessionId);
198
192
  if (!TOP_WINDOW) {
199
- if (message.options.userScriptEnabled && waitForUserScript) {
200
- await waitForUserScript(helper.ON_BEFORE_CAPTURE_EVENT_NAME, message.options);
201
- }
202
193
  sendInitResponse({ frames: [getFrameData(document, globalThis, windowId, message.options, message.scrolling)], sessionId, requestedFrameId: document.documentElement.dataset.requestedFrameId && windowId });
203
- if (message.options.userScriptEnabled && waitForUserScript) {
204
- await waitForUserScript(helper.ON_AFTER_CAPTURE_EVENT_NAME, message.options);
205
- }
206
194
  delete document.documentElement.dataset.requestedFrameId;
207
195
  }
208
196
  }
@@ -348,7 +348,7 @@
348
348
  return origFontFace();
349
349
  }
350
350
  getDetailObject(family, source, ...args).then(detail => document.dispatchEvent(new CustomEvent(NEW_FONT_FACE_EVENT, { detail })));
351
- return new FontFace(family, source, ...args);
351
+ return new origFontFace(family, source, ...args);
352
352
  } catch (error) {
353
353
  error.stack = error.message + "\n" + " \n" + error.stack.trim().split("\n").slice(-1).join("\n");
354
354
  throw error;
@@ -29,7 +29,6 @@ import {
29
29
  ON_BEFORE_CAPTURE_EVENT_NAME,
30
30
  ON_AFTER_CAPTURE_EVENT_NAME,
31
31
  WAIT_FOR_USERSCRIPT_PROPERTY_NAME,
32
- initUserScriptHandler,
33
32
  preProcessDoc,
34
33
  postProcessDoc,
35
34
  getShadowRoot
@@ -50,8 +49,6 @@ const helper = {
50
49
  getShadowRoot
51
50
  };
52
51
 
53
- initUserScriptHandler();
54
-
55
52
  export {
56
53
  helper,
57
54
  processors