webNavigation is uninitialized

547 views
Skip to first unread message

Joe Medley

unread,
Mar 20, 2023, 2:13:44 PM3/20/23
to Chromium Extensions
Hi,

So I have this in my service worker:

chrome.webNavgation.onCompleted.addListener((e) => {
  console.log(`webNavigation.onCompleted called with ${e}`);
});

It's throwing this error:

Uncaught TypeError: Cannot read properties of undefined (reading 'onCompleted')

When I print the chrome object to the console I see that webNavigation isn't initialized. (See the image below) I can initialize it from the console, then Chrome lets me add event handlers, but it's still not called. I've added the "webNavigation" permission to the sw. Is there something else I'm supposed to do or is this a bug?

Thanks.

Screenshot 2023-03-20 at 11.07.54 AM.png
 

Patrick Kettner

unread,
Mar 20, 2023, 2:28:27 PM3/20/23
to Joe Medley, Chromium Extensions
Is the code copy and pasted? If so, you have webNavgation, rather than webNavigation (note the missing i). If the typo isn't related, can you share your manifest?

--
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/a5950afe-3d15-4c4e-8d7b-149bc35f6eccn%40chromium.org.

Joe Medley

unread,
Mar 20, 2023, 3:42:59 PM3/20/23
to Chromium Extensions, Patrick Kettner, Chromium Extensions, Joe Medley
It works. I thought I had checked that. Thanks for your help.
Reply all
Reply to author
Forward
0 new messages