Skip to content

referencing undefined object halts script  #201

Description

@cmroanirgo

On OSX, it seems that when I reference an object that is not defined, it halts the script:

<!DOCTYPE html>
<html>
<body>
    If you can read this, the script has halted!
</body>
<script type="text/javascript">
if (module)
 ; // do nothing
window.location = 'http://google.com';
</script>
</html>

and using it's launched with this:

require('Common'); // Includes Tint's API, and sets up the runtime bridge.
var window = new Window(); // Creates an initially hidden window.
application.exitAfterWindowsClose = true; // If no windows are open, exit.
window.width = 800;
window.height = 600;
window.title = "Scramble"; // Give the window a caption.
window.visible = true; // Show the window to the user.

var webview = new WebView(); // Create a new webview for HTML.
window.appendChild(webview); // attach the webview to the window.

// position the webview 0 pixels from all the window's edges.
webview.left=webview.right=webview.top=webview.bottom=0;

webview.location = "app://index.html"; // Tell the webview to render the index.html

NOTE:

  • It doesn't matter where the script tag is, or whether the script is in a .js file.
  • tint v6.1.0
  • node 4.4.7
  • OSX 10.10.5 (Safari 8.0.8)

These variances of script also fail to redirect to google:

function _isUndefined(x) { return typeof x === undefined; }
if (!_isUndefined(module))
 ; // do nothing
window.location = 'http://google.com';

but this one works:

if (!(typeof(module)=== undefined)) {
    ; // do nothing
}
window.location = 'http://google.com';

until I do this:

if (!(typeof(module)=== undefined)) {
  module.exports = {};
}
window.location = 'http://google.com';
  • When I comment out module.exports = {}; then the script correctly redirects to google.com.

Any ideas?

(I'm looking at porting a project from electron to tint -- but getting nowhere)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions