Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

onnxruntime-web dependency on document breaks chrome serviceworker #23214

Open
abbasvalliani opened this issue Dec 27, 2024 · 1 comment
Open
Labels
platform:web issues related to ONNX Runtime web; typically submitted using template stale issues that have not been addressed in a while; categorized by a bot

Comments

@abbasvalliani
Copy link

Describe the issue

I am migrating from onnxruntime-web from 1.18 to 1.20 and the code breaks since onnxruntime-web specifically includes the document object which is not available in the serviceworker in a chrome extension. This is the snippet that gets compiled:

Version 1.20.1:

background.iife.js:

br = (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === "SCRIPT" && _documentCurrentScript.src || new URL("background.iife.js", document.baseURI).href) ?? (typeof document < "u" ? (_a = document.currentScript) == null ? void 0 : _a.src : typeof self < "u" ? (_b2 = self.location) == null ? void 0 : _b2.href : void 0), Sg = typeof location > "u" ? void 0 : location.origin, Ag = (i, e) => {

Version 1.18

background.iife.js:
/*!

  • ONNX Runtime Web v1.18.0
  • Copyright (c) Microsoft Corporation. All rights reserved.
  • Licensed under the MIT License.
    */
    var vd = Object.create;
    var Pn = Object.defineProperty;
    var _d = Object.getOwnPropertyDescriptor;
    var Od = Object.getOwnPropertyNames;
    var Id = Object.getPrototypeOf, Sd = Object.prototype.hasOwnProperty;
    var L = (a, t) => () => (a && (t = a(a = 0)), t);
    var me = (a, t) => () => (t || a((t = { exports: {} }).exports, t), t.exports), Sr = (a, t) => {
    for (var o in t) Pn(a, o, { get: t[o], enumerable: true });

.... no dependency on document on load.

Any thoughts would be much appreciated. I cannot run onnxruntime-web in a content script due to performance constraints and responsiveness.

To reproduce

N/A since the description is relatively self-explanatory. If needed, I am happy to make a simple chrome extension.

Urgency

This is critical. I cannot upgrade any extension to the most recent codebase.

ONNX Runtime Installation

Built from Source

ONNX Runtime Version or Commit ID

1.20.1

Execution Provider

'wasm'/'cpu' (WebAssembly CPU)

@abbasvalliani abbasvalliani added the platform:web issues related to ONNX Runtime web; typically submitted using template label Dec 27, 2024
Copy link
Contributor

This issue has been automatically marked as stale due to inactivity and will be closed in 30 days if no further activity occurs. If further support is needed, please provide an update and/or more details.

@github-actions github-actions bot added the stale issues that have not been addressed in a while; categorized by a bot label Jan 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
platform:web issues related to ONNX Runtime web; typically submitted using template stale issues that have not been addressed in a while; categorized by a bot
Projects
None yet
Development

No branches or pull requests

1 participant