Skip to content
Snippets Groups Projects
  • Rob Swindell's avatar
    6ed4a05f
    Native JS methods must return JS_FALSE for (Error) exceptions to be thrown · 6ed4a05f
    Rob Swindell authored
    I discovered the first case when FileBase.get_path() failed, but didn't
    (immediately) throw an exception. Reviewing the other instances of
    JS_RepoertError() calls found several that either reported a garbage (e.g.
    NULL) string value or returned JS_TRUE.
    
    The design pattern used a little in js_socket.c probably should be used more:
    
    	if (JS_IsExceptionPending(cx))
    		return JS_FALSE;
    	return JS_TRUE;
    
    ... but that's more of a refactor than I had the stomach for right now.
    6ed4a05f
    History
    Native JS methods must return JS_FALSE for (Error) exceptions to be thrown
    Rob Swindell authored
    I discovered the first case when FileBase.get_path() failed, but didn't
    (immediately) throw an exception. Reviewing the other instances of
    JS_RepoertError() calls found several that either reported a garbage (e.g.
    NULL) string value or returned JS_TRUE.
    
    The design pattern used a little in js_socket.c probably should be used more:
    
    	if (JS_IsExceptionPending(cx))
    		return JS_FALSE;
    	return JS_TRUE;
    
    ... but that's more of a refactor than I had the stomach for right now.