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

[nw13beta2] Crash when using devtools to view source #4121

Closed
maxbarry opened this issue Dec 31, 2015 · 11 comments
Closed

[nw13beta2] Crash when using devtools to view source #4121

maxbarry opened this issue Dec 31, 2015 · 11 comments
Assignees
Labels

Comments

@maxbarry
Copy link

nwjs-sdk-v0.13.0-beta2-linux-x64 experiences a fatal crash on Ubuntu 15.10 when clicking a link in devtools to view the source of a custom module included with nw.require().

To reproduce:

  1. Start nwjs: nwjs-sdk-v0.13.0-beta2-linux-x64/nw
  2. Open devtools by right-clicking in window and selecting "Inspect".
  3. Require a custom module, e.g. var m = nw.require('/home/max/code/myApp/js/Game'). (The problem also occurs when requiring a custom module via a relative path, e.g. var m = nw.require('./js/Game'))
  4. If there's an error in the module, the devtools console will display a line like: Uncaught ReferenceError {message: "myTestThing is not defined"} /home/max/code/myApp/js/Game.js:31
    Similarly, the module might produce output via console.log().
  5. Clicking the underlined filename:lineNumber above in order to view the source code crashes everything (dev tools + app). The command line displays:
[5482:5482:1231/150908:FATAL:browser_view.cc(530)] Check failed: browser->is_type_popup(). opening browser window.
#0 0x7f726e52852e <unknown>

Aborted

Notably, this only happens when clicking a link that displays the module's full pathname. In some contexts, only the filename is shown instead (e.g. "Game.js:31"), and in these cases, hovering over it pops up a link like "chrome-extension://bdmasdoiqaslfdkhjasfhsda/js/Game.js", and I can click it to successfully navigate to view its source. However, when the full pathname is displayed, hovering will pop up a link like "chrome-devtools://devtools/home/max/code/myApp/js/Game.js", and clicking it will always produce a crash.

@rogerwang rogerwang self-assigned this Dec 31, 2015
@rogerwang
Copy link
Member

Could you please upload your sample for this?

@maxbarry
Copy link
Author

maxbarry commented Jan 5, 2016

console.log("hello");

If that code is /home/max/myModule.js, I can get a crash by running nwjs-sdk-v0.13.0-beta2-linux-x64/nw (with no arguments), opening devtools with Right-Click -> Inspect Background page, and typing var m = nw.require('/home/max/myModule.js') into the devtools console.

It then displays:

hello                                         /home/max/myModule.js:1

... and crashes when I click that link "/home/max/myModule.js:1".

@maxbarry
Copy link
Author

maxbarry commented Jan 5, 2016

Here is another way to do it:

package.json:

{
  "name": "sample",
  "main": "index.html"
}

index.html:

<!DOCTYPE html>
<html>
  <head>
    <title>Hello World!</title>
  </head>
  <body>
    <h1>Hello World!</h1>
    <script>
    nw.require('./myModule.js');
    </script>
  </body>
</html>

myModule.js:

console.log("hello");

To reproduce:

  1. nwjs-sdk-v0.13.0-beta2-linux-x64/nw .
  2. See "Hello World!" HTML page
  3. Right-click -> Inspect background page
  4. See console output: hello /home/max/myModule.js:1
  5. Click link above to myModule.js

Command-line displays:

[10666:10666:0105/144647:FATAL:browser_view.cc(530)] Check failed: browser->is_type_popup(). opening browser window.
#0 0x7f39436a352e <unknown>

Aborted

@rogerwang
Copy link
Member

With the latest nightly build it shouldn't crash any more, but the pointed URL is not found. @ghostoy could you look into this?

@rogerwang rogerwang added the nw13 label Jan 6, 2016
@rogerwang rogerwang assigned ghostoy and unassigned rogerwang Jan 6, 2016
@ghostoy
Copy link
Member

ghostoy commented Jan 6, 2016

It doesn't crash but popup a new window looks like this:
screen shot 2016-01-06 at 1 07 13 pm

@rogerwang
Copy link
Member

I knew it looks like this ... I mean could you please look to fix it?

@ghostoy
Copy link
Member

ghostoy commented Jan 6, 2016

Yeah. I'll take a look at this issue.

@gwicksted
Copy link

(related?) Crashes (for real) if you click on "module.js" link from Devtools console when it shows an error related to loading a module (eg if the module was not found). Let me know if this should be a new issue.

ghostoy pushed a commit to ghostoy/nw.js that referenced this issue Jan 7, 2016
Currently the Node context is created within the context of
background page. Reset the debugger id will cause debugger filter
out the compiled script from Node.

Fixed nwjs#4121
ghostoy pushed a commit to ghostoy/nw.js that referenced this issue Jan 7, 2016
In separate mode, the Node context is created within the context of
background page. Overwrite the debugger id will cause debugger filter
out the compiled scripts from Node.

Fixed nwjs#4121
ghostoy pushed a commit to ghostoy/nw.js that referenced this issue Jan 7, 2016
In separate mode, the Node context is created within the context of
background page. Overwrite the debugger id will cause debugger filter
out the compiled scripts from Node.

Fixed nwjs#4121
ghostoy pushed a commit to ghostoy/nw.js that referenced this issue Jan 13, 2016
@ghostoy ghostoy removed the test-todo label Jan 13, 2016
ghostoy pushed a commit to ghostoy/nw.js that referenced this issue Jan 14, 2016
rogerwang added a commit that referenced this issue Jan 14, 2016
@maxbarry
Copy link
Author

Not sure this is fixed. I get the same (crash) result from the same action with a slightly different test case in beta4.

package.json:

{
  "name": "sample",
  "main": "index.html"
}

index.html:

<!DOCTYPE html>
<html>
  <head>
    <title>Hello World!</title>
  </head>
  <body>
    <h1>Hello World!</h1>
    <script src="myModule.js"></script>
  </body>
</html>

myModule.js:

console.log("Loading myModule2...");

nw.require('./myModule2');

myModule2.js:

myTestError();

To reproduce:

  1. Run nwjs-sdk-v0.13.0-beta4-linux-x64/nw .
  2. Right-click on window and select "Inspect"
  3. Click to view Console. (It doesn't start in console by default any more?)
  4. See two lines of output:
Loading myModule2...         myModule.js:1 
Uncaught ReferenceError: myTestError is not defined    /home/max/code/sports/test2/myModule2.js:1

Clicking the first line of output ("Loading myModule2.js...") does work, kind of: It takes me to the source of myModule.js, although it forgets which line number it's supposed to be showing (instead of scrolling to and highlighting the right one).

Clicking the "Uncaught ReferenceError" line produces the same crashing error as before:

[9837:9837:0119/101658:FATAL:browser_view.cc(533)] Check failed: browser->is_type_popup(). opening browser window.
#0 0x7fae84f450ee <unknown>

Aborted

@rogerwang
Copy link
Member

@ghostoy pls follow up.

@rogerwang rogerwang reopened this Jan 19, 2016
@rogerwang
Copy link
Member

Fixed in git and will be available in the next nightly build.

rogerwang pushed a commit to nwjs/chromium.src that referenced this issue Feb 19, 2016
By default, the disposition is `NEW_FOREGROUND_TAB`, which will be
opened in a browser tab.

Fixed nwjs/nw.js#4269 nwjs/nw.js#4121
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants