Sending message (postMessage) to a sandbox window

488 views
Skip to first unread message

Luigino De Togni

unread,
Oct 4, 2014, 6:13:21 AM10/4/14
to chromi...@chromium.org
Hi,
as described on official documentation
i'm trying to send a data (by postMessage web api) to a sandbox window, but without success.

Sandbox works perfectly, i added on manifest sandbox permissions but on sandbox js source i can't receive data

Here there are my manifest.json and code used to create new sandbox window to send it data

manifest.json
{
    ............................
    "sandbox": {
        "pages": [
            "test_message.html"
        ]
............
    .....................
}

main.js used to open new sandbox window
    chrome.app.window.create('test_message.html', {
            alwaysOnTop: true,
            resizable: false
            //state: "fullscreen"
        },
        function (win) {
            myWin = win;
            myWin.contentWindow.postMessage('Just wanted to say hey.', '*');
        }); 

sandbox.js module used to receive data 
var messageHandler = function (event) {
    console.log('Background script says hello.', event.data);
    // Send a reply
    event.source.postMessage({
        'reply': 'Sandbox received: ' + event.data
    }, event.origin);
};
window.addEventListener("message", messageHandler, false);

My os is OSX Mavericks 10.9.5 with Google Chrome v37


Thank you for any suggestions!

Lewix 

Luigino De Togni

unread,
Oct 6, 2014, 6:31:20 AM10/6/14
to chromi...@chromium.org
Hi,
anybody can help me please?

Vincent Scheib

unread,
Oct 6, 2014, 6:07:02 PM10/6/14
to Luigino De Togni, Chromium Apps
https://github.com/GoogleChrome/chrome-app-samples/tree/master/samples/sandbox works. I haven't taken time to recreate your sample, but please try working from the known working sample.

--
You received this message because you are subscribed to the Google Groups "Chromium Apps" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-app...@chromium.org.
To post to this group, send email to chromi...@chromium.org.
Visit this group at http://groups.google.com/a/chromium.org/group/chromium-apps/.
For more options, visit https://groups.google.com/a/chromium.org/d/optout.

Luigino De Togni

unread,
Oct 7, 2014, 3:33:12 AM10/7/14
to chromi...@chromium.org, lewi...@gmail.com
Hi,
yes i saw this github samples which include Sandobx tutorial.

At the end i did as this tutorial, using an iframe (it works).
It is strange because reading official documentation seems you can send postMessage without using iframe tag, mayb is it a bug?

Thank you anyway!

Lewix

Vincent Scheib

unread,
Oct 7, 2014, 11:56:11 AM10/7/14
to Luigino De Togni, Chromium Apps
Bugs exist. If you would, file the bug at crbug.com/new and include the sample app you have as simplified as possible, we'll triage it with other issues and address them in priority order.
Reply all
Reply to author
Forward
0 new messages