Open Bug 1523174 Opened 6 years ago Updated 3 years ago

storage.managed.get with non-existing manifest behaves differently on debug build

Categories

(WebExtensions :: Storage, enhancement, P3)

enhancement

Tracking

(Not tracked)

People

(Reporter: JanH, Assigned: zombie)

References

Details

Starting from v1.18.0, uBlock Origin started using a persistent startup listener for webrequests.

On a normal release build, this doesn't cause any problems, however when using a debug build (either downloaded directly from Taskcluster, or else a local build built with ac_add_options --enable-debug), this causes all page loads [1] to hang indefinitely.

This is happening, with a fresh profile, both on Android and on desktop (Windows). As well as my local Android build, I've used debug builds from this revision.

[1] Except for those few privileged pages on which webextensions don't run by default.

I am seeing these errors in the console, which do not show up in the non-debug version of Nightly:

Type error for items value (Expected object instead of undefined) for storage.StorageArea.get.
    makeError resource://gre/modules/Schemas.jsm:459
    throwError resource://gre/modules/Schemas.jsm:2190
    checkValue resource://gre/modules/Schemas.jsm:2316
    checkCallback resource://gre/modules/Schemas.jsm:2323
    callback resource://gre/modules/Schemas.jsm:2348
    apply self-hosted:4634
    applySafeWithoutClone resource://gre/modules/ExtensionCommon.jsm:539
    wrapPromise resource://gre/modules/ExtensionCommon.jsm:752
    withLastError resource://gre/modules/ExtensionCommon.jsm:676
    wrapPromise resource://gre/modules/ExtensionCommon.jsm:744
Unchecked lastError value: Error: Managed storage manifest not found vapi-background.js:1208
    getItem moz-extension://ed14e468-76e4-4f87-a0f4-55a93116a14b/js/vapi-background.js:1208

If I short-circuit the call to browser.storage.managed.get in uBO[1], this seems to fix the issue on my side.

P.S.: Sorry, I didn't know I was responding to a Firefox dev. It makes a difference on whether I take on an issue or not. If an issue comes from the public I feel like it's more about a support issue (so many ways people can have configured their environment), otherwise if it's from a browser dev I feel like I am contributing a bit to the browser development, something I am happy to do.


[1] https://github.com/gorhill/uBlock/blob/d7c169c587a9a5c501531c684f486609600d29a5/platform/chromium/vapi-background.js#L1208

No offence taken, and thanks for taking a closer look.

Component: Request Handling → Storage
Summary: uBlock Origin using a persistent startup listener causes all page loads to hand on a debug build → storage.managed.get with non-existing manifest behaves differently on debug build

This looks like a callback schema validation error, we only check those in debug builds.

Assignee: nobody → tomica
Priority: -- → P2

When an extension api throws an exception but the extension is using callbacks instead of promises, the callback is always called with no arguments:
https://searchfox.org/mozilla-central/rev/5c8ea961d04767db723a0a15e3a8f7fbca154129/toolkit/components/extensions/ExtensionCommon.jsm#752

I haven't looked closely at how callback validation is implemented but seems like we "just" need to avoid trying to validate in that case.

Priority: P2 → P3
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.