[crx] unable to access getBackgroundPage within chrome.devtools.panel API ?

187 views
Skip to first unread message

Laurent Perez

unread,
Jun 7, 2012, 11:45:03 AM6/7/12
to Chromium-extensions
Hi

I'm writing a devtools extension ;
http://code.google.com/chrome/extensions/dev/devtools.panels.html
states that an extension panel has access to chrome.extension API.
I have a panel.js file , which is loaded from panel.html, panel.html
being loaded from chrome.devtools.panels.create("Font Picker",
"icon.png",
"panel.html"
);

However, when I do the following in panel.js : var BG =
chrome.extension.getBackgroundPage();, the extension simply does hang,
no error is shown in the console, even following alert() statements
are not shown. It seams the simple fact of trying to access
chrome.extension.getBackgroundPage(); hangs the extension.

Are we supposed to be able to access
chrome.extension.getBackgroundPage(); within a js loaded from a
devtools extension panel ? What is the preferred way for a devtools
extension to access the background page ?

Thanks
laurent


--
http://laurentperez.fr
J2EE tips and best practices

Aaron Boodman

unread,
Jun 9, 2012, 10:55:33 PM6/9/12
to Laurent Perez, Chromium-extensions
You cannot access the background page from the devtools panels. Sorry
that the error handling works poorly.

You should use extension messaging to communicate between devTools
panels and the background page:

http://code.google.com/chrome/extensions/messaging.html

- a
> --
> You received this message because you are subscribed to the Google Groups "Chromium-extensions" group.
> To post to this group, send email to chromium-...@chromium.org.
> To unsubscribe from this group, send email to chromium-extens...@chromium.org.
> For more options, visit this group at http://groups.google.com/a/chromium.org/group/chromium-extensions/?hl=en.
>
Reply all
Reply to author
Forward
0 new messages