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

Opening DevTools causes Crash when DevTools are open already #6766

Closed
HappyStriker opened this issue Aug 14, 2018 · 1 comment
Closed

Opening DevTools causes Crash when DevTools are open already #6766

HappyStriker opened this issue Aug 14, 2018 · 1 comment

Comments

@HappyStriker
Copy link

NWJS Version : 0.32.1
Operating System : macOS High Sierra 10.13.6

Expected behaviour

When the DevTools have been opened and shall be opened again via win.openDevTools() then the already opened DevTools window should be focused.

Actual behaviour

The application crashes, similar to the description of issue #6687
There is also another issue, but it does not get triggered by the reproduction method below. When I use a huge application of mine and the app crashes due to the DevTool related issue, then sometimes the helper app does not get killed and uses a very high amount of cpu, similar to issue #6662

Additionally: The issue can not be prevented trough the usage of win.isDevToolsOpen(), because that method does not seem to exist.

How to reproduce

<!DOCTYPE html>
<html>
  <head>
    <script>
      // get the current window
      const win = nw.Window.get();

      // automatically open the dev tools when an error occurs
      win.window.process.on("uncaughtException", (e) => {
        win.showDevTools();
      });

      // open the dev tools
      win.showDevTools();


      // this will trigger the uncaught exception whichs triggers the dev tools
      // to be opened (which will crash the application if the dev tools have
      // already been opened)
      function crashMe() {
        const hallo = 3;
        hallo = 4;
      }

      // this will crash as well, because reopening the already opened dev tools
      // crashs the application
      function crashMe2() {
        win.showDevTools();
      }

      // preventing the issue trough detecting if the dev tools are already
      // opened is also not possible, because the method isDevToolsOpen() does
      // not exist
      function notWorkingInfo() {
        console.log(win.isDevToolsOpen());
      }


      console.log(win);
      // outputs the following, not including the method isDevToolsOpen():
      /*
        NWWindow
          frameId: (...)
          height: (...)
          isAlwaysOnTop: (...)
          isFullscreen: (...)
          isKioskMode: (...)
          isTransparent: (...)
          menu: (...)
          title: (...)
          width: (...)
          window: (...)
          x: (...)
          y: (...)
          zoomLevel: (...)
          __proto__: NWWindow
      */
    </script>
  </head>
  <body>
    <input type="button" onclick="crashMe();" value="crash me">
    <input type="button" onclick="crashMe2();" value="crash me 2">
    <input type="button" onclick="notWorkingInfo();" value="not working is-dev-tools-open">
  </body>
</html>

Error code through running nwjs from the Terminal:

./nwjs
Received signal 11 < unknown > 000000000000
[0x00010e0a38fc]
[0x00010e0a37e1]
[0x7fff5854ff5a]
[0x0001079fc200]
[0x00010f83eca5]
[0x00010f86156f]
[0x00010f8616a9]
[0x00010cfb496f]
[0x00010cf6cf1c]
[0x00010cf6d41a]
[0x00010cf8e239]
[0x00010cf8e154]
[0x00010ff12869]
[0x00010cd0244d]
[0x00010ca41b8e]
[0x00010e5a7fab]
[0x00010dfff337]
[0x00010e020914]
[0x00010e020de8]
[0x00010e022aaa]
[0x00010e01329a]
[0x00010e0223cf]
[0x7fff3041ea11]
[0x7fff304d842c]
[0x7fff30401470]
[0x7fff304008ed]
[0x7fff30400153]
[0x7fff2f6ead96]
[0x7fff2f6eab06]
[0x7fff2f6ea884]
[0x7fff2d99ba73]
[0x7fff2e131e34]
[0x00010dc7e3f0]
[0x00010e01329a]
[0x00010dc7e324]
[0x7fff2d990885]
[0x00010e02331c]
[0x00010e021eee]
[0x00010e045e15]
[0x00010dc84cc9]
[0x00010c8f67e4]
[0x00010c8f8e42]
[0x00010c8f32fb]
[0x00010dc41b74]
[0x00010f263cc0]
[0x00010dc40a04]
[0x00010beaba73]
[0x0001079f1de5]
[0x7fff58241015]
[end of stack trace]
Segmentation fault: 11
MacBook - Pro: MacOS Username$[11909: 15619: 0814 / 145047.465259: ERROR: command_buffer_proxy_impl.cc(113)]ContextResult:: kFatalFailure: Shared memory handle is not valid
[11907: 16643: 0814 / 145047.469102: ERROR: command_buffer_proxy_impl.cc(113)]ContextResult:: kFatalFailure: Shared memory handle is not valid

Last words

Thank you for looking into these issues and also for developing nwjs, which is a great tool!
Happy Striker

@rogerwang
Copy link
Member

This is fixed in git and will be available in the next nightly build.

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