Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MessageManager messages in HTML panel #12

Open
cadorn opened this issue Oct 8, 2016 · 1 comment
Open

MessageManager messages in HTML panel #12

cadorn opened this issue Oct 8, 2016 · 1 comment

Comments

@cadorn
Copy link
Member

cadorn commented Oct 8, 2016

I am using https://github.com/firebug/devtools-extension-examples/tree/master/MessageManager

I am trying to get messages from chrome scope in scripts loaded into the myPanel.html page.

So I am receiving messages in the frame-script.js but how do I now pass these onto the HTML page?

Using following in frame-script.js and myPanel.html respectively does not work:

content.postMessage(data, "*");
window.addEventListener("message", messageListener, false);

Do I need to send messages by using a DOM element as a proxy?

@janodvarko
Copy link
Member

I don't see any reason why postMessage/addEventListener combo should not work and the example should definitely be fixed.

Also, I have been using DOM events for communication between the frame script and the window scope in some of the DevTools extensions.

See e.g. here:
https://github.com/firebug/pixel-perfect/blob/8106cbfecb9a9a59544fa172f6d12cb9c924109c/data/popup-frame-script.js#L36

So, you might use it as a workaround till it's clear why the Message manager doesn't work (I recall I had some issues and it might be that the event listener is appended too late/soon or something like that).

Honza

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants