Manifest v3: XMLHttpRequest API is not working

213 views
Skip to first unread message

KARISHMA SINGH

unread,
Jan 22, 2020, 12:48:46 AM1/22/20
to Chromium Extensions
XMLHttpRequest API is not working while using service worker in manifest v3. And it's working without manifest v3 in canary channel.

Kent Brewster

unread,
Jan 23, 2020, 12:01:17 PM1/23/20
to KARISHMA SINGH, Chromium Extensions
Pretty sure XHMLHttpRequest requires a DOM; you will want to look into the fetch API.

--Kent

> On Jan 21, 2020, at 9:48 PM, KARISHMA SINGH <kari...@aravalli.co.in> wrote:
>
> XMLHttpRequest API is not working while using service worker in manifest v3. And it's working without manifest v3 in canary channel.
>
> --
> 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-extens...@chromium.org.
> To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/chromium-extensions/6002f932-6e88-4011-aacb-6e384a59360a%40chromium.org.

Simeon Vincent

unread,
Jan 23, 2020, 12:17:51 PM1/23/20
to Kent Brewster, KARISHMA SINGH, Chromium Extensions
KARISHMA, for clarity, are you saying that XMLHttpRequset works in MV2 service workers in Canary? If so, that would be quite surprising as service workers do not have access to XMLHttpRequest by design. I believe the core problem with this API is that XMLHttpRequest can be synchronous and service workers are designed to be completely asynchronous. 

Simeon - @dotproto
Extensions Developer Advocate


Message has been deleted

KARISHMA SINGH

unread,
Mar 16, 2020, 6:58:53 AM3/16/20
to Chromium Extensions, ke...@pinterest.com, kari...@aravalli.co.in
I have directly tried on Developer Tool. there it worked.

Kent Brewster

unread,
Mar 16, 2020, 11:49:07 AM3/16/20
to KARISHMA SINGH, Chromium Extensions
Sorry, not enough detail here for a good answer. If you tried the developer tool when inspecting a running background page (v2 extension) XMLHTTPRequest might work, since you have a DOM there.

--Kent

Simeon Vincent

unread,
Mar 18, 2020, 12:35:23 AM3/18/20
to KARISHMA SINGH, Chromium Extensions, Kent Brewster
KARISHMA,

Looking back I think my previous answer was a bit misguided. Karshma, if you want to make request network resources in a service worker you will have to move from the XMLHttpRequest API to the Fetch API.

Cheers,

Simeon - @dotproto
Extensions Developer Advocate

On Tue, Mar 17, 2020 at 3:15 PM KARISHMA SINGH <kari...@aravalli.co.in> wrote:
I have directly tried on Developer Tool. there it worked.

Reply all
Reply to author
Forward
0 new messages