Hi Nigel,

This chromium-extensions list is a public one mostly used for announcements
and questions from external developers. Unfortunately, it's not the best
place to ask implementation questions. I can definitely sync with you
offline and share some additional contacts.

Is there a possibility of using the file:// scheme here? I'm not familiar
enough with ChromeOS and the filesystem:// scheme to know if that would
work, but that scheme is supported in `fetch` and what we would expect to
be used most often. For testing, note that you need to request the
`file://*` host permission and enable the "Allow access to file URLs"
toggle on the extension's details page.

Thanks,
Oliver Dunk | DevRel, Chrome Extensions |
https://developer.chrome.com/ | London,
GB


On Fri, Jul 5, 2024 at 3:04 PM Nigel Tao <nigel...@chromium.org> wrote:

> Sending again (this time hopefully to chromium-extensions@).
>
> On Fri, Jul 5, 2024 at 5:14 PM Nigel Tao <nigel...@chromium.org> wrote:
> >
> > Hi third_party/blink/renderer/core/fetch/OWNERS (nidhijaju, ricea),
> > CC'ing blink-dev and chromium-extensions. Feel free to CC other people
> > or lists if they're relevant.
> >
> > How hard is it to add filesystem: URL suport to the fetch API? I have
> > worked with chromium code for some years now, but haven't really
> > touched blink code generally (and fetch code specifically). For
> > example, fetch is "a blink thing" and I don't know how problematic
> > it'll be that Chromium's storage/browser/file_system code lives
> > outside of third_party/blink.
> >
> > If it's hard, are there any workarounds to get my XMLHttpRequest-using
> > extension on to Manifest v3? AFAICT this is a hard blocker for me to
> > get off Manifest v2.
> >
> > ---
> >
> > Background:
> >
> > I work on ChromiumOS' "file manager" app, which uses an "image_loader"
> > helper extension. This has been MV2 (Manifest v2) for some years now,
> > and works great.
> >
> https://source.chromium.org/chromium/chromium/src/+/main:ui/file_manager/image_loader/manifest.json;l=8;drc=c2aae80e18cbdadde0a3565fa8d5635f2ad378ae
> >
> > I'm trying to migrate it to MV3 (Manifest v3). This apprently requires
> > migrating from XHR (XMLHttpRequest) to fetch.
> >
> https://developer.chrome.com/docs/extensions/develop/migrate/to-service-workers#replace-xmlhttprequest
> >
> > https://crrev.com/c/5679823 attempts to do just that (assuming that
> > fetch should work with either MV2 or MV3). But it doesn't.
> >
> > ChromiumOS' file manager works with real (kernel-visible) files (e.g.
> > your local downloads) but also virtual files (e.g. cloud storage like
> > Google Drive or Microsoft OneDrive, or "connect your phone to your
> > Chromebook via USB cable and see your files over the MTP, uh,
> > protocol"). While "filesystem:etc" URLs might have been created 10+
> > years ago as a web-facing API, the storage::FileSystemURL class
> > currently powers the ChromiumOS file manager too.
> >
> https://source.chromium.org/chromium/chromium/src/+/main:storage/browser/file_system/file_system_url.h;l=83-84;drc=71bd8f1596b301a842247d3488f901d7ae3dfad2
> >
> > filesystem: URLs work with XHR. They do not work with fetch.
> >
> > When manually testing the https://crrev.com/c/5679823 change, I get an
> > error logged:
> >
> > "Fetch API cannot load filesystem:chrome-extension://etc/etc. URL
> > scheme "filesystem" is not supported."
> >
> > This comes from here:
> >
> https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/core/fetch/fetch_manager.cc;l=926-928;drc=6c848b551a600625f8b361d1eaad4f8e94d1e40a
> >
> > It's triggered by passing "RendererCorsIssueCode::kCorsDisabledScheme"
> > here (although I don't think CORS is actually involved; the error code
> > is a placeholder):
> >
> https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/core/fetch/fetch_manager.cc;l=907-910;drc=6c848b551a600625f8b361d1eaad4f8e94d1e40a
> >
> > In fact, right next to that trigger is "// FIXME: implement other
> > protocols". The FIXME dates from 2014:
> >
> https://codereview.chromium.org/399543002/diff/370001/Source/modules/serviceworkers/FetchManager.cpp
> >
> > I'm guessing that, if it hasn't been fixed in 10 years, it's probably
> > not going to get fixed.
> >
> > If it's not going to get fixed, is there a workaround?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Chromium Extensions" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to chromium-extensions+unsubscr...@chromium.org.
> To view this discussion on the web visit
> https://groups.google.com/a/chromium.org/d/msgid/chromium-extensions/CAEdON6YmUi4sSmNgdS1moO0yXMEb0sfO16Eukjtr3Jm5u0aD5w%40mail.gmail.com
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"blink-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to blink-dev+unsubscr...@chromium.org.
To view this discussion on the web visit 
https://groups.google.com/a/chromium.org/d/msgid/blink-dev/CAOsQqBmOtgY0v1edkVU-8eb_%3D0GS%2B-Mm5L%2Bvay_dgq1p20ZfgQ%40mail.gmail.com.

Reply via email to