예제 #1
0
/*
 * NativePickDefaultDirectory
 * Platform-specific implementation of GetDirectoryPath
 */
char* nsFolderSpec::NativePickDefaultDirectory(void)
{
  su_PickDirTimer callback;
  char * packageName;
  char prompt[200];

 
  callback.context = XP_FindSomeContext();
  callback.fileName = NULL;
  callback.done = FALSE;
  /* Get the name of the package to prompt for */
  packageName = userPackageName;

  if (packageName)
    {
      /* In Java thread now, and need to call FE_PromptForFileName
       * from the main thread
       * post an event on a timer, and busy-wait until it completes.
       */
      PR_snprintf(prompt, 200, XP_GetString(SU_INSTALL_ASK_FOR_DIRECTORY), packageName); 
      callback.prompt = prompt;
      FE_SetTimeout( pickDirectoryCallback, &callback, 1 );
      while (!callback.done)  /* Busy loop for now */
        PR_Sleep(PR_INTERVAL_NO_WAIT); /* java_lang_Thread_yield(WHAT?); */
    }

  return callback.fileName;
}
예제 #2
0
JSBool PR_CALLBACK asd_alert
	(JSContext *cx, JSObject *obj, uint argc, jsval *argv, jsval *rval)
{
	if (argc >= 1 && JSVAL_IS_STRING(argv[0])) {
		char* msg = JS_GetStringBytes(JSVAL_TO_STRING(argv[0]));
		MWContext* ctx = XP_FindSomeContext();
		
		if (ctx)
			FE_Alert(ctx, msg);
	}
	return JS_TRUE;
}