question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Crashing when reading undefined variable inside a iframe script

See original GitHub issue

(NWJS v0.15.0 sdk stable win x64) Example code:

"use strict";
var iframe = document.createElement("iframe");
document.body.appendChild(iframe);
setTimeout(()=>{ 
    var script = document.createElement('script');
    script.type = 'text/javascript';
    script.src = "my-script.js";
    iframe.contentWindow.document.head.appendChild(script);
},2500);

Inside my-script.js:

"use strict";
foo = UndefinedVariable; //The variable is undefined, the scripts loads fine and executes, 
// but nw.js crashes when the execution reach this point. No console.error is printed. Only crashes. 

debug.log

[0530/032119:ERROR:process_info.cc(608)] range at 0x10c740fe00000000, size 0x2ba fully unreadable
[0530/032119:ERROR:process_info.cc(608)] range at 0x10c7411e00000000, size 0x2ba fully unreadable
[0530/032119:ERROR:process_info.cc(608)] range at 0x0, size 0x2ba fully unreadable
[0530/032119:WARNING:in_range_cast.h(38)] value 2998168657146 out of range
[0530/032119:WARNING:in_range_cast.h(38)] value 2998168653368 out of range
[0530/032119:WARNING:in_range_cast.h(38)] value 2998168657186 out of range
[0530/032119:WARNING:in_range_cast.h(38)] value 108084205055182070 out of range
[0530/032119:WARNING:in_range_cast.h(38)] value 2998169270288 out of range

Thanks.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:2
  • Comments:27 (10 by maintainers)

github_iconTop GitHub Comments

2reactions
rohan-deshpandecommented, Jun 20, 2016

@frankhale yeah I know. I’ll try to reproduce my situation in a small sample. Will test the above code now and come back with results.

Update hmm the above code doesn’t crash my build. When my crash happens again, I’ll be sure to make a note of what did it and try to reproduce the issue.

2reactions
rogerwangcommented, Jun 3, 2016

Yes and here it is : http://dl.nwjs.io/live-build/06-03-2016/nw15-024592f-5c2963f-0b926c0-42b9671/v0.15.2/

0.15.2 will be released in next week. You can use this build if you cannot wait. The quality of this build is same as releases according to our tests.

Read more comments on GitHub >

github_iconTop Results From Across the Web

javascript - Access iframe variable from parent - undefined
Declare global variables in the parent and set them in the iframe document using parent.var_name. You can also access child vars by creating ......
Read more >
​​Avoiding those dang cannot read property of undefined ...
Uncaught TypeError: Cannot read property 'foo' of undefined. ​ The dreaded error we all hit at some point in JavaScript development.
Read more >
Handling common JavaScript problems - MDN Web Docs
Incorrectly using functions inside loops that iterate with a global variable (more generally "getting the scope wrong"). For example, in bad-for ...
Read more >
Top 18 Most Common AngularJS Developer Mistakes
In this article you will learn about most common AngularJS developer mistakes ... is set to false, calling .scope() on a DOM node...
Read more >
Release Notes | Tealium for JavaScript (utag.js)
Fixes issue with utag.js running in iframe in a testing environment (such as ... Removed use of global variable i – previously used...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found