mattr- / slate

A window management application (replacement for Divvy/SizeUp/ShiftIt)
GNU General Public License v3.0
614 stars 39 forks source link

Silently exits without raising exception in certain kinds of invalid JS #49

Closed d3v-null closed 5 years ago

d3v-null commented 9 years ago

Hey there, I have OSX El Cap and Slate v1.2 running with only a .slate.js file in my home directory and I was trying to debug my code by looking at the console, but couldn't figure out what was wrong with it because slate wouldn't even run my calls to log. I discovered that certain invalid javascript is not picked up by slate, and instead of telling the user that there is something wrong with their code, slate will just exit.

Here's what my file looked like

slate.log("BEFORE BAD JS");

function (a, b) {
    return a + b;
}

slate.log("AFTER BAD JS");

Here is the console log when the bad JS is commented out

1/11/2015 3:26:27.588 PM launchservicesd[86]: SecTaskLoadEntitlements failed error=22
1/11/2015 3:26:27.591 PM launchservicesd[86]: SecTaskLoadEntitlements failed error=22
1/11/2015 3:26:27.592 PM launchservicesd[86]: SecTaskLoadEntitlements failed error=22
1/11/2015 3:26:27.610 PM sharedfilelistd[380]: SecTaskLoadEntitlements failed error=22
1/11/2015 3:26:27.621 PM launchservicesd[86]: SecTaskLoadEntitlements failed error=22
1/11/2015 3:26:27.624 PM launchservicesd[86]: SecTaskLoadEntitlements failed error=22
1/11/2015 3:26:27.694 PM tccd[467]: SecTaskLoadEntitlements failed error=22
1/11/2015 3:26:27.737 PM tccd[467]: SecTaskLoadEntitlements failed error=22
1/11/2015 3:26:27.769 PM tccd[467]: SecTaskLoadEntitlements failed error=22
1/11/2015 3:26:27.801 PM Bartender 2[449]: SecTaskLoadEntitlements failed error=22
1/11/2015 3:26:27.801 PM Bartender 2[449]: SecTaskLoadEntitlements failed error=22
1/11/2015 3:26:27.801 PM Bartender 2[449]: SecTaskLoadEntitlements failed error=22
1/11/2015 3:26:27.805 PM Slate[816]: JS INIT FINISHED
1/11/2015 3:26:27.805 PM Slate[816]: BEFORE BAD JS
1/11/2015 3:26:27.806 PM Slate[816]: AFTER BAD JS
1/11/2015 3:26:27.809 PM tccd[467]: SecTaskLoadEntitlements failed error=22
1/11/2015 3:26:27.838 PM Finder[376]: SecTaskLoadEntitlements failed error=22
1/11/2015 3:26:27.838 PM Finder[376]: SecTaskLoadEntitlements failed error=22
1/11/2015 3:26:27.838 PM Finder[376]: SecTaskLoadEntitlements failed error=22
1/11/2015 3:26:27.843 PM tccd[467]: SecTaskLoadEntitlements failed error=22
1/11/2015 3:26:27.872 PM No-IP DUC[486]: SecTaskLoadEntitlements failed error=22
1/11/2015 3:26:27.872 PM No-IP DUC[486]: SecTaskLoadEntitlements failed error=22
1/11/2015 3:26:27.872 PM No-IP DUC[486]: SecTaskLoadEntitlements failed error=22
1/11/2015 3:26:27.876 PM tccd[467]: SecTaskLoadEntitlements failed error=22
1/11/2015 3:26:27.904 PM Safari[610]: SecTaskLoadEntitlements failed error=22
1/11/2015 3:26:27.904 PM Safari[610]: SecTaskLoadEntitlements failed error=22
1/11/2015 3:26:27.904 PM Safari[610]: SecTaskLoadEntitlements failed error=22
1/11/2015 3:26:27.906 PM tccd[467]: SecTaskLoadEntitlements failed error=22
1/11/2015 3:26:27.935 PM Mail[650]: SecTaskLoadEntitlements failed error=22
1/11/2015 3:26:27.935 PM Mail[650]: SecTaskLoadEntitlements failed error=22
1/11/2015 3:26:27.935 PM Mail[650]: SecTaskLoadEntitlements failed error=22
1/11/2015 3:26:27.936 PM tccd[467]: SecTaskLoadEntitlements failed error=22
1/11/2015 3:26:27.965 PM Console[721]: SecTaskLoadEntitlements failed error=22
1/11/2015 3:26:27.965 PM Console[721]: SecTaskLoadEntitlements failed error=22
1/11/2015 3:26:27.965 PM Console[721]: SecTaskLoadEntitlements failed error=22
1/11/2015 3:26:27.968 PM tccd[467]: SecTaskLoadEntitlements failed error=22
1/11/2015 3:26:27.994 PM Sublime Text[737]: SecTaskLoadEntitlements failed error=22
1/11/2015 3:26:27.994 PM Sublime Text[737]: SecTaskLoadEntitlements failed error=22
1/11/2015 3:26:27.995 PM Sublime Text[737]: SecTaskLoadEntitlements failed error=22
1/11/2015 3:26:28.001 PM appleeventsd[57]: SecTaskLoadEntitlements failed error=22
1/11/2015 3:26:28.014 PM sharedfilelistd[380]: SecTaskLoadEntitlements failed error=22
1/11/2015 3:26:28.023 PM tccd[467]: SecTaskLoadEntitlements failed error=22
1/11/2015 3:26:28.024 PM tccd[467]: SecTaskLoadEntitlements failed error=22
1/11/2015 3:26:28.024 PM tccd[467]: SecTaskLoadEntitlements failed error=22
1/11/2015 3:26:28.024 PM tccd[467]: SecTaskLoadEntitlements failed error=22
1/11/2015 3:26:28.024 PM tccd[467]: SecTaskLoadEntitlements failed error=22
1/11/2015 3:26:28.157 PM com.apple.WebKit.WebContent[710]: SecTaskLoadEntitlements failed error=22
1/11/2015 3:26:28.157 PM com.apple.WebKit.WebContent[710]: SecTaskLoadEntitlements failed error=22
1/11/2015 3:26:28.157 PM com.apple.WebKit.WebContent[710]: SecTaskLoadEntitlements failed error=22
1/11/2015 3:26:28.157 PM com.apple.WebKit.WebContent[732]: SecTaskLoadEntitlements failed error=22
1/11/2015 3:26:28.157 PM com.apple.WebKit.WebContent[732]: SecTaskLoadEntitlements failed error=22
1/11/2015 3:26:28.157 PM com.apple.WebKit.WebContent[732]: SecTaskLoadEntitlements failed error=22
1/11/2015 3:26:28.157 PM com.apple.WebKit.WebContent[729]: SecTaskLoadEntitlements failed error=22
1/11/2015 3:26:28.157 PM com.apple.WebKit.WebContent[729]: SecTaskLoadEntitlements failed error=22
1/11/2015 3:26:28.157 PM com.apple.WebKit.WebContent[729]: SecTaskLoadEntitlements failed error=22
1/11/2015 3:26:28.157 PM com.apple.WebKit.WebContent[711]: SecTaskLoadEntitlements failed error=22
1/11/2015 3:26:28.157 PM com.apple.WebKit.WebContent[725]: SecTaskLoadEntitlements failed error=22
1/11/2015 3:26:28.157 PM com.apple.WebKit.WebContent[725]: SecTaskLoadEntitlements failed error=22
1/11/2015 3:26:28.157 PM com.apple.WebKit.WebContent[711]: SecTaskLoadEntitlements failed error=22
1/11/2015 3:26:28.157 PM com.apple.WebKit.WebContent[711]: SecTaskLoadEntitlements failed error=22
1/11/2015 3:26:28.157 PM com.apple.WebKit.WebContent[725]: SecTaskLoadEntitlements failed error=22
1/11/2015 3:26:29.640 PM Slate[816]: Bartender: Loaded BartenderHelperTwoThree
1/11/2015 3:26:32.633 PM secd[390]:  __SOSCCProcessSyncWithAllPeers_Server_block_invoke sync with all peers failed: Error Domain=com.apple.security.sos.error Code=1032 "peer: d+usrzd+ivN3B7u/HW38XhsCfp not found" UserInfo={NSDescription=peer: d+usrzd+ivN3B7u/HW38XhsCfp not found}
1/11/2015 3:26:32.636 PM CloudKeychainProxy[455]:  __39-[UbiqitousKVSProxy doSyncWithAllPeers]_block_invoke_2 <UBK-s-pC---> syncWithAllPeers (null), rescheduling timer
1/11/2015 3:26:32.642 PM launchservicesd[86]: SecTaskLoadEntitlements failed error=22
1/11/2015 3:26:32.643 PM launchservicesd[86]: SecTaskLoadEntitlements failed error=22

And here it is with the JS uncommented

1/11/2015 3:25:15.107 PM launchservicesd[86]: SecTaskLoadEntitlements failed error=22
1/11/2015 3:25:15.109 PM launchservicesd[86]: SecTaskLoadEntitlements failed error=22
1/11/2015 3:25:15.111 PM launchservicesd[86]: SecTaskLoadEntitlements failed error=22
1/11/2015 3:25:15.131 PM sharedfilelistd[380]: SecTaskLoadEntitlements failed error=22
1/11/2015 3:25:15.143 PM launchservicesd[86]: SecTaskLoadEntitlements failed error=22
1/11/2015 3:25:15.146 PM launchservicesd[86]: SecTaskLoadEntitlements failed error=22
1/11/2015 3:25:15.218 PM tccd[467]: SecTaskLoadEntitlements failed error=22
1/11/2015 3:25:15.262 PM tccd[467]: SecTaskLoadEntitlements failed error=22
1/11/2015 3:25:15.291 PM tccd[467]: SecTaskLoadEntitlements failed error=22
1/11/2015 3:25:15.327 PM Bartender 2[449]: SecTaskLoadEntitlements failed error=22
1/11/2015 3:25:15.327 PM Bartender 2[449]: SecTaskLoadEntitlements failed error=22
1/11/2015 3:25:15.327 PM Bartender 2[449]: SecTaskLoadEntitlements failed error=22
1/11/2015 3:25:15.332 PM Slate[805]: JS INIT FINISHED
1/11/2015 3:25:15.334 PM tccd[467]: SecTaskLoadEntitlements failed error=22
1/11/2015 3:25:15.363 PM Finder[376]: SecTaskLoadEntitlements failed error=22
1/11/2015 3:25:15.363 PM Finder[376]: SecTaskLoadEntitlements failed error=22
1/11/2015 3:25:15.363 PM Finder[376]: SecTaskLoadEntitlements failed error=22
1/11/2015 3:25:15.367 PM tccd[467]: SecTaskLoadEntitlements failed error=22
1/11/2015 3:25:15.397 PM No-IP DUC[486]: SecTaskLoadEntitlements failed error=22
1/11/2015 3:25:15.397 PM No-IP DUC[486]: SecTaskLoadEntitlements failed error=22
1/11/2015 3:25:15.397 PM No-IP DUC[486]: SecTaskLoadEntitlements failed error=22
1/11/2015 3:25:15.401 PM tccd[467]: SecTaskLoadEntitlements failed error=22
1/11/2015 3:25:15.432 PM Safari[610]: SecTaskLoadEntitlements failed error=22
1/11/2015 3:25:15.432 PM Safari[610]: SecTaskLoadEntitlements failed error=22
1/11/2015 3:25:15.432 PM Safari[610]: SecTaskLoadEntitlements failed error=22
1/11/2015 3:25:15.434 PM tccd[467]: SecTaskLoadEntitlements failed error=22
1/11/2015 3:25:15.464 PM Mail[650]: SecTaskLoadEntitlements failed error=22
1/11/2015 3:25:15.464 PM Mail[650]: SecTaskLoadEntitlements failed error=22
1/11/2015 3:25:15.464 PM Mail[650]: SecTaskLoadEntitlements failed error=22
1/11/2015 3:25:15.465 PM tccd[467]: SecTaskLoadEntitlements failed error=22
1/11/2015 3:25:15.496 PM Console[721]: SecTaskLoadEntitlements failed error=22
1/11/2015 3:25:15.496 PM Console[721]: SecTaskLoadEntitlements failed error=22
1/11/2015 3:25:15.496 PM Console[721]: SecTaskLoadEntitlements failed error=22
1/11/2015 3:25:15.499 PM tccd[467]: SecTaskLoadEntitlements failed error=22
1/11/2015 3:25:15.528 PM Sublime Text[737]: SecTaskLoadEntitlements failed error=22
1/11/2015 3:25:15.528 PM Sublime Text[737]: SecTaskLoadEntitlements failed error=22
1/11/2015 3:25:15.528 PM Sublime Text[737]: SecTaskLoadEntitlements failed error=22
1/11/2015 3:25:15.535 PM appleeventsd[57]: SecTaskLoadEntitlements failed error=22
1/11/2015 3:25:15.549 PM sharedfilelistd[380]: SecTaskLoadEntitlements failed error=22
1/11/2015 3:25:15.553 PM tccd[467]: SecTaskLoadEntitlements failed error=22
1/11/2015 3:25:15.553 PM tccd[467]: SecTaskLoadEntitlements failed error=22
1/11/2015 3:25:15.553 PM tccd[467]: SecTaskLoadEntitlements failed error=22
1/11/2015 3:25:15.553 PM tccd[467]: SecTaskLoadEntitlements failed error=22
1/11/2015 3:25:15.554 PM tccd[467]: SecTaskLoadEntitlements failed error=22
1/11/2015 3:25:15.693 PM com.apple.WebKit.WebContent[710]: SecTaskLoadEntitlements failed error=22
1/11/2015 3:25:15.693 PM com.apple.WebKit.WebContent[710]: SecTaskLoadEntitlements failed error=22
1/11/2015 3:25:15.693 PM com.apple.WebKit.WebContent[710]: SecTaskLoadEntitlements failed error=22
1/11/2015 3:25:15.693 PM com.apple.WebKit.WebContent[729]: SecTaskLoadEntitlements failed error=22
1/11/2015 3:25:15.694 PM com.apple.WebKit.WebContent[729]: SecTaskLoadEntitlements failed error=22
1/11/2015 3:25:15.694 PM com.apple.WebKit.WebContent[729]: SecTaskLoadEntitlements failed error=22
1/11/2015 3:25:15.694 PM com.apple.WebKit.WebContent[725]: SecTaskLoadEntitlements failed error=22
1/11/2015 3:25:15.694 PM com.apple.WebKit.WebContent[732]: SecTaskLoadEntitlements failed error=22
1/11/2015 3:25:15.694 PM com.apple.WebKit.WebContent[725]: SecTaskLoadEntitlements failed error=22
1/11/2015 3:25:15.694 PM com.apple.WebKit.WebContent[732]: SecTaskLoadEntitlements failed error=22
1/11/2015 3:25:15.694 PM com.apple.WebKit.WebContent[732]: SecTaskLoadEntitlements failed error=22
1/11/2015 3:25:15.694 PM com.apple.WebKit.WebContent[711]: SecTaskLoadEntitlements failed error=22
1/11/2015 3:25:15.694 PM com.apple.WebKit.WebContent[711]: SecTaskLoadEntitlements failed error=22
1/11/2015 3:25:15.694 PM com.apple.WebKit.WebContent[725]: SecTaskLoadEntitlements failed error=22
1/11/2015 3:25:15.694 PM com.apple.WebKit.WebContent[711]: SecTaskLoadEntitlements failed error=22
1/11/2015 3:25:16.983 PM secd[390]:  __SOSCCProcessSyncWithAllPeers_Server_block_invoke sync with all peers failed: Error Domain=com.apple.security.sos.error Code=1032 "peer: d+usrzd+ivN3B7u/HW38XhsCfp not found" UserInfo={NSDescription=peer: d+usrzd+ivN3B7u/HW38XhsCfp not found}
1/11/2015 3:25:16.987 PM CloudKeychainProxy[455]:  __39-[UbiqitousKVSProxy doSyncWithAllPeers]_block_invoke_2 <UBK-s-pC---> syncWithAllPeers (null), rescheduling timer
1/11/2015 3:25:17.163 PM Slate[805]: Bartender: Loaded BartenderHelperTwoThree

Also I think the console log is a bit concerning, is it normal to have that many errors?

d3v-null commented 9 years ago

Also I've noticed that even putting comments under valid JS will completely break slate.

if my .slate.js file is

slate.log("HELLO");

it will output hello in the log, but if my .slate.js file is

slate.log("HELLO");
//Comment

It won't output anything. This however works fine:

//Comment
slate.log("HELLO");

This is pretty frustrating :/