NaCl module crashed - detect it Javascript?

539 views
Skip to first unread message

alex sandor

unread,
Dec 9, 2012, 7:25:13 PM12/9/12
to native-cli...@googlegroups.com
Hello,

Of course I know that a NaCl module should not crash at all, but sometimes there is no way around ;)
So what i need is first to detect the crash in my background page in order to display it to the user and after that i need to restart the NaCl module. 
Is that somehow possible?

Thanks for your help!

The Floating Brain

unread,
Dec 9, 2012, 7:33:31 PM12/9/12
to native-cli...@googlegroups.com
Just a quick guess (I am new to NaCl): 
//Pseudo code: //

//C++: //
struct Crash
{
    bool close;
    Crash( bool set = false )
    {
        close = false;
        if( set == true )
            close = true;
    }
    ~Crash() { 
        if( close == false )
        postMessage( "The module crashed!" );
    }
};

int main()
{
    Crash c;
    DoSomething();
    c.close = true;
    return 0;
}


//JS: //

function handleMessage( msg ) {
    alert( msg.toString() );

Andrey Khalyavin

unread,
Dec 10, 2012, 5:56:31 AM12/10/12
to native-cli...@googlegroups.com
Currently no messages or events are sent on NaCl crash. So it can only be done by polling exitStatus property of NaCl module.

Andrey Khalyavin

Colt McAnlis

unread,
Dec 10, 2012, 10:11:27 AM12/10/12
to native-cli...@googlegroups.com
Hi Alex, 

Check out the "Debugging" example in the latest SDK; It should guide you through various techniques that can be used to detect and respond to a crash.

~Main

Mark Seaborn

unread,
Dec 10, 2012, 11:44:51 AM12/10/12
to native-cli...@googlegroups.com
On 10 December 2012 02:56, Andrey Khalyavin <haly...@google.com> wrote:
Currently no messages or events are sent on NaCl crash. So it can only be done by polling exitStatus property of NaCl module.

That's not true.  You can use element.addEventListener('crash', callback) to register a handler that will be called when the NaCl process crashes.

For an example, see the test code here: http://src.chromium.org/viewvc/chrome/trunk/src/ppapi/native_client/tests/breakpad_crash_test/untrusted_crash.html?revision=153028&view=markup

Mark

Reply all
Reply to author
Forward
0 new messages